vue-devui 1.0.0-alpha.6 → 1.0.0-beta.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 (344) hide show
  1. package/README.md +32 -35
  2. package/accordion/index.d.ts +7 -0
  3. package/accordion/index.es.js +508 -1
  4. package/accordion/index.umd.js +1 -1
  5. package/accordion/style.css +1 -1
  6. package/alert/index.d.ts +7 -0
  7. package/alert/index.es.js +178 -1
  8. package/alert/index.umd.js +1 -1
  9. package/alert/style.css +1 -1
  10. package/anchor/index.d.ts +7 -0
  11. package/anchor/index.es.js +263 -1
  12. package/anchor/index.umd.js +1 -1
  13. package/avatar/index.d.ts +7 -0
  14. package/avatar/index.es.js +301 -1
  15. package/avatar/index.umd.js +1 -1
  16. package/back-top/index.d.ts +7 -0
  17. package/back-top/index.es.js +128 -0
  18. package/back-top/index.umd.js +1 -0
  19. package/back-top/package.json +7 -0
  20. package/back-top/style.css +1 -0
  21. package/badge/index.d.ts +7 -0
  22. package/badge/index.es.js +95 -1
  23. package/badge/index.umd.js +1 -1
  24. package/breadcrumb/index.d.ts +7 -0
  25. package/breadcrumb/index.es.js +127 -1
  26. package/breadcrumb/index.umd.js +1 -1
  27. package/button/index.d.ts +7 -0
  28. package/button/index.es.js +392 -1
  29. package/button/index.umd.js +1 -1
  30. package/button/style.css +1 -1
  31. package/card/index.d.ts +7 -0
  32. package/card/index.es.js +61 -1
  33. package/card/index.umd.js +1 -1
  34. package/carousel/index.d.ts +7 -0
  35. package/carousel/index.es.js +329 -1
  36. package/carousel/index.umd.js +1 -1
  37. package/cascader/index.d.ts +7 -0
  38. package/cascader/index.es.js +1343 -1
  39. package/cascader/index.umd.js +1 -1
  40. package/cascader/style.css +1 -1
  41. package/checkbox/index.d.ts +7 -0
  42. package/checkbox/index.es.js +377 -1
  43. package/checkbox/index.umd.js +1 -1
  44. package/comment/index.d.ts +7 -0
  45. package/comment/index.es.js +85 -0
  46. package/comment/index.umd.js +1 -0
  47. package/comment/package.json +7 -0
  48. package/comment/style.css +1 -0
  49. package/countdown/index.d.ts +7 -0
  50. package/countdown/index.es.js +176 -0
  51. package/countdown/index.umd.js +1 -0
  52. package/countdown/package.json +7 -0
  53. package/countdown/style.css +1 -0
  54. package/date-picker/index.d.ts +7 -0
  55. package/date-picker/index.es.js +1172 -1
  56. package/date-picker/index.umd.js +1 -1
  57. package/date-picker/style.css +1 -1
  58. package/dragdrop/index.d.ts +7 -0
  59. package/dragdrop/index.es.js +32 -0
  60. package/dragdrop/index.umd.js +1 -0
  61. package/dragdrop/package.json +7 -0
  62. package/drawer/index.d.ts +7 -0
  63. package/drawer/index.es.js +287 -0
  64. package/drawer/index.umd.js +1 -0
  65. package/drawer/package.json +7 -0
  66. package/drawer/style.css +1 -0
  67. package/dropdown/index.d.ts +7 -0
  68. package/dropdown/index.es.js +535 -0
  69. package/dropdown/index.umd.js +1 -0
  70. package/dropdown/package.json +7 -0
  71. package/dropdown/style.css +1 -0
  72. package/editable-select/index.d.ts +7 -0
  73. package/editable-select/index.es.js +5857 -1
  74. package/editable-select/index.umd.js +27 -1
  75. package/editable-select/style.css +1 -1
  76. package/form/index.d.ts +7 -0
  77. package/form/index.es.js +2244 -0
  78. package/form/index.umd.js +1 -0
  79. package/form/package.json +7 -0
  80. package/form/style.css +1 -0
  81. package/fullscreen/index.d.ts +7 -0
  82. package/fullscreen/index.es.js +163 -1
  83. package/fullscreen/index.umd.js +1 -1
  84. package/gantt/index.d.ts +7 -0
  85. package/gantt/index.es.js +535 -0
  86. package/gantt/index.umd.js +1 -0
  87. package/gantt/package.json +7 -0
  88. package/gantt/style.css +1 -0
  89. package/grid/index.d.ts +7 -0
  90. package/grid/index.es.js +269 -0
  91. package/grid/index.umd.js +1 -0
  92. package/grid/package.json +7 -0
  93. package/grid/style.css +1 -0
  94. package/icon/index.d.ts +7 -0
  95. package/icon/index.es.js +75 -1
  96. package/icon/index.umd.js +1 -1
  97. package/image-preview/index.d.ts +7 -0
  98. package/image-preview/index.es.js +498 -1
  99. package/image-preview/index.umd.js +1 -1
  100. package/image-preview/style.css +1 -1
  101. package/index.d.ts +7 -0
  102. package/input/index.d.ts +7 -0
  103. package/input/index.es.js +190 -1
  104. package/input/index.umd.js +1 -1
  105. package/input-icon/index.d.ts +7 -0
  106. package/input-icon/index.es.js +332 -0
  107. package/input-icon/index.umd.js +1 -0
  108. package/input-icon/package.json +7 -0
  109. package/input-icon/style.css +1 -0
  110. package/input-number/index.d.ts +7 -0
  111. package/input-number/index.es.js +240 -1
  112. package/input-number/index.umd.js +1 -1
  113. package/layout/index.d.ts +7 -0
  114. package/layout/index.es.js +100 -0
  115. package/layout/index.umd.js +1 -0
  116. package/layout/package.json +7 -0
  117. package/layout/style.css +1 -0
  118. package/loading/index.d.ts +7 -0
  119. package/loading/index.es.js +256 -1
  120. package/loading/index.umd.js +1 -1
  121. package/modal/index.d.ts +7 -0
  122. package/modal/index.es.js +1225 -1
  123. package/modal/index.umd.js +1 -1
  124. package/modal/style.css +1 -1
  125. package/nav-sprite/index.d.ts +7 -0
  126. package/nav-sprite/index.es.js +742 -0
  127. package/nav-sprite/index.umd.js +1 -0
  128. package/nav-sprite/package.json +7 -0
  129. package/nuxt/components/Accordion.js +3 -0
  130. package/nuxt/components/Alert.js +3 -0
  131. package/nuxt/components/Anchor.js +3 -0
  132. package/nuxt/components/Aside.js +3 -0
  133. package/nuxt/components/Avatar.js +3 -0
  134. package/nuxt/components/BackTop.js +3 -0
  135. package/nuxt/components/Badge.js +3 -0
  136. package/nuxt/components/Breadcrumb.js +3 -0
  137. package/nuxt/components/Button.js +3 -0
  138. package/nuxt/components/Card.js +3 -0
  139. package/nuxt/components/Carousel.js +3 -0
  140. package/nuxt/components/Cascader.js +3 -0
  141. package/nuxt/components/Checkbox.js +3 -0
  142. package/nuxt/components/Col.js +3 -0
  143. package/nuxt/components/Column.js +3 -0
  144. package/nuxt/components/Comment.js +3 -0
  145. package/nuxt/components/Content.js +3 -0
  146. package/nuxt/components/Countdown.js +3 -0
  147. package/nuxt/components/DatePicker.js +3 -0
  148. package/nuxt/components/Drawer.js +3 -0
  149. package/nuxt/components/Dropdown.js +3 -0
  150. package/nuxt/components/EditableSelect.js +3 -0
  151. package/nuxt/components/FixedOverlay.js +3 -0
  152. package/nuxt/components/FlexibleOverlay.js +3 -0
  153. package/nuxt/components/Footer.js +3 -0
  154. package/nuxt/components/Form.js +3 -0
  155. package/nuxt/components/FormControl.js +3 -0
  156. package/nuxt/components/FormItem.js +3 -0
  157. package/nuxt/components/FormLabel.js +3 -0
  158. package/nuxt/components/FormOperation.js +3 -0
  159. package/nuxt/components/Fullscreen.js +3 -0
  160. package/nuxt/components/Gantt.js +3 -0
  161. package/nuxt/components/Header.js +3 -0
  162. package/nuxt/components/Icon.js +2 -0
  163. package/nuxt/components/ImagePreviewService.js +3 -0
  164. package/nuxt/components/Input.js +3 -0
  165. package/nuxt/components/InputIcon.js +3 -0
  166. package/nuxt/components/InputNumber.js +3 -0
  167. package/nuxt/components/Layout.js +3 -0
  168. package/nuxt/components/Loading.js +3 -0
  169. package/nuxt/components/LoadingService.js +3 -0
  170. package/nuxt/components/Modal.js +3 -0
  171. package/nuxt/components/NavSprite.js +2 -0
  172. package/nuxt/components/Pagination.js +3 -0
  173. package/nuxt/components/Panel.js +3 -0
  174. package/nuxt/components/Popover.js +3 -0
  175. package/nuxt/components/Progress.js +3 -0
  176. package/nuxt/components/QuadrantDiagram.js +3 -0
  177. package/nuxt/components/Radio.js +3 -0
  178. package/nuxt/components/RadioGroup.js +3 -0
  179. package/nuxt/components/Rate.js +3 -0
  180. package/nuxt/components/ReadTip.js +3 -0
  181. package/nuxt/components/Result.js +3 -0
  182. package/nuxt/components/Row.js +3 -0
  183. package/nuxt/components/Search.js +3 -0
  184. package/nuxt/components/Select.js +3 -0
  185. package/nuxt/components/Skeleton.js +3 -0
  186. package/nuxt/components/SkeletonItem.js +3 -0
  187. package/nuxt/components/Slider.js +3 -0
  188. package/nuxt/components/Splitter.js +3 -0
  189. package/nuxt/components/Statistic.js +3 -0
  190. package/nuxt/components/Status.js +3 -0
  191. package/nuxt/components/StepsGuide.js +3 -0
  192. package/nuxt/components/StickSlider.js +3 -0
  193. package/nuxt/components/Sticky.js +2 -0
  194. package/nuxt/components/Switch.js +3 -0
  195. package/nuxt/components/Table.js +3 -0
  196. package/nuxt/components/Tabs.js +3 -0
  197. package/nuxt/components/Tag.js +3 -0
  198. package/nuxt/components/TagInput.js +3 -0
  199. package/nuxt/components/Textarea.js +3 -0
  200. package/nuxt/components/TimeAxis.js +3 -0
  201. package/nuxt/components/TimeAxisItem.js +3 -0
  202. package/nuxt/components/TimePicker.js +3 -0
  203. package/nuxt/components/Toast.js +3 -0
  204. package/nuxt/components/ToastService.js +3 -0
  205. package/nuxt/components/Tooltip.js +3 -0
  206. package/nuxt/components/Transfer.js +3 -0
  207. package/nuxt/components/Tree.js +3 -0
  208. package/nuxt/components/TreeSelect.js +3 -0
  209. package/nuxt/components/Upload.js +3 -0
  210. package/nuxt/components/buttonProps.js +3 -0
  211. package/nuxt/index.js +13 -0
  212. package/overlay/index.d.ts +7 -0
  213. package/overlay/index.es.js +368 -1
  214. package/overlay/index.umd.js +1 -1
  215. package/overlay/style.css +1 -1
  216. package/package.json +6 -47
  217. package/pagination/index.d.ts +7 -0
  218. package/pagination/index.es.js +642 -1
  219. package/pagination/index.umd.js +1 -1
  220. package/panel/index.d.ts +7 -0
  221. package/panel/index.es.js +205 -1
  222. package/panel/index.umd.js +1 -1
  223. package/panel/style.css +1 -1
  224. package/popover/index.d.ts +7 -0
  225. package/popover/index.es.js +236 -1
  226. package/popover/index.umd.js +1 -1
  227. package/progress/index.d.ts +7 -0
  228. package/progress/index.es.js +153 -1
  229. package/progress/index.umd.js +3 -1
  230. package/quadrant-diagram/index.d.ts +7 -0
  231. package/quadrant-diagram/index.es.js +489 -1
  232. package/quadrant-diagram/index.umd.js +1 -1
  233. package/radio/index.d.ts +7 -0
  234. package/radio/index.es.js +225 -1
  235. package/radio/index.umd.js +1 -1
  236. package/rate/index.d.ts +7 -0
  237. package/rate/index.es.js +220 -1
  238. package/rate/index.umd.js +1 -1
  239. package/read-tip/index.d.ts +7 -0
  240. package/read-tip/index.es.js +258 -0
  241. package/read-tip/index.umd.js +1 -0
  242. package/read-tip/package.json +7 -0
  243. package/read-tip/style.css +1 -0
  244. package/result/index.d.ts +7 -0
  245. package/result/index.es.js +119 -0
  246. package/result/index.umd.js +1 -0
  247. package/result/package.json +7 -0
  248. package/result/style.css +1 -0
  249. package/ripple/index.d.ts +7 -0
  250. package/ripple/index.es.js +181 -1
  251. package/ripple/index.umd.js +1 -1
  252. package/search/index.d.ts +7 -0
  253. package/search/index.es.js +543 -1
  254. package/search/index.umd.js +1 -1
  255. package/select/index.d.ts +7 -0
  256. package/select/index.es.js +706 -1
  257. package/select/index.umd.js +1 -1
  258. package/skeleton/index.d.ts +7 -0
  259. package/skeleton/index.es.js +297 -1
  260. package/skeleton/index.umd.js +1 -1
  261. package/skeleton/style.css +1 -1
  262. package/slider/index.d.ts +7 -0
  263. package/slider/index.es.js +199 -1
  264. package/slider/index.umd.js +1 -1
  265. package/slider/style.css +1 -1
  266. package/splitter/index.d.ts +7 -0
  267. package/splitter/index.es.js +636 -1
  268. package/splitter/index.umd.js +1 -1
  269. package/statistic/index.d.ts +7 -0
  270. package/statistic/index.es.js +280 -0
  271. package/statistic/index.umd.js +1 -0
  272. package/statistic/package.json +7 -0
  273. package/statistic/style.css +1 -0
  274. package/status/index.d.ts +7 -0
  275. package/status/index.es.js +42 -1
  276. package/status/index.umd.js +1 -1
  277. package/steps-guide/index.d.ts +7 -0
  278. package/steps-guide/index.es.js +239 -1
  279. package/steps-guide/index.umd.js +1 -1
  280. package/steps-guide/style.css +1 -1
  281. package/sticky/index.d.ts +7 -0
  282. package/sticky/index.es.js +197 -1
  283. package/sticky/index.umd.js +1 -1
  284. package/style.css +1 -1
  285. package/switch/index.d.ts +7 -0
  286. package/switch/index.es.js +100 -1
  287. package/switch/index.umd.js +1 -1
  288. package/switch/style.css +1 -1
  289. package/table/index.d.ts +7 -0
  290. package/table/index.es.js +1836 -1
  291. package/table/index.umd.js +1 -1
  292. package/table/style.css +1 -1
  293. package/tabs/index.d.ts +7 -0
  294. package/tabs/index.es.js +195 -1
  295. package/tabs/index.umd.js +1 -1
  296. package/tabs/style.css +1 -1
  297. package/tag/index.d.ts +7 -0
  298. package/tag/index.es.js +131 -0
  299. package/tag/index.umd.js +1 -0
  300. package/tag/package.json +7 -0
  301. package/tag/style.css +1 -0
  302. package/tag-input/index.d.ts +7 -0
  303. package/tag-input/index.es.js +329 -1
  304. package/tag-input/index.umd.js +1 -1
  305. package/textarea/index.d.ts +7 -0
  306. package/textarea/index.es.js +132 -0
  307. package/textarea/index.umd.js +1 -0
  308. package/textarea/package.json +7 -0
  309. package/textarea/style.css +1 -0
  310. package/time-axis/index.d.ts +7 -0
  311. package/time-axis/index.es.js +299 -0
  312. package/time-axis/index.umd.js +1 -0
  313. package/time-axis/package.json +7 -0
  314. package/time-axis/style.css +1 -0
  315. package/time-picker/index.d.ts +7 -0
  316. package/time-picker/index.es.js +1260 -1
  317. package/time-picker/index.umd.js +1 -1
  318. package/time-picker/style.css +1 -1
  319. package/toast/index.d.ts +7 -0
  320. package/toast/index.es.js +2060 -1
  321. package/toast/index.umd.js +1 -1
  322. package/toast/style.css +1 -1
  323. package/tooltip/index.d.ts +7 -0
  324. package/tooltip/index.es.js +171 -1
  325. package/tooltip/index.umd.js +1 -1
  326. package/transfer/index.d.ts +7 -0
  327. package/transfer/index.es.js +1725 -1
  328. package/transfer/index.umd.js +1 -1
  329. package/transfer/style.css +1 -1
  330. package/tree/index.d.ts +7 -0
  331. package/tree/index.es.js +907 -1
  332. package/tree/index.umd.js +1 -1
  333. package/tree/style.css +1 -1
  334. package/tree-select/index.d.ts +7 -0
  335. package/tree-select/index.es.js +528 -0
  336. package/tree-select/index.umd.js +1 -0
  337. package/tree-select/package.json +7 -0
  338. package/tree-select/style.css +1 -0
  339. package/upload/index.d.ts +7 -0
  340. package/upload/index.es.js +2834 -1
  341. package/upload/index.umd.js +1 -1
  342. package/upload/style.css +1 -1
  343. package/vue-devui.es.js +27777 -1
  344. package/vue-devui.umd.js +29 -1
