vue-devui 1.0.0-rc.1 → 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 (328) hide show
  1. package/README.md +149 -200
  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 +8166 -287
  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 +29 -4
  12. package/badge/index.umd.js +1 -1
  13. package/badge/style.css +1 -1
  14. package/button/index.es.js +5726 -111
  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 +3 -6
  29. package/countdown/index.umd.js +1 -1
  30. package/date-picker/index.es.js +8130 -242
  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 +209 -148
  37. package/dropdown/index.umd.js +1 -1
  38. package/dropdown/style.css +1 -1
  39. package/editable-select/index.es.js +521 -153
  40. package/editable-select/index.umd.js +1 -1
  41. package/editable-select/style.css +1 -1
  42. package/form/index.es.js +1040 -1187
  43. package/form/index.umd.js +16 -16
  44. package/form/style.css +1 -1
  45. package/fullscreen/index.es.js +29 -5
  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 +182 -23
  52. package/icon/index.umd.js +1 -1
  53. package/icon/style.css +1 -0
  54. package/image-preview/index.es.js +53 -30
  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 +274 -177
  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 +374 -171
  70. package/modal/index.umd.js +1 -1
  71. package/modal/style.css +1 -1
  72. package/notification/index.es.js +292 -40
  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/RadioButton.js +3 -0
  89. package/nuxt/components/Tab.js +3 -0
  90. package/nuxt/components/autoCompleteProps.js +3 -0
  91. package/nuxt/components/avatarProps.js +3 -0
  92. package/nuxt/components/buttonGroupInjectionKey.js +3 -0
  93. package/nuxt/components/buttonGroupProps.js +3 -0
  94. package/nuxt/components/cardProps.js +3 -0
  95. package/nuxt/components/checkboxGroupInjectionKey.js +3 -0
  96. package/nuxt/components/checkboxGroupProps.js +3 -0
  97. package/nuxt/components/checkboxProps.js +3 -0
  98. package/nuxt/components/colProps.js +3 -0
  99. package/nuxt/components/colPropsBaseClass.js +3 -0
  100. package/nuxt/components/colPropsBaseStyle.js +3 -0
  101. package/nuxt/components/collapseItemProps.js +3 -0
  102. package/nuxt/components/collapseProps.js +3 -0
  103. package/nuxt/components/countdownProps.js +3 -0
  104. package/nuxt/components/editableSelectProps.js +3 -0
  105. package/nuxt/components/formItemProps.js +3 -0
  106. package/nuxt/components/formProps.js +3 -0
  107. package/nuxt/components/iconProps.js +1 -0
  108. package/nuxt/components/imagePreviewProps.js +3 -0
  109. package/nuxt/components/inputProps.js +3 -0
  110. package/nuxt/components/loadingProps.js +3 -0
  111. package/nuxt/components/modalProps.js +3 -0
  112. package/nuxt/components/progressProps.js +3 -0
  113. package/nuxt/components/rateProps.js +3 -0
  114. package/nuxt/components/resultProps.js +3 -0
  115. package/nuxt/components/rowProps.js +3 -0
  116. package/nuxt/components/screenSizes.js +3 -0
  117. package/nuxt/components/skeletonProps.js +3 -0
  118. package/nuxt/components/sliderProps.js +3 -0
  119. package/nuxt/components/splitterProps.js +3 -0
  120. package/nuxt/components/statisticProps.js +3 -0
  121. package/nuxt/components/svgIconProps.js +3 -0
  122. package/nuxt/components/switchProps.js +3 -0
  123. package/nuxt/components/tabsProps.js +3 -0
  124. package/nuxt/components/tagProps.js +3 -0
  125. package/nuxt/components/textareaProps.js +3 -0
  126. package/nuxt/components/timeAxisProps.js +3 -0
  127. package/nuxt/components/treeProps.js +3 -0
  128. package/overlay/index.es.js +104 -133
  129. package/overlay/index.umd.js +1 -1
  130. package/overlay/style.css +1 -1
  131. package/package.json +3 -2
  132. package/pagination/index.es.js +148 -136
  133. package/pagination/index.umd.js +1 -1
  134. package/pagination/style.css +1 -1
  135. package/panel/style.css +1 -1
  136. package/popover/index.es.js +294 -230
  137. package/popover/index.umd.js +15 -15
  138. package/popover/style.css +1 -1
  139. package/progress/index.es.js +110 -56
  140. package/progress/index.umd.js +3 -3
  141. package/progress/style.css +1 -1
  142. package/radio/index.es.js +7959 -146
  143. package/radio/index.umd.js +27 -1
  144. package/radio/style.css +1 -1
  145. package/rate/index.es.js +77 -55
  146. package/rate/index.umd.js +1 -1
  147. package/rate/style.css +1 -1
  148. package/result/index.es.js +169 -27
  149. package/result/index.umd.js +1 -1
  150. package/result/style.css +1 -1
  151. package/ripple/index.es.js +43 -42
  152. package/ripple/index.umd.js +1 -1
  153. package/search/index.es.js +3620 -1095
  154. package/search/index.umd.js +18 -18
  155. package/search/style.css +1 -1
  156. package/select/index.es.js +9131 -584
  157. package/select/index.umd.js +27 -1
  158. package/select/style.css +1 -1
  159. package/skeleton/index.es.js +46 -24
  160. package/skeleton/index.umd.js +1 -1
  161. package/skeleton/style.css +1 -1
  162. package/slider/index.es.js +108 -75
  163. package/slider/index.umd.js +1 -1
  164. package/slider/style.css +1 -1
  165. package/splitter/index.es.js +443 -335
  166. package/splitter/index.umd.js +15 -15
  167. package/splitter/style.css +1 -1
  168. package/statistic/index.es.js +7 -18
  169. package/statistic/index.umd.js +1 -1
  170. package/status/index.es.js +26 -2
  171. package/status/index.umd.js +1 -1
  172. package/status/style.css +1 -1
  173. package/style.css +1 -1
  174. package/switch/index.es.js +7794 -64
  175. package/switch/index.umd.js +27 -1
  176. package/switch/style.css +1 -1
  177. package/table/index.es.js +10038 -1180
  178. package/table/index.umd.js +27 -1
  179. package/table/style.css +1 -1
  180. package/tabs/index.es.js +342 -141
  181. package/tabs/index.umd.js +1 -1
  182. package/tabs/style.css +1 -1
  183. package/tag/index.es.js +47 -23
  184. package/tag/index.umd.js +1 -1
  185. package/tag/style.css +1 -1
  186. package/textarea/index.es.js +7913 -83
  187. package/textarea/index.umd.js +35 -1
  188. package/textarea/style.css +1 -1
  189. package/timeline/index.es.js +176 -37
  190. package/timeline/index.umd.js +1 -1
  191. package/timeline/style.css +1 -1
  192. package/tooltip/index.es.js +285 -220
  193. package/tooltip/index.umd.js +15 -15
  194. package/tooltip/style.css +1 -1
  195. package/tree/index.es.js +4190 -1857
  196. package/tree/index.umd.js +18 -18
  197. package/tree/style.css +1 -1
  198. package/upload/index.es.js +365 -106
  199. package/upload/index.umd.js +1 -1
  200. package/upload/style.css +1 -1
  201. package/vue-devui.es.js +20102 -25264
  202. package/vue-devui.umd.js +25 -15
  203. package/accordion/index.es.js +0 -723
  204. package/accordion/index.umd.js +0 -1
  205. package/accordion/package.json +0 -7
  206. package/accordion/style.css +0 -1
  207. package/anchor/index.d.ts +0 -7
  208. package/anchor/index.es.js +0 -263
  209. package/anchor/index.umd.js +0 -1
  210. package/anchor/style.css +0 -1
  211. package/back-top/index.d.ts +0 -7
  212. package/back-top/index.es.js +0 -130
  213. package/back-top/index.umd.js +0 -1
  214. package/back-top/package.json +0 -7
  215. package/back-top/style.css +0 -1
  216. package/breadcrumb/index.d.ts +0 -7
  217. package/breadcrumb/index.es.js +0 -128
  218. package/breadcrumb/index.umd.js +0 -1
  219. package/breadcrumb/package.json +0 -7
  220. package/breadcrumb/style.css +0 -1
  221. package/carousel/index.d.ts +0 -7
  222. package/carousel/index.es.js +0 -314
  223. package/carousel/index.umd.js +0 -1
  224. package/carousel/package.json +0 -7
  225. package/carousel/style.css +0 -1
  226. package/cascader/index.d.ts +0 -7
  227. package/cascader/index.es.js +0 -5971
  228. package/cascader/index.umd.js +0 -27
  229. package/cascader/package.json +0 -7
  230. package/cascader/style.css +0 -1
  231. package/color-picker/index.d.ts +0 -7
  232. package/color-picker/index.es.js +0 -8196
  233. package/color-picker/index.umd.js +0 -27
  234. package/color-picker/package.json +0 -7
  235. package/color-picker/style.css +0 -1
  236. package/comment/index.d.ts +0 -7
  237. package/comment/index.es.js +0 -86
  238. package/comment/index.umd.js +0 -1
  239. package/comment/package.json +0 -7
  240. package/comment/style.css +0 -1
  241. package/dragdrop/index.d.ts +0 -7
  242. package/dragdrop/index.es.js +0 -157
  243. package/dragdrop/index.umd.js +0 -1
  244. package/dragdrop/package.json +0 -7
  245. package/gantt/index.d.ts +0 -7
  246. package/gantt/index.es.js +0 -523
  247. package/gantt/index.umd.js +0 -1
  248. package/gantt/package.json +0 -7
  249. package/gantt/style.css +0 -1
  250. package/input-icon/index.d.ts +0 -7
  251. package/input-icon/index.es.js +0 -332
  252. package/input-icon/index.umd.js +0 -1
  253. package/input-icon/package.json +0 -7
  254. package/input-icon/style.css +0 -1
  255. package/list/index.d.ts +0 -7
  256. package/list/index.es.js +0 -39
  257. package/list/index.umd.js +0 -1
  258. package/list/package.json +0 -7
  259. package/list/style.css +0 -1
  260. package/nav-sprite/index.d.ts +0 -7
  261. package/nav-sprite/index.es.js +0 -68
  262. package/nav-sprite/index.umd.js +0 -1
  263. package/nav-sprite/package.json +0 -7
  264. package/nuxt/components/Accordion.js +0 -3
  265. package/nuxt/components/Anchor.js +0 -3
  266. package/nuxt/components/BackTop.js +0 -3
  267. package/nuxt/components/Breadcrumb.js +0 -3
  268. package/nuxt/components/Carousel.js +0 -3
  269. package/nuxt/components/CarouselItem.js +0 -3
  270. package/nuxt/components/Cascader.js +0 -3
  271. package/nuxt/components/ColorPicker.js +0 -3
  272. package/nuxt/components/Comment.js +0 -3
  273. package/nuxt/components/FormControl.js +0 -3
  274. package/nuxt/components/FormLabel.js +0 -3
  275. package/nuxt/components/Gantt.js +0 -3
  276. package/nuxt/components/InputIcon.js +0 -3
  277. package/nuxt/components/List.js +0 -3
  278. package/nuxt/components/ListItem.js +0 -3
  279. package/nuxt/components/NavSprite.js +0 -2
  280. package/nuxt/components/QuadrantDiagram.js +0 -3
  281. package/nuxt/components/ReadTip.js +0 -3
  282. package/nuxt/components/StepsGuide.js +0 -3
  283. package/nuxt/components/Sticky.js +0 -2
  284. package/nuxt/components/TagInput.js +0 -3
  285. package/nuxt/components/TimePicker.js +0 -3
  286. package/nuxt/components/Transfer.js +0 -3
  287. package/nuxt/components/TreeSelect.js +0 -3
  288. package/nuxt/components/overlayEmits.js +0 -3
  289. package/nuxt/components/overlayProps.js +0 -3
  290. package/quadrant-diagram/index.d.ts +0 -7
  291. package/quadrant-diagram/index.es.js +0 -5728
  292. package/quadrant-diagram/index.umd.js +0 -27
  293. package/quadrant-diagram/package.json +0 -7
  294. package/quadrant-diagram/style.css +0 -1
  295. package/read-tip/index.d.ts +0 -7
  296. package/read-tip/index.es.js +0 -261
  297. package/read-tip/index.umd.js +0 -1
  298. package/read-tip/package.json +0 -7
  299. package/read-tip/style.css +0 -1
  300. package/steps-guide/index.d.ts +0 -7
  301. package/steps-guide/index.es.js +0 -242
  302. package/steps-guide/index.umd.js +0 -1
  303. package/steps-guide/package.json +0 -7
  304. package/steps-guide/style.css +0 -1
  305. package/sticky/index.d.ts +0 -7
  306. package/sticky/index.es.js +0 -197
  307. package/sticky/index.umd.js +0 -1
  308. package/sticky/package.json +0 -7
  309. package/tag-input/index.d.ts +0 -7
  310. package/tag-input/index.es.js +0 -331
  311. package/tag-input/index.umd.js +0 -1
  312. package/tag-input/package.json +0 -7
  313. package/tag-input/style.css +0 -1
  314. package/time-picker/index.d.ts +0 -7
  315. package/time-picker/index.es.js +0 -1238
  316. package/time-picker/index.umd.js +0 -1
  317. package/time-picker/package.json +0 -7
  318. package/time-picker/style.css +0 -1
  319. package/transfer/index.d.ts +0 -7
  320. package/transfer/index.es.js +0 -7615
  321. package/transfer/index.umd.js +0 -27
  322. package/transfer/package.json +0 -7
  323. package/transfer/style.css +0 -1
  324. package/tree-select/index.d.ts +0 -7
  325. package/tree-select/index.es.js +0 -627
  326. package/tree-select/index.umd.js +0 -1
  327. package/tree-select/package.json +0 -7
  328. package/tree-select/style.css +0 -1