@@ -1 +1,706 @@
1
- var e=Object.defineProperty,l=Object.defineProperties,t=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,i=(l,t,o)=>t in l?e(l,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):l[t]=o,d=(e,l)=>{for(var t in l||(l={}))n.call(l,t)&&i(e,t,l[t]);if(o)for(var t of o(l))a.call(l,t)&&i(e,t,l[t]);return e},u=(e,o)=>l(e,t(o));"undefined"!=typeof require&&require;import{defineComponent as r,createVNode as c,inject as s,computed as p,mergeProps as m,toRef as v,provide as h,onMounted as f,onBeforeUnmount as g,ref as b,Transition as y,withDirectives as k,vShow as w}from"vue";const C={modelValue:{type:[String,Number,Array],default:""},"onUpdate:modelValue":{type:Function,default:void 0},options:{type:Array,default:()=>[]},size:{type:String,default:"md"},overview:{type:String,default:"border"},placeholder:{type:String,default:"请选择"},multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},allowClear:{type:Boolean,default:!1},optionDisabledKey:{type:String,default:""},onToggleChange:{type:Function,default:void 0},onValueChange:{type:Function,default:void 0}};var V=r({name:"DIcon",props:{name:{type:String,required:!0},size:{type:String,default:"inherit"},color:{type:String,default:"inherit"},classPrefix:{type:String,default:"icon"}},setup:e=>d({},e),render(){const{name:e,size:l,color:t,classPrefix:o}=this;return c("i",{class:`${o} ${o}-${e}`,style:{fontSize:l,color:t}},null)}});V.install=function(e){e.component(V.name,V)};const S={name:{type:String,default:void 0},isShowTitle:{type:Boolean,default:!0},color:{type:String,default:void 0},showAnimation:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},beforeChange:{type:Function,default:void 0}},x=u(d({},S),{halfchecked:{type:Boolean,default:!1},checked:{type:Boolean,default:!1},value:{type:String},label:{type:String,default:void 0},title:{type:String,default:void 0},"onUpdate:checked":{type:Function,default:void 0},onChange:{type:Function,default:void 0},modelValue:{type:Boolean},"onUpdate:modelValue":{type:Function}}),A=u(d({},S),{modelValue:{type:Array,required:!0},direction:{type:String,default:"column"},itemWidth:{type:Number,default:void 0},options:{type:Array,default:()=>[]},onChange:{type:Function,default:void 0},"onUpdate:modelValue":{type:Function,default:void 0}}),O=Symbol("d-checkbox-group");var P=r({name:"DCheckbox",props:x,emits:["change","update:checked","update:modelValue"],setup(e,l){const t=s(O,null),o=p((()=>e.checked||e.modelValue)),n=p((()=>(null==t?void 0:t.disabled.value)||e.disabled)),a=p((()=>{var l,n;return null!=(n=null==(l=null==t?void 0:t.isItemChecked)?void 0:l.call(t,e.value))?n:o.value})),i=p((()=>{var l;return null!=(l=null==t?void 0:t.isShowTitle)?l:e.isShowTitle})),d=p((()=>{var l;return null!=(l=null==t?void 0:t.showAnimation)?l:e.showAnimation})),u=p((()=>{var l;return null!=(l=null==t?void 0:t.color)?l:e.color})),r=null==t?void 0:t.itemWidth.value,c=null==t?void 0:t.direction.value;return{itemWidth:r,direction:c,mergedColor:u,mergedDisabled:n,mergedIsShowTitle:i,mergedChecked:a,mergedShowAnimation:d,handleClick:()=>{((l,o)=>{var a;if(n.value)return Promise.resolve(!1);const i=null!=(a=e.beforeChange)?a:null==t?void 0:t.beforeChange;if(i){const e=i(l,o);return"boolean"==typeof e?Promise.resolve(e):e}return Promise.resolve(!0)})(!o.value,e.value).then((n=>n&&(()=>{const n=!o.value;null==t||t.toggleGroupVal(e.value),l.emit("update:checked",n),l.emit("update:modelValue",n),l.emit("change",n)})()))}}},render(){var e;const{itemWidth:l,direction:t,mergedChecked:o,mergedDisabled:n,mergedIsShowTitle:a,mergedShowAnimation:i,halfchecked:d,title:u,label:r,handleClick:s,name:p,value:v,mergedColor:h,$slots:f}=this,g={"devui-checkbox-column-margin":"column"===t,"devui-checkbox-wrap":void 0!==l},b=l?[`width: ${l}px`]:[],y={"devui-checkbox":!0,active:o,halfchecked:d,disabled:n,unchecked:!o},k=a?u||r:"",w=[`border-color:${(o||d)&&h?h:""}`,`background-image:${h&&d||h?`linear-gradient(${h}, ${h})`:""}`,`background-color:${h&&d?h:""}`],C={"devui-checkbox-material":!0,"custom-color":h,"devui-checkbox-no-label":!r&&!f.default,"devui-no-animation":!i,"devui-checkbox-default-background":!d},V={"devui-tick":!0,"devui-no-animation":!i},S=e=>e.stopPropagation();return c("div",{class:g,style:b},[c("div",{class:y},[c("label",{title:k,onClick:s},[c("input",m({name:p||v,class:"devui-checkbox-input",type:"checkbox"},{indeterminate:d},{checked:o,disabled:n,onClick:S,onChange:S}),null),c("span",{style:w,class:C},[c("span",{class:"devui-checkbox-halfchecked-bg"},null),c("svg",{viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg",class:"devui-checkbox-tick"},[c("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[c("polygon",{"fill-rule":"nonzero",points:"5.17391304 6.56521739 7.7173913 9.10869565 11.826087 5 13 6.17391304 7.7173913 11.4565217 4 7.73913043",class:V},null)])])]),r||(null==(e=f.default)?void 0:e.call(f))])])])}}),D=r({name:"DCheckboxGroup",props:A,emits:["change","update:modelValue"],setup(e,l){const t=v(e,"modelValue");return h(O,{disabled:v(e,"disabled"),isShowTitle:v(e,"isShowTitle"),color:v(e,"color"),showAnimation:v(e,"showAnimation"),beforeChange:e.beforeChange,isItemChecked:e=>t.value.includes(e),toggleGroupVal:e=>{const o=t.value.findIndex((l=>l===e));if(-1===o){const o=[...t.value,e];return l.emit("update:modelValue",o),void l.emit("change",o)}t.value.splice(o,1),l.emit("update:modelValue",t.value),l.emit("change",t.value)},itemWidth:v(e,"itemWidth"),direction:v(e,"direction")}),{defaultOpt:{checked:!1,isShowTitle:!0,halfchecked:!1,showAnimation:!0,disabled:!1}}},render(){var e;const{direction:l,$slots:t,defaultOpt:o,options:n}=this;let a=null==(e=t.default)?void 0:e.call(t);return(null==n?void 0:n.length)>0&&(a=n.map((e=>{const l=Object.assign({},o,e);return c(P,l,null)}))),c("div",{class:"devui-checkbox-group"},[c("div",{class:{"devui-checkbox-list-inline":"row"===l}},[a])])}});function $(e,l){let t=e;return"object"==typeof l&&Object.keys(l).forEach((e=>{l[e]&&(t+=` ${e}`)})),t}P.install=function(e){e.component(P.name,P)},D.install=function(e){e.component(D.name,D)};var j=r({name:"DSelect",props:C,emits:["toggleChange","valueChange","update:modelValue"],setup(e,l){const t=b(null),o=b(null),n=b(!1);function a(t){e.disabled||(n.value=t,l.emit("toggleChange",t))}!function(e,l,t){function o(o){var n,a;let i=o.target;i.shadowRoot&&o.composed&&(i=o.composedPath()[0]||i);const d=[null==(n=e[0])?void 0:n.value,null==(a=e[1])?void 0:a.value];l.value&&d.every((e=>e&&!e.contains(i)&&e!==i))&&t(!1)}f((()=>{document.body.addEventListener("mousedown",o,!1)})),g((()=>{document.body.addEventListener("mousedown",o,!1)}))}([t,o],n,a);const i=p((()=>{const{multiple:l,modelValue:t}=e;return e.options.map((e=>{let o;return o="object"==typeof e?d({name:e.name?e.name:e.value+"",value:e.value,_checked:!1},e):{name:e+"",value:e,_checked:!1},l&&(Array.isArray(t)?o._checked=t.includes(o.value):o._checked=!1),o}))})),u=function(e){const l=p((()=>{const l=new Map;return e.value.forEach((e=>{l.set(e.value,e)})),l}));return e=>e.map((e=>l.value.get(e)))}(i),r=p((()=>{var l;if(e.multiple&&Array.isArray(e.modelValue)){return u(e.modelValue).map((e=>e.name)).join(",")}return Array.isArray(e.modelValue)?"":(null==(l=u([e.modelValue])[0])?void 0:l.name)||""})),c=p((()=>!e.disabled&&e.allowClear&&r.value.length>0));return{isOpen:n,containerRef:t,dropdownRef:o,inputValue:r,mergeOptions:i,mergeClearable:c,valueChange:function(t,o){const{multiple:n,optionDisabledKey:d}=e;let{modelValue:u}=e;d&&t[d]||(n?(t._checked=!t._checked,u=i.value.filter((e=>e._checked)).map((e=>e.value)),l.emit("update:modelValue",u)):(l.emit("update:modelValue",t.value),a(!1)),l.emit("valueChange",t,o))},toggleChange:a,getItemClassName:function(l){const{optionDisabledKey:t}=e;return $("devui-select-item",{active:l.value===e.modelValue,disabled:!!t&&!!l[t]})},handleClear:function(t){t.preventDefault(),t.stopPropagation(),e.multiple?l.emit("update:modelValue",[]):l.emit("update:modelValue","")}}},render(){const{mergeOptions:e,isOpen:l,inputValue:t,size:o,multiple:n,disabled:a,optionDisabledKey:i,placeholder:d,overview:u,valueChange:r,toggleChange:s,getItemClassName:p,mergeClearable:m,handleClear:v}=this,h=$("devui-select",{"devui-select-open":l,"devui-dropdown-menu-multiple":n,"devui-select-lg":"lg"===o,"devui-select-sm":"sm"===o,"devui-select-underlined":"underlined"===u,"devui-select-disabled":a}),f=$("devui-select-input",{"devui-select-input-lg":"lg"===o,"devui-select-input-sm":"sm"===o}),g=$("devui-select-selection",{"devui-select-clearable":m});return c("div",{class:h,ref:"containerRef"},[c("div",{class:g,onClick:()=>s(!l)},[c("input",{value:t,type:"text",class:f,placeholder:d,readonly:!0,disabled:a},null),c("span",{onClick:v,class:"devui-select-clear"},[c(V,{name:"close"},null)]),c("span",{class:"devui-select-arrow"},[c(V,{name:"select-arrow"},null)])]),c(y,{name:"fade",ref:"dropdownRef"},{default:()=>[k(c("div",{class:"devui-select-dropdown"},[c("ul",{class:"devui-select-dropdown-list devui-scrollbar"},[e.map(((e,l)=>c("li",{onClick:t=>{t.preventDefault(),t.stopPropagation(),r(e,l)},class:p(e),key:l},[n?c(P,{modelValue:e._checked,label:e.name,disabled:!!i&&!!e[i]},null):e.name])))])]),[[w,l]])]})])}});j.install=function(e){e.component(j.name,j)};var B={title:"Select 下拉框",category:"数据录入",status:"已完成",install(e){e.use(j)}};export{j as Select,B as default};
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import { defineComponent, createVNode, inject, computed, mergeProps, toRef, provide, onMounted, onBeforeUnmount, ref, Transition, withDirectives, vShow } from "vue";
21
+ const selectProps = {
22
+ modelValue: {
23
+ type: [String, Number, Array],
24
+ default: ""
25
+ },
26
+ "onUpdate:modelValue": {
27
+ type: Function,
28
+ default: void 0
29
+ },
30
+ options: {
31
+ type: Array,
32
+ default: () => []
33
+ },
34
+ size: {
35
+ type: String,
36
+ default: "md"
37
+ },
38
+ overview: {
39
+ type: String,
40
+ default: "border"
41
+ },
42
+ placeholder: {
43
+ type: String,
44
+ default: "\u8BF7\u9009\u62E9"
45
+ },
46
+ multiple: {
47
+ type: Boolean,
48
+ default: false
49
+ },
50
+ disabled: {
51
+ type: Boolean,
52
+ default: false
53
+ },
54
+ allowClear: {
55
+ type: Boolean,
56
+ default: false
57
+ },
58
+ optionDisabledKey: {
59
+ type: String,
60
+ default: ""
61
+ },
62
+ onToggleChange: {
63
+ type: Function,
64
+ default: void 0
65
+ },
66
+ onValueChange: {
67
+ type: Function,
68
+ default: void 0
69
+ }
70
+ };
71
+ var Icon = defineComponent({
72
+ name: "DIcon",
73
+ props: {
74
+ name: {
75
+ type: String,
76
+ required: true
77
+ },
78
+ size: {
79
+ type: String,
80
+ default: "inherit"
81
+ },
82
+ color: {
83
+ type: String,
84
+ default: "inherit"
85
+ },
86
+ classPrefix: {
87
+ type: String,
88
+ default: "icon"
89
+ }
90
+ },
91
+ setup(props) {
92
+ return __spreadValues({}, props);
93
+ },
94
+ render() {
95
+ const {
96
+ name,
97
+ size,
98
+ color,
99
+ classPrefix
100
+ } = this;
101
+ return /^((https?):)?\/\//.test(name) ? createVNode("img", {
102
+ "src": name,
103
+ "alt": name.split("/")[name.split("/").length - 1],
104
+ "style": {
105
+ width: size,
106
+ verticalAlign: "text-bottom"
107
+ }
108
+ }, null) : createVNode("i", {
109
+ "class": `${classPrefix} ${classPrefix}-${name}`,
110
+ "style": {
111
+ fontSize: size,
112
+ color
113
+ }
114
+ }, null);
115
+ }
116
+ });
117
+ Icon.install = function(app) {
118
+ app.component(Icon.name, Icon);
119
+ };
120
+ var checkbox = "";
121
+ const commonProps = {
122
+ name: {
123
+ type: String,
124
+ default: void 0
125
+ },
126
+ halfchecked: {
127
+ type: Boolean,
128
+ default: false
129
+ },
130
+ isShowTitle: {
131
+ type: Boolean,
132
+ default: true
133
+ },
134
+ title: {
135
+ type: String
136
+ },
137
+ color: {
138
+ type: String,
139
+ default: void 0
140
+ },
141
+ showAnimation: {
142
+ type: Boolean,
143
+ default: true
144
+ },
145
+ disabled: {
146
+ type: Boolean,
147
+ default: false
148
+ },
149
+ beforeChange: {
150
+ type: Function,
151
+ default: void 0
152
+ }
153
+ };
154
+ const checkboxProps = __spreadProps(__spreadValues({}, commonProps), {
155
+ halfchecked: {
156
+ type: Boolean,
157
+ default: false
158
+ },
159
+ checked: {
160
+ type: Boolean,
161
+ default: false
162
+ },
163
+ value: {
164
+ type: String
165
+ },
166
+ label: {
167
+ type: String,
168
+ default: void 0
169
+ },
170
+ title: {
171
+ type: String,
172
+ default: void 0
173
+ },
174
+ "onUpdate:checked": {
175
+ type: Function,
176
+ default: void 0
177
+ },
178
+ onChange: {
179
+ type: Function,
180
+ default: void 0
181
+ },
182
+ modelValue: {
183
+ type: Boolean
184
+ },
185
+ "onUpdate:modelValue": {
186
+ type: Function
187
+ }
188
+ });
189
+ const checkboxGroupProps = __spreadProps(__spreadValues({}, commonProps), {
190
+ modelValue: {
191
+ type: Array,
192
+ required: true
193
+ },
194
+ direction: {
195
+ type: String,
196
+ default: "column"
197
+ },
198
+ itemWidth: {
199
+ type: Number,
200
+ default: void 0
201
+ },
202
+ options: {
203
+ type: Array,
204
+ default: () => []
205
+ },
206
+ onChange: {
207
+ type: Function,
208
+ default: void 0
209
+ },
210
+ "onUpdate:modelValue": {
211
+ type: Function,
212
+ default: void 0
213
+ }
214
+ });
215
+ const checkboxGroupInjectionKey = Symbol("d-checkbox-group");
216
+ var Checkbox = defineComponent({
217
+ name: "DCheckbox",
218
+ props: checkboxProps,
219
+ emits: ["change", "update:checked", "update:modelValue"],
220
+ setup(props, ctx) {
221
+ const checkboxGroupConf = inject(checkboxGroupInjectionKey, null);
222
+ const isChecked = computed(() => props.checked || props.modelValue);
223
+ const mergedDisabled = computed(() => {
224
+ return (checkboxGroupConf == null ? void 0 : checkboxGroupConf.disabled.value) || props.disabled;
225
+ });
226
+ const mergedChecked = computed(() => {
227
+ var _a, _b;
228
+ return (_b = (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.isItemChecked) == null ? void 0 : _a.call(checkboxGroupConf, props.value)) != null ? _b : isChecked.value;
229
+ });
230
+ const mergedIsShowTitle = computed(() => {
231
+ var _a;
232
+ return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.isShowTitle.value) != null ? _a : props.isShowTitle;
233
+ });
234
+ const mergedShowAnimation = computed(() => {
235
+ var _a;
236
+ return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.showAnimation.value) != null ? _a : props.showAnimation;
237
+ });
238
+ const mergedColor = computed(() => {
239
+ var _a;
240
+ return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.color.value) != null ? _a : props.color;
241
+ });
242
+ const itemWidth = checkboxGroupConf == null ? void 0 : checkboxGroupConf.itemWidth.value;
243
+ const direction = checkboxGroupConf == null ? void 0 : checkboxGroupConf.direction.value;
244
+ const canChange = (isChecked2, val) => {
245
+ var _a;
246
+ if (mergedDisabled.value) {
247
+ return Promise.resolve(false);
248
+ }
249
+ const beforeChange = (_a = props.beforeChange) != null ? _a : checkboxGroupConf == null ? void 0 : checkboxGroupConf.beforeChange;
250
+ if (beforeChange) {
251
+ const res = beforeChange(isChecked2, val);
252
+ if (typeof res === "boolean") {
253
+ return Promise.resolve(res);
254
+ }
255
+ return res;
256
+ }
257
+ return Promise.resolve(true);
258
+ };
259
+ const toggle = () => {
260
+ const current = !isChecked.value;
261
+ checkboxGroupConf == null ? void 0 : checkboxGroupConf.toggleGroupVal(props.value);
262
+ ctx.emit("update:checked", current);
263
+ ctx.emit("update:modelValue", current);
264
+ ctx.emit("change", current);
265
+ };
266
+ const handleClick = () => {
267
+ canChange(!isChecked.value, props.label).then((res) => res && toggle());
268
+ };
269
+ return {
270
+ itemWidth,
271
+ direction,
272
+ mergedColor,
273
+ mergedDisabled,
274
+ mergedIsShowTitle,
275
+ mergedChecked,
276
+ mergedShowAnimation,
277
+ handleClick
278
+ };
279
+ },
280
+ render() {
281
+ var _a;
282
+ const {
283
+ itemWidth,
284
+ direction,
285
+ mergedChecked,
286
+ mergedDisabled,
287
+ mergedIsShowTitle,
288
+ mergedShowAnimation,
289
+ halfchecked,
290
+ title,
291
+ label,
292
+ handleClick,
293
+ name,
294
+ value,
295
+ mergedColor,
296
+ $slots
297
+ } = this;
298
+ const wrapperCls = {
299
+ "devui-checkbox-column-margin": direction === "column",
300
+ "devui-checkbox-wrap": typeof itemWidth !== "undefined"
301
+ };
302
+ const wrapperStyle = itemWidth ? [`width: ${itemWidth}px`] : [];
303
+ const checkboxCls = {
304
+ "devui-checkbox": true,
305
+ active: mergedChecked,
306
+ halfchecked,
307
+ disabled: mergedDisabled,
308
+ unchecked: !mergedChecked
309
+ };
310
+ const labelTitle = mergedIsShowTitle ? title || label : "";
311
+ const bgImgStyle = mergedColor && halfchecked || mergedColor ? `linear-gradient(${mergedColor}, ${mergedColor})` : "";
312
+ const spanStyle = [`border-color:${(mergedChecked || halfchecked) && mergedColor ? mergedColor : ""}`, `background-image:${bgImgStyle}`, `background-color:${mergedColor && halfchecked ? mergedColor : ""}`];
313
+ const spanCls = {
314
+ "devui-checkbox-material": true,
315
+ "custom-color": mergedColor,
316
+ "devui-checkbox-no-label": !label && !$slots.default,
317
+ "devui-no-animation": !mergedShowAnimation,
318
+ "devui-checkbox-default-background": !halfchecked
319
+ };
320
+ const polygonCls = {
321
+ "devui-tick": true,
322
+ "devui-no-animation": !mergedShowAnimation
323
+ };
324
+ const stopPropagation = ($event) => $event.stopPropagation();
325
+ const inputProps = {
326
+ indeterminate: halfchecked
327
+ };
328
+ return createVNode("div", {
329
+ "class": wrapperCls,
330
+ "style": wrapperStyle
331
+ }, [createVNode("div", {
332
+ "class": checkboxCls
333
+ }, [createVNode("label", {
334
+ "title": labelTitle,
335
+ "onClick": handleClick
336
+ }, [createVNode("input", mergeProps({
337
+ "name": name || value,
338
+ "class": "devui-checkbox-input",
339
+ "type": "checkbox"
340
+ }, inputProps, {
341
+ "checked": mergedChecked,
342
+ "disabled": mergedDisabled,
343
+ "onClick": stopPropagation,
344
+ "onChange": stopPropagation
345
+ }), null), createVNode("span", {
346
+ "style": spanStyle,
347
+ "class": spanCls
348
+ }, [createVNode("span", {
349
+ "class": "devui-checkbox-halfchecked-bg"
350
+ }, null), createVNode("svg", {
351
+ "viewBox": "0 0 16 16",
352
+ "version": "1.1",
353
+ "xmlns": "http://www.w3.org/2000/svg",
354
+ "class": "devui-checkbox-tick"
355
+ }, [createVNode("g", {
356
+ "stroke": "none",
357
+ "stroke-width": "1",
358
+ "fill": "none",
359
+ "fill-rule": "evenodd"
360
+ }, [createVNode("polygon", {
361
+ "fill-rule": "nonzero",
362
+ "points": "5.17391304 6.56521739 7.7173913 9.10869565 11.826087 5 13 6.17391304 7.7173913 11.4565217 4 7.73913043",
363
+ "class": polygonCls
364
+ }, null)])])]), label || ((_a = $slots.default) == null ? void 0 : _a.call($slots))])])]);
365
+ }
366
+ });
367
+ var checkboxGroup = "";
368
+ var CheckboxGroup = defineComponent({
369
+ name: "DCheckboxGroup",
370
+ props: checkboxGroupProps,
371
+ emits: ["change", "update:modelValue"],
372
+ setup(props, ctx) {
373
+ const valList = toRef(props, "modelValue");
374
+ const defaultOpt = {
375
+ checked: false,
376
+ isShowTitle: true,
377
+ halfchecked: false,
378
+ showAnimation: true,
379
+ disabled: false
380
+ };
381
+ const toggleGroupVal = (val) => {
382
+ let index2 = -1;
383
+ if (typeof valList.value[0] === "string") {
384
+ index2 = valList.value.findIndex((item) => item === val);
385
+ } else if (typeof valList.value[0] === "object") {
386
+ index2 = valList.value.findIndex((item) => item.value === val);
387
+ }
388
+ if (index2 === -1) {
389
+ if (typeof props.options[0] === "object") {
390
+ const newOne = props.options.find((item) => item.value === val);
391
+ const res2 = [...valList.value, newOne];
392
+ ctx.emit("update:modelValue", res2);
393
+ ctx.emit("change", res2);
394
+ return;
395
+ }
396
+ const res = [...valList.value, val];
397
+ ctx.emit("update:modelValue", res);
398
+ ctx.emit("change", res);
399
+ return;
400
+ }
401
+ valList.value.splice(index2, 1);
402
+ ctx.emit("update:modelValue", valList.value);
403
+ ctx.emit("change", valList.value);
404
+ };
405
+ const isItemChecked = (itemVal) => {
406
+ if (typeof valList.value[0] === "string") {
407
+ return valList.value.includes(itemVal);
408
+ } else if (typeof valList.value[0] === "object") {
409
+ return valList.value.some((item) => item.value === itemVal);
410
+ }
411
+ };
412
+ provide(checkboxGroupInjectionKey, {
413
+ disabled: toRef(props, "disabled"),
414
+ isShowTitle: toRef(props, "isShowTitle"),
415
+ color: toRef(props, "color"),
416
+ showAnimation: toRef(props, "showAnimation"),
417
+ beforeChange: props.beforeChange,
418
+ isItemChecked,
419
+ toggleGroupVal,
420
+ itemWidth: toRef(props, "itemWidth"),
421
+ direction: toRef(props, "direction")
422
+ });
423
+ return {
424
+ defaultOpt
425
+ };
426
+ },
427
+ render() {
428
+ var _a;
429
+ const {
430
+ direction,
431
+ $slots,
432
+ defaultOpt,
433
+ options
434
+ } = this;
435
+ let children = (_a = $slots.default) == null ? void 0 : _a.call($slots);
436
+ if ((options == null ? void 0 : options.length) > 0) {
437
+ children = options.map((opt) => {
438
+ let mergedOpt = null;
439
+ if (typeof opt === "string") {
440
+ mergedOpt = Object.assign({}, defaultOpt, {
441
+ label: opt,
442
+ value: opt
443
+ });
444
+ } else if (typeof opt === "object") {
445
+ mergedOpt = Object.assign({}, defaultOpt, __spreadProps(__spreadValues({}, opt), {
446
+ label: opt.name
447
+ }));
448
+ }
449
+ return createVNode(Checkbox, mergedOpt, null);
450
+ });
451
+ }
452
+ return createVNode("div", {
453
+ "class": "devui-checkbox-group"
454
+ }, [createVNode("div", {
455
+ "class": {
456
+ "devui-checkbox-list-inline": direction === "row"
457
+ }
458
+ }, [children])]);
459
+ }
460
+ });
461
+ Checkbox.install = function(app) {
462
+ app.component(Checkbox.name, Checkbox);
463
+ };
464
+ CheckboxGroup.install = function(app) {
465
+ app.component(CheckboxGroup.name, CheckboxGroup);
466
+ };
467
+ function className(classStr, classOpt) {
468
+ let classname = classStr;
469
+ if (typeof classOpt === "object") {
470
+ Object.keys(classOpt).forEach((key) => {
471
+ classOpt[key] && (classname += ` ${key}`);
472
+ });
473
+ }
474
+ return classname;
475
+ }
476
+ function useCacheOptions(mergeOptions) {
477
+ const cacheOptions = computed(() => {
478
+ const map = new Map();
479
+ mergeOptions.value.forEach((item) => {
480
+ map.set(item.value, item);
481
+ });
482
+ return map;
483
+ });
484
+ const getValuesOption = (values) => values.map((value) => cacheOptions.value.get(value));
485
+ return getValuesOption;
486
+ }
487
+ function useSelectOutsideClick(refs, isOpen, toggleChange) {
488
+ function onGlobalMouseDown(e) {
489
+ var _a, _b;
490
+ let target = e.target;
491
+ if (target.shadowRoot && e.composed) {
492
+ target = e.composedPath()[0] || target;
493
+ }
494
+ const element = [(_a = refs[0]) == null ? void 0 : _a.value, (_b = refs[1]) == null ? void 0 : _b.value];
495
+ if (isOpen.value && element.every((el) => el && !el.contains(target) && el !== target)) {
496
+ toggleChange(false);
497
+ }
498
+ }
499
+ onMounted(() => {
500
+ document.body.addEventListener("mousedown", onGlobalMouseDown, false);
501
+ });
502
+ onBeforeUnmount(() => {
503
+ document.body.addEventListener("mousedown", onGlobalMouseDown, false);
504
+ });
505
+ }
506
+ var select = "";
507
+ var Select = defineComponent({
508
+ name: "DSelect",
509
+ props: selectProps,
510
+ emits: ["toggleChange", "valueChange", "update:modelValue"],
511
+ setup(props, ctx) {
512
+ const containerRef = ref(null);
513
+ const dropdownRef = ref(null);
514
+ const isOpen = ref(false);
515
+ function toggleChange(bool) {
516
+ if (props.disabled)
517
+ return;
518
+ isOpen.value = bool;
519
+ ctx.emit("toggleChange", bool);
520
+ }
521
+ useSelectOutsideClick([containerRef, dropdownRef], isOpen, toggleChange);
522
+ const mergeOptions = computed(() => {
523
+ const {
524
+ multiple,
525
+ modelValue
526
+ } = props;
527
+ return props.options.map((item) => {
528
+ let option;
529
+ if (typeof item === "object") {
530
+ option = __spreadValues({
531
+ name: item.name ? item.name : item.value + "",
532
+ value: item.value,
533
+ _checked: false
534
+ }, item);
535
+ } else {
536
+ option = {
537
+ name: item + "",
538
+ value: item,
539
+ _checked: false
540
+ };
541
+ }
542
+ if (multiple) {
543
+ if (Array.isArray(modelValue)) {
544
+ option._checked = modelValue.includes(option.value);
545
+ } else {
546
+ option._checked = false;
547
+ }
548
+ }
549
+ return option;
550
+ });
551
+ });
552
+ const getValuesOption = useCacheOptions(mergeOptions);
553
+ const inputValue = computed(() => {
554
+ var _a;
555
+ if (props.multiple && Array.isArray(props.modelValue)) {
556
+ const selectedOptions = getValuesOption(props.modelValue);
557
+ return selectedOptions.map((item) => item.name).join(",");
558
+ } else if (!Array.isArray(props.modelValue)) {
559
+ return ((_a = getValuesOption([props.modelValue])[0]) == null ? void 0 : _a.name) || "";
560
+ }
561
+ return "";
562
+ });
563
+ const mergeClearable = computed(() => {
564
+ return !props.disabled && props.allowClear && inputValue.value.length > 0;
565
+ });
566
+ function valueChange(item, index2) {
567
+ const {
568
+ multiple,
569
+ optionDisabledKey: disabledKey
570
+ } = props;
571
+ let {
572
+ modelValue
573
+ } = props;
574
+ if (disabledKey && !!item[disabledKey])
575
+ return;
576
+ if (multiple) {
577
+ item._checked = !item._checked;
578
+ modelValue = mergeOptions.value.filter((item2) => item2._checked).map((item2) => item2.value);
579
+ ctx.emit("update:modelValue", modelValue);
580
+ } else {
581
+ ctx.emit("update:modelValue", item.value);
582
+ toggleChange(false);
583
+ }
584
+ ctx.emit("valueChange", item, index2);
585
+ }
586
+ function getItemClassName(item) {
587
+ const {
588
+ optionDisabledKey: disabledKey
589
+ } = props;
590
+ return className("devui-select-item", {
591
+ active: item.value === props.modelValue,
592
+ disabled: disabledKey ? !!item[disabledKey] : false
593
+ });
594
+ }
595
+ function handleClear(e) {
596
+ e.preventDefault();
597
+ e.stopPropagation();
598
+ if (props.multiple) {
599
+ ctx.emit("update:modelValue", []);
600
+ } else {
601
+ ctx.emit("update:modelValue", "");
602
+ }
603
+ }
604
+ return {
605
+ isOpen,
606
+ containerRef,
607
+ dropdownRef,
608
+ inputValue,
609
+ mergeOptions,
610
+ mergeClearable,
611
+ valueChange,
612
+ toggleChange,
613
+ getItemClassName,
614
+ handleClear
615
+ };
616
+ },
617
+ render() {
618
+ const {
619
+ mergeOptions,
620
+ isOpen,
621
+ inputValue,
622
+ size,
623
+ multiple,
624
+ disabled,
625
+ optionDisabledKey: disabledKey,
626
+ placeholder,
627
+ overview,
628
+ valueChange,
629
+ toggleChange,
630
+ getItemClassName,
631
+ mergeClearable,
632
+ handleClear
633
+ } = this;
634
+ const selectCls = className("devui-select", {
635
+ "devui-select-open": isOpen,
636
+ "devui-dropdown-menu-multiple": multiple,
637
+ "devui-select-lg": size === "lg",
638
+ "devui-select-sm": size === "sm",
639
+ "devui-select-underlined": overview === "underlined",
640
+ "devui-select-disabled": disabled
641
+ });
642
+ const inputCls = className("devui-select-input", {
643
+ "devui-select-input-lg": size === "lg",
644
+ "devui-select-input-sm": size === "sm"
645
+ });
646
+ const selectionCls = className("devui-select-selection", {
647
+ "devui-select-clearable": mergeClearable
648
+ });
649
+ return createVNode("div", {
650
+ "class": selectCls,
651
+ "ref": "containerRef"
652
+ }, [createVNode("div", {
653
+ "class": selectionCls,
654
+ "onClick": () => toggleChange(!isOpen)
655
+ }, [createVNode("input", {
656
+ "value": inputValue,
657
+ "type": "text",
658
+ "class": inputCls,
659
+ "placeholder": placeholder,
660
+ "readonly": true,
661
+ "disabled": disabled
662
+ }, null), createVNode("span", {
663
+ "onClick": handleClear,
664
+ "class": "devui-select-clear"
665
+ }, [createVNode(Icon, {
666
+ "name": "close"
667
+ }, null)]), createVNode("span", {
668
+ "class": "devui-select-arrow"
669
+ }, [createVNode(Icon, {
670
+ "name": "select-arrow"
671
+ }, null)])]), createVNode(Transition, {
672
+ "name": "fade",
673
+ "ref": "dropdownRef"
674
+ }, {
675
+ default: () => [withDirectives(createVNode("div", {
676
+ "class": "devui-select-dropdown"
677
+ }, [createVNode("ul", {
678
+ "class": "devui-select-dropdown-list devui-scrollbar"
679
+ }, [mergeOptions.map((item, i) => createVNode("li", {
680
+ "onClick": (e) => {
681
+ e.preventDefault();
682
+ e.stopPropagation();
683
+ valueChange(item, i);
684
+ },
685
+ "class": getItemClassName(item),
686
+ "key": i
687
+ }, [multiple ? createVNode(Checkbox, {
688
+ "modelValue": item._checked,
689
+ "label": item.name,
690
+ "disabled": disabledKey ? !!item[disabledKey] : false
691
+ }, null) : item.name]))])]), [[vShow, isOpen]])]
692
+ })]);
693
+ }
694
+ });
695
+ Select.install = function(app) {
696
+ app.component(Select.name, Select);
697
+ };
698
+ var index = {
699
+ title: "Select \u4E0B\u62C9\u6846",
700
+ category: "\u6570\u636E\u5F55\u5165",
701
+ status: "10%",
702
+ install(app) {
703
+ app.use(Select);
704
+ }
705
+ };
706
+ export { Select, index as default };