@@ -14,11 +14,13 @@ var __spreadValues = (a, b) => {
14
14
  }
15
15
  return a;
16
16
  };
17
- import { computed, nextTick, defineComponent, ref, reactive, watch, withDirectives, createVNode, withModifiers, resolveComponent, resolveDirective, vShow, Transition } from "vue";
17
+ var __publicField = (obj, key, value) => {
18
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
19
+ return value;
20
+ };
21
+ import { defineComponent, ref, createVNode, h, render, computed, nextTick, unref, watch, onUnmounted, mergeProps, withDirectives, withModifiers, resolveComponent, vShow, resolveDirective } from "vue";
22
+ import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
18
23
  const editableSelectProps = {
19
- appendToBody: {
20
- type: Boolean
21
- },
22
24
  options: {
23
25
  type: Array,
24
26
  default: () => []
@@ -38,7 +40,8 @@ const editableSelectProps = {
38
40
  default: "Search"
39
41
  },
40
42
  modelValue: {
41
- type: String
43
+ type: String,
44
+ default: ""
42
45
  },
43
46
  width: {
44
47
  type: Number
@@ -48,9 +51,6 @@ const editableSelectProps = {
48
51
  },
49
52
  filterOption: {
50
53
  type: [Function, Boolean]
51
- },
52
- loadMore: {
53
- type: Function
54
54
  }
55
55
  };
56
56
  const inBrowser = typeof window !== "undefined";
@@ -108,6 +108,234 @@ const clickoutsideDirective = {
108
108
  delete el[ctx];
109
109
  }
110
110
  };
111
+ class View {
112
+ constructor() {
113
+ __publicField(this, "top", "50%");
114
+ __publicField(this, "left", "50%");
115
+ }
116
+ }
117
+ const loadingProps = {
118
+ message: String,
119
+ backdrop: Boolean,
120
+ view: {
121
+ type: Object,
122
+ default: () => new View()
123
+ },
124
+ zIndex: Number,
125
+ isFull: {
126
+ type: Boolean,
127
+ default: false
128
+ }
129
+ };
130
+ class LoadingOptions {
131
+ constructor() {
132
+ __publicField(this, "target");
133
+ __publicField(this, "message");
134
+ __publicField(this, "loadingTemplateRef");
135
+ __publicField(this, "backdrop", true);
136
+ __publicField(this, "positionType", "relative");
137
+ __publicField(this, "view", new View());
138
+ __publicField(this, "zIndex");
139
+ }
140
+ }
141
+ function createBem(namespace, element, modifier) {
142
+ let cls = namespace;
143
+ if (element) {
144
+ cls += `__${element}`;
145
+ }
146
+ if (modifier) {
147
+ cls += `--${modifier}`;
148
+ }
149
+ return cls;
150
+ }
151
+ function useNamespace(block, needDot = false) {
152
+ const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
153
+ const b = () => createBem(namespace);
154
+ const e = (element) => element ? createBem(namespace, element) : "";
155
+ const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
156
+ const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
157
+ return {
158
+ b,
159
+ e,
160
+ m,
161
+ em
162
+ };
163
+ }
164
+ var loading = "";
165
+ var Loading = defineComponent({
166
+ name: "DLoading",
167
+ inheritAttrs: false,
168
+ props: loadingProps,
169
+ setup(props) {
170
+ const style = {
171
+ top: props.view.top,
172
+ left: props.view.left,
173
+ zIndex: props.zIndex
174
+ };
175
+ if (!props.message) {
176
+ style.background = "none";
177
+ }
178
+ const isShow = ref(false);
179
+ const open = () => {
180
+ isShow.value = true;
181
+ };
182
+ const close = () => {
183
+ isShow.value = false;
184
+ };
185
+ return {
186
+ style,
187
+ isShow,
188
+ open,
189
+ close
190
+ };
191
+ },
192
+ render() {
193
+ var _a;
194
+ const {
195
+ isShow,
196
+ isFull,
197
+ backdrop,
198
+ style,
199
+ message,
200
+ $slots
201
+ } = this;
202
+ const ns = useNamespace("loading");
203
+ return isShow && createVNode("div", {
204
+ "class": [ns.b(), isFull ? ns.m("full") : ""]
205
+ }, [((_a = $slots.default) == null ? void 0 : _a.call($slots)) || createVNode("div", {
206
+ "class": ns.e("wrapper")
207
+ }, [backdrop ? createVNode("div", {
208
+ "class": ns.e("mask")
209
+ }, null) : null, createVNode("div", {
210
+ "style": style,
211
+ "class": ns.e("area")
212
+ }, [createVNode("div", {
213
+ "class": ns.e("busy-default-spinner")
214
+ }, [createVNode("div", {
215
+ "class": ns.e("bar1")
216
+ }, null), createVNode("div", {
217
+ "class": ns.e("bar2")
218
+ }, null), createVNode("div", {
219
+ "class": ns.e("bar3")
220
+ }, null), createVNode("div", {
221
+ "class": ns.e("bar4")
222
+ }, null)]), message ? createVNode("span", {
223
+ "class": ns.e("text")
224
+ }, [message]) : null])])]);
225
+ }
226
+ });
227
+ const COMPONENT_CONTAINER_SYMBOL = Symbol("dev_component_container");
228
+ function createComponent(component, props, children = null) {
229
+ const vnode = h(component, __spreadValues({}, props), children);
230
+ const container = document.createElement("div");
231
+ vnode[COMPONENT_CONTAINER_SYMBOL] = container;
232
+ render(vnode, container);
233
+ return vnode.component;
234
+ }
235
+ function unmountComponent(ComponnetInstance) {
236
+ render(null, ComponnetInstance == null ? void 0 : ComponnetInstance.vnode[COMPONENT_CONTAINER_SYMBOL]);
237
+ }
238
+ const loadingConstructor = defineComponent(Loading);
239
+ const cacheInstance = /* @__PURE__ */ new WeakSet();
240
+ const isEmpty = (val) => {
241
+ if (!val) {
242
+ return true;
243
+ }
244
+ if (Array.isArray(val)) {
245
+ return val.length === 0;
246
+ }
247
+ if (val instanceof Set || val instanceof Map) {
248
+ return val.size === 0;
249
+ }
250
+ if (val instanceof Promise) {
251
+ return false;
252
+ }
253
+ if (typeof val === "object") {
254
+ try {
255
+ return Object.keys(val).length === 0;
256
+ } catch (e) {
257
+ return false;
258
+ }
259
+ }
260
+ return false;
261
+ };
262
+ const getType = (vari) => {
263
+ return Object.prototype.toString.call(vari).slice(8, -1).toLowerCase();
264
+ };
265
+ const isPromise = (value) => {
266
+ const type = getType(value);
267
+ switch (type) {
268
+ case "promise":
269
+ return [value];
270
+ case "array":
271
+ if (value.some((val) => getType(val) !== "promise")) {
272
+ console.error(new TypeError("Binding values should all be of type Promise"));
273
+ return "error";
274
+ }
275
+ return value;
276
+ default:
277
+ return false;
278
+ }
279
+ };
280
+ const unmount = (el) => {
281
+ cacheInstance.delete(el);
282
+ el.instance.proxy.close();
283
+ unmountComponent(el.instance);
284
+ };
285
+ const toggleLoading = (el, binding) => {
286
+ var _a, _b, _c;
287
+ if (binding.value) {
288
+ const vals = isPromise(binding.value);
289
+ if (vals === "error") {
290
+ return;
291
+ }
292
+ (_c = (_b = (_a = el == null ? void 0 : el.instance) == null ? void 0 : _a.proxy) == null ? void 0 : _b.open) == null ? void 0 : _c.call(_b);
293
+ el.appendChild(el.mask);
294
+ cacheInstance.add(el);
295
+ if (vals) {
296
+ Promise.all(vals).catch((err) => {
297
+ console.error(new Error("Promise handling errors"), err);
298
+ }).finally(() => {
299
+ unmount(el);
300
+ });
301
+ }
302
+ } else {
303
+ unmount(el);
304
+ }
305
+ };
306
+ const removeAttribute = (el) => {
307
+ el.removeAttribute("zindex");
308
+ el.removeAttribute("positiontype");
309
+ el.removeAttribute("backdrop");
310
+ el.removeAttribute("message");
311
+ el.removeAttribute("view");
312
+ el.removeAttribute("loadingtemplateref");
313
+ };
314
+ const handleProps = (el, vprops) => {
315
+ var _a;
316
+ const props = __spreadValues(__spreadValues({}, new LoadingOptions()), vprops);
317
+ const loadingTemplateRef = props.loadingTemplateRef;
318
+ const loadingInstance = createComponent(loadingConstructor, __spreadValues({}, props), loadingTemplateRef ? () => loadingTemplateRef : null);
319
+ el.style.position = props.positionType;
320
+ el.options = props;
321
+ el.instance = loadingInstance;
322
+ el.mask = (_a = loadingInstance == null ? void 0 : loadingInstance.proxy) == null ? void 0 : _a.$el;
323
+ };
324
+ const loadingDirective = {
325
+ mounted: function(el, binding, vnode) {
326
+ handleProps(el, vnode.props);
327
+ removeAttribute(el);
328
+ !isEmpty(binding.value) && toggleLoading(el, binding);
329
+ },
330
+ updated: function(el, binding, vnode) {
331
+ if (!isEmpty(binding.value) && cacheInstance.has(el) || isEmpty(binding.value) && !cacheInstance.has(el)) {
332
+ return;
333
+ }
334
+ !cacheInstance.has(el) && handleProps(el, vnode.props);
335
+ removeAttribute(el);
336
+ toggleLoading(el, binding);
337
+ }
338
+ };
111
339
  function className(classStr, classOpt) {
112
340
  let classname = classStr;
113
341
  if (typeof classOpt === "object") {
@@ -139,24 +367,28 @@ const useInput = (inputValue, ctx2) => {
139
367
  const handleInput = (event) => {
140
368
  const value = event.target.value;
141
369
  inputValue.value = value;
370
+ ctx2.emit("update:modelValue", value);
142
371
  onInputChange(value);
143
372
  };
144
373
  return {
145
374
  handleInput
146
375
  };
147
376
  };
148
- const useLazyLoad = (dropdownRef, inputValue, filterOtion, load) => {
377
+ const useLazyLoad = (dropdownRef, inputValue, filterOtion, ctx2) => {
149
378
  const loadMore = () => {
379
+ const dropdownVal = dropdownRef.value;
150
380
  if (filterOtion !== false) {
151
381
  return;
152
382
  }
153
- if (dropdownRef.value.clientHeight + dropdownRef.value.scrollTop >= dropdownRef.value.scrollHeight) {
154
- load(inputValue.value);
383
+ if (dropdownVal.clientHeight + dropdownVal.scrollTop >= dropdownVal.scrollHeight) {
384
+ ctx2.emit("loadMore", inputValue.value);
155
385
  }
156
386
  };
157
387
  return { loadMore };
158
388
  };
159
- const useKeyboardSelect = (dropdownRef, disabled, visible, hoverIndex, selectedIndex, options, toggleMenu, closeMenu, handleClick) => {
389
+ const useKeyboardSelect = (dropdownRef, visible, inputValue, filteredOptions, optionDisabledKey, filterOption, loading2, handleClick, closeMenu, toggleMenu) => {
390
+ const hoverIndex = ref(0);
391
+ const selectedIndex = ref(0);
160
392
  const updateHoveringIndex = (index2) => {
161
393
  hoverIndex.value = index2;
162
394
  };
@@ -175,170 +407,255 @@ const useKeyboardSelect = (dropdownRef, disabled, visible, hoverIndex, selectedI
175
407
  }
176
408
  });
177
409
  };
178
- const onKeyboardNavigation = (direction, newIndex) => {
179
- if (!newIndex) {
180
- newIndex = hoverIndex.value;
410
+ const handleEscape = () => {
411
+ if (inputValue.value) {
412
+ inputValue.value = "";
413
+ } else {
414
+ closeMenu();
415
+ }
416
+ };
417
+ const handleEnter = () => {
418
+ const len = filteredOptions.value.length;
419
+ if (!visible.value || !len) {
420
+ return toggleMenu();
421
+ }
422
+ len && len === 1 ? handleClick(filteredOptions.value[0]) : handleClick(filteredOptions.value[hoverIndex.value]);
423
+ return closeMenu();
424
+ };
425
+ const handleKeyboardNavigation = (direction) => {
426
+ const len = filteredOptions.value.length;
427
+ if (!len || len === 1) {
428
+ return;
181
429
  }
182
430
  if (!["ArrowDown", "ArrowUp"].includes(direction)) {
183
431
  return;
184
432
  }
433
+ if (filterOption === false && loading2.value) {
434
+ return;
435
+ }
436
+ let newIndex = 0;
437
+ newIndex = hoverIndex.value;
185
438
  if (direction === "ArrowUp") {
186
- if (newIndex === 0) {
187
- newIndex = options.value.length - 1;
188
- scrollToItem(newIndex);
189
- updateHoveringIndex(newIndex);
190
- return;
439
+ newIndex -= 1;
440
+ if (newIndex === -1) {
441
+ newIndex = len - 1;
191
442
  }
192
- newIndex = newIndex - 1;
193
443
  } else if (direction === "ArrowDown") {
194
- if (newIndex === options.value.length - 1) {
444
+ newIndex += 1;
445
+ if (newIndex === len) {
195
446
  newIndex = 0;
196
- scrollToItem(newIndex);
197
- updateHoveringIndex(newIndex);
198
- return;
199
447
  }
200
- newIndex = newIndex + 1;
201
448
  }
202
- const option = options.value[newIndex];
203
- if (option[disabled]) {
204
- return onKeyboardNavigation(direction, newIndex);
449
+ hoverIndex.value = newIndex;
450
+ const option = filteredOptions.value[newIndex];
451
+ if (option[optionDisabledKey]) {
452
+ return handleKeyboardNavigation(direction);
205
453
  }
206
- scrollToItem(newIndex);
207
454
  updateHoveringIndex(newIndex);
455
+ scrollToItem(newIndex);
208
456
  };
209
457
  const handleKeydown = (event) => {
210
458
  const keyCode = event.key || event.code;
211
- if (options.value.length === 0) {
212
- return;
213
- }
214
- if (!visible.value) {
215
- return toggleMenu();
216
- }
217
- const onKeydownEnter = () => {
218
- handleClick(options.value[hoverIndex.value]);
219
- closeMenu();
220
- };
221
- const onKeydownEsc = () => {
222
- closeMenu();
223
- };
224
459
  switch (keyCode) {
225
- case "Enter":
226
- onKeydownEnter();
227
- break;
228
460
  case "Escape":
229
- onKeydownEsc();
461
+ handleEscape();
462
+ break;
463
+ case "Enter":
464
+ handleEnter();
230
465
  break;
231
466
  default:
232
- onKeyboardNavigation(keyCode);
467
+ handleKeyboardNavigation(keyCode);
233
468
  }
234
469
  };
235
- return {
236
- handleKeydown
237
- };
470
+ return { handleKeydown, hoverIndex, selectedIndex };
471
+ };
472
+ const flexibleOverlayProps = {
473
+ modelValue: {
474
+ type: Boolean,
475
+ default: false
476
+ },
477
+ origin: {
478
+ type: Object,
479
+ require: true
480
+ },
481
+ position: {
482
+ type: Array,
483
+ default: ["bottom"]
484
+ },
485
+ offset: {
486
+ type: [Number, Object],
487
+ default: 8
488
+ },
489
+ shiftOffset: {
490
+ type: Number
491
+ },
492
+ align: {
493
+ type: String,
494
+ default: null
495
+ },
496
+ showArrow: {
497
+ type: Boolean,
498
+ default: false
499
+ },
500
+ isArrowCenter: {
501
+ type: Boolean,
502
+ default: true
503
+ }
238
504
  };
505
+ function getScrollParent(element) {
506
+ const overflowRegex = /(auto|scroll|hidden)/;
507
+ for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
508
+ const style = window.getComputedStyle(parent);
509
+ if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
510
+ return parent;
511
+ }
512
+ }
513
+ return window;
514
+ }
515
+ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
516
+ let { x, y } = point;
517
+ if (!isArrowCenter) {
518
+ const { width, height } = originRect;
519
+ if (x && placement.includes("start")) {
520
+ x = 12;
521
+ }
522
+ if (x && placement.includes("end")) {
523
+ x = Math.round(width - 24);
524
+ }
525
+ if (y && placement.includes("start")) {
526
+ y = 10;
527
+ }
528
+ if (y && placement.includes("end")) {
529
+ y = height - 14;
530
+ }
531
+ }
532
+ return { x, y };
533
+ }
534
+ function useOverlay(props, emit) {
535
+ const overlayRef = ref();
536
+ const arrowRef = ref();
537
+ let originParent = null;
538
+ const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
539
+ const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
540
+ const staticSide = {
541
+ top: "bottom",
542
+ right: "left",
543
+ bottom: "top",
544
+ left: "right"
545
+ }[placement.split("-")[0]];
546
+ Object.assign(arrowEl.style, {
547
+ left: x ? `${x}px` : "",
548
+ top: y ? `${y}px` : "",
549
+ right: "",
550
+ bottom: "",
551
+ [staticSide]: "-4px"
552
+ });
553
+ };
554
+ const updatePosition = async () => {
555
+ const hostEl = props.origin;
556
+ const overlayEl = unref(overlayRef.value);
557
+ const arrowEl = unref(arrowRef.value);
558
+ const middleware = [
559
+ offset(props.offset),
560
+ autoPlacement({
561
+ alignment: props.align,
562
+ allowedPlacements: props.position
563
+ })
564
+ ];
565
+ props.showArrow && middleware.push(arrow({ element: arrowEl }));
566
+ props.shiftOffset !== void 0 && middleware.push(shift());
567
+ const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
568
+ strategy: "fixed",
569
+ middleware
570
+ });
571
+ let applyX = x;
572
+ let applyY = y;
573
+ if (props.shiftOffset !== void 0) {
574
+ const { x: shiftX, y: shiftY } = middlewareData.shift;
575
+ shiftX < 0 && (applyX -= props.shiftOffset);
576
+ shiftX > 0 && (applyX += props.shiftOffset);
577
+ shiftY < 0 && (applyY -= props.shiftOffset);
578
+ shiftY > 0 && (applyY += props.shiftOffset);
579
+ }
580
+ emit("positionChange", placement);
581
+ Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
582
+ props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
583
+ };
584
+ watch(() => props.modelValue, () => {
585
+ if (props.modelValue && props.origin) {
586
+ originParent = getScrollParent(props.origin);
587
+ nextTick(updatePosition);
588
+ originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
589
+ originParent !== window && window.addEventListener("scroll", updatePosition);
590
+ window.addEventListener("resize", updatePosition);
591
+ } else {
592
+ originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
593
+ originParent !== window && window.removeEventListener("scroll", updatePosition);
594
+ window.removeEventListener("resize", updatePosition);
595
+ }
596
+ });
597
+ onUnmounted(() => {
598
+ originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
599
+ originParent !== window && window.removeEventListener("scroll", updatePosition);
600
+ window.removeEventListener("resize", updatePosition);
601
+ });
602
+ return { arrowRef, overlayRef, updatePosition };
603
+ }
604
+ var flexibleOverlay = "";
605
+ const FlexibleOverlay = defineComponent({
606
+ name: "DFlexibleOverlay",
607
+ inheritAttrs: false,
608
+ props: flexibleOverlayProps,
609
+ emits: ["update:modelValue", "positionChange"],
610
+ setup(props, {
611
+ slots,
612
+ attrs,
613
+ emit,
614
+ expose
615
+ }) {
616
+ const ns = useNamespace("flexible-overlay");
617
+ const {
618
+ arrowRef,
619
+ overlayRef,
620
+ updatePosition
621
+ } = useOverlay(props, emit);
622
+ expose({
623
+ updatePosition
624
+ });
625
+ return () => {
626
+ var _a;
627
+ return props.modelValue && createVNode("div", mergeProps({
628
+ "ref": overlayRef,
629
+ "class": ns.b()
630
+ }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
631
+ "ref": arrowRef,
632
+ "class": ns.e("arrow")
633
+ }, null)]);
634
+ };
635
+ }
636
+ });
239
637
  var EditableSelect = defineComponent({
240
638
  name: "DEditableSelect",
241
639
  directives: {
242
- clickOutside: clickoutsideDirective
640
+ clickOutside: clickoutsideDirective,
641
+ dLoading: loadingDirective
243
642
  },
244
643
  props: editableSelectProps,
245
644
  emits: ["update:modelValue", "search", "loadMore"],
246
645
  setup(props, ctx2) {
247
- const getItemCls = (option, index2) => {
248
- const {
249
- optionDisabledKey: disabledKey
250
- } = props;
251
- return className("devui-dropdown-item", {
252
- disabled: disabledKey ? !!option[disabledKey] : false,
253
- selected: index2 === selectIndex.value,
254
- "devui-dropdown-bg": index2 === hoverIndex.value
255
- });
256
- };
257
- const renderDropdown = () => {
258
- if (props.appendToBody) {
259
- return createVNode(resolveComponent("d-flexible-overlay"), {
260
- "origin": origin,
261
- "visible": visible.value,
262
- "onUpdate:visible": ($event) => visible.value = $event,
263
- "position": position,
264
- "hasBackdrop": false
265
- }, {
266
- default: () => [createVNode("div", {
267
- "class": "devui-editable-select-dropdown",
268
- "style": {
269
- width: props.width + "px"
270
- }
271
- }, [withDirectives(createVNode("div", {
272
- "class": "devui-dropdown-menu"
273
- }, [createVNode("ul", {
274
- "ref": dopdownRef,
275
- "class": "devui-list-unstyled scroll-height",
276
- "style": {
277
- maxHeight: props.maxHeight + "px"
278
- },
279
- "onScroll": loadMore
280
- }, [filteredOptions.value.map((option, index2) => {
281
- return createVNode("li", {
282
- "class": getItemCls(option, index2),
283
- "onClick": (e) => {
284
- e.stopPropagation();
285
- handleClick(option);
286
- }
287
- }, [ctx2.slots.itemTemplate ? ctx2.slots.itemTemplate(option) : option.label]);
288
- }), withDirectives(createVNode("li", {
289
- "class": "devui-no-result-template"
290
- }, [createVNode("div", {
291
- "class": "devui-no-data-tip"
292
- }, [emptyText.value])]), [[vShow, !filteredOptions.value.length]])])]), [[resolveDirective("dLoading"), props.loading], [vShow, visible.value]])])]
293
- });
294
- } else {
295
- return createVNode(Transition, {
296
- "name": "fade"
297
- }, {
298
- default: () => [withDirectives(createVNode("div", {
299
- "class": "devui-dropdown-menu"
300
- }, [createVNode("ul", {
301
- "ref": dopdownRef,
302
- "class": "devui-list-unstyled scroll-height",
303
- "style": {
304
- maxHeight: props.maxHeight + "px"
305
- },
306
- "onScroll": loadMore
307
- }, [filteredOptions.value.map((option, index2) => {
308
- return createVNode("li", {
309
- "class": getItemCls(option, index2),
310
- "onClick": (e) => {
311
- e.stopPropagation();
312
- handleClick(option);
313
- }
314
- }, [ctx2.slots.itemTemplate ? ctx2.slots.itemTemplate(option) : option.label]);
315
- }), withDirectives(createVNode("li", {
316
- "class": "devui-no-result-template"
317
- }, [createVNode("div", {
318
- "class": "devui-no-data-tip"
319
- }, [emptyText.value])]), [[vShow, !filteredOptions.value.length]])])]), [[vShow, visible.value]])]
320
- });
321
- }
322
- };
323
- const dopdownRef = ref();
646
+ const dropdownRef = ref();
324
647
  const origin = ref();
325
- const position = reactive({
326
- originX: "left",
327
- originY: "bottom",
328
- overlayX: "left",
329
- overlayY: "top"
330
- });
648
+ const position = ref(["bottom"]);
331
649
  const visible = ref(false);
332
650
  const inputValue = ref(props.modelValue);
333
- const hoverIndex = ref(0);
334
- const selectIndex = ref(0);
651
+ const loading2 = ref(props.loading);
335
652
  const normalizeOptions = computed(() => {
336
653
  return props.options.map((option) => {
337
654
  if (typeof option === "object") {
338
- return __spreadValues({
655
+ return Object.assign({}, option, {
339
656
  label: option.label ? option.label : option.value,
340
657
  value: option.value
341
- }, option);
658
+ });
342
659
  }
343
660
  return {
344
661
  label: option + "",
@@ -348,13 +665,16 @@ var EditableSelect = defineComponent({
348
665
  });
349
666
  const filteredOptions = userFilterOptions(normalizeOptions, inputValue, props.filterOption);
350
667
  const emptyText = computed(() => {
351
- let text;
668
+ let text = "";
352
669
  if (props.filterOption !== false && !filteredOptions.value.length) {
353
670
  text = "\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55";
354
671
  } else if (props.filterOption === false && !filteredOptions.value.length) {
355
672
  text = "\u6CA1\u6709\u6570\u636E";
356
673
  }
357
- return ctx2.slots.noResultItemTemplate ? ctx2.slots.noResultItemTemplate() : text;
674
+ return text;
675
+ });
676
+ watch(() => props.loading, (newVal) => {
677
+ loading2.value = newVal;
358
678
  });
359
679
  const toggleMenu = () => {
360
680
  visible.value = !visible.value;
@@ -364,7 +684,7 @@ var EditableSelect = defineComponent({
364
684
  };
365
685
  const {
366
686
  loadMore
367
- } = useLazyLoad(dopdownRef, inputValue, props.filterOption, props.loadMore);
687
+ } = useLazyLoad(dropdownRef, inputValue, props.filterOption, ctx2);
368
688
  const {
369
689
  handleInput
370
690
  } = useInput(inputValue, ctx2);
@@ -372,21 +692,39 @@ var EditableSelect = defineComponent({
372
692
  const {
373
693
  optionDisabledKey: disabledKey
374
694
  } = props;
375
- if (disabledKey && !!option[disabledKey])
695
+ if (disabledKey && !!option[disabledKey]) {
376
696
  return;
697
+ }
377
698
  ctx2.emit("update:modelValue", option.label);
378
699
  closeMenu();
379
700
  };
380
701
  const {
381
- handleKeydown
382
- } = useKeyboardSelect(dopdownRef, props.optionDisabledKey, visible, hoverIndex, selectIndex, filteredOptions, toggleMenu, closeMenu, handleClick);
702
+ handleKeydown,
703
+ hoverIndex,
704
+ selectedIndex
705
+ } = useKeyboardSelect(dropdownRef, visible, inputValue, filteredOptions, props.optionDisabledKey, props.filterOption, loading2, handleClick, closeMenu, toggleMenu);
383
706
  watch(() => props.modelValue, (newVal) => {
384
- inputValue.value = newVal;
707
+ if (newVal) {
708
+ inputValue.value = newVal;
709
+ }
385
710
  });
711
+ const getItemCls = (option, index2) => {
712
+ const {
713
+ optionDisabledKey: disabledKey
714
+ } = props;
715
+ return className("devui-dropdown-item", {
716
+ disabled: disabledKey ? !!option[disabledKey] : false,
717
+ selected: index2 === selectedIndex.value,
718
+ "devui-dropdown-bg": index2 === hoverIndex.value
719
+ });
720
+ };
386
721
  return () => {
387
722
  const selectCls = className("devui-editable-select devui-form-group devui-has-feedback", {
388
723
  "devui-select-open": visible.value === true
389
724
  });
725
+ const inputCls = className("devui-form-control devui-dropdown-origin", {
726
+ "devui-dropdown-origin-open": visible.value === true
727
+ });
390
728
  return withDirectives(createVNode("div", {
391
729
  "class": selectCls,
392
730
  "ref": origin,
@@ -394,7 +732,7 @@ var EditableSelect = defineComponent({
394
732
  width: props.width + "px"
395
733
  }
396
734
  }, [createVNode("input", {
397
- "class": "devui-form-control devui-dropdown-origin devui-dropdown-origin-open",
735
+ "class": inputCls,
398
736
  "onClick": withModifiers(toggleMenu, ["self"]),
399
737
  "onInput": handleInput,
400
738
  "onKeydown": handleKeydown,
@@ -408,19 +746,49 @@ var EditableSelect = defineComponent({
408
746
  "class": "devui-select-chevron-icon"
409
747
  }, [createVNode(resolveComponent("d-icon"), {
410
748
  "name": "select-arrow"
411
- }, null)])]), renderDropdown()]), [[resolveDirective("click-outside"), closeMenu]]);
749
+ }, null)])]), createVNode(FlexibleOverlay, {
750
+ "origin": origin.value,
751
+ "modelValue": visible.value,
752
+ "onUpdate:modelValue": ($event) => visible.value = $event,
753
+ "position": position.value,
754
+ "hasBackdrop": false
755
+ }, {
756
+ default: () => [createVNode("div", {
757
+ "style": {
758
+ width: props.width + "px"
759
+ }
760
+ }, [withDirectives(createVNode("div", {
761
+ "class": "devui-dropdown-menu "
762
+ }, [createVNode("ul", {
763
+ "ref": dropdownRef,
764
+ "class": "devui-list-unstyled scroll-height",
765
+ "style": {
766
+ maxHeight: props.maxHeight + "px"
767
+ },
768
+ "onScroll": loadMore
769
+ }, [filteredOptions.value.map((option, index2) => {
770
+ return createVNode("li", {
771
+ "class": getItemCls(option, index2),
772
+ "onClick": (e) => {
773
+ e.stopPropagation();
774
+ handleClick(option);
775
+ }
776
+ }, [ctx2.slots.item ? ctx2.slots.item(option) : option.label]);
777
+ }), withDirectives(createVNode("li", {
778
+ "class": "devui-no-result-template"
779
+ }, [createVNode("div", {
780
+ "class": "devui-no-data-tip"
781
+ }, [ctx2.slots.noResultItem ? ctx2.slots.noResultItem() : emptyText.value])]), [[vShow, !filteredOptions.value.length]])])]), [[resolveDirective("dLoading"), props.loading], [vShow, visible.value]])])]
782
+ })]), [[resolveDirective("click-outside"), closeMenu]]);
412
783
  };
413
784
  }
414
785
  });
415
- EditableSelect.install = function(app) {
416
- app.component(EditableSelect.name, EditableSelect);
417
- };
418
786
  var index = {
419
787
  title: "EditableSelect \u53EF\u8F93\u5165\u4E0B\u62C9\u9009\u62E9\u6846",
420
788
  category: "\u6570\u636E\u5F55\u5165",
421
789
  status: "100%",
422
790
  install(app) {
423
- app.use(EditableSelect);
791
+ app.component(EditableSelect.name, EditableSelect);
424
792
  }
425
793
  };
426
- export { EditableSelect, index as default };
794
+ export { EditableSelect, index as default, editableSelectProps };