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,1260 @@
1
- var e=Object.defineProperty,t=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,i=(t,l,a)=>l in t?e(t,l,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[l]=a;"undefined"!=typeof require&&require;import{defineComponent as u,createVNode as o,reactive as n,ref as s,createTextVNode as r,computed as p,mergeProps as m,onMounted as v,watch as c,Fragment as d,onUnmounted as f}from"vue";const h={modelValue:{type:String,default:""},placeholder:{type:String,default:"00:00:00"},disabled:{type:Boolean,default:!1},timePickerWidth:{type:Number,default:210},minTime:{type:String,default:"00:00:00"},maxTime:{type:String,default:"23:59:59"},format:{type:String,default:"hh:mm:ss"},autoOpen:{type:Boolean,default:!1}};var T=u({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=>((e,u)=>{for(var o in u||(u={}))l.call(u,o)&&i(e,o,u[o]);if(t)for(var o of t(u))a.call(u,o)&&i(e,o,u[o]);return e})({},e),render(){const{name:e,size:t,color:l,classPrefix:a}=this;return o("i",{class:`${a} ${a}-${e}`,style:{fontSize:t,color:l}},null)}});function y(e){const t=n([]);let l=0;l="hour"==e?24:60;for(let a=0;a<l;a++)t.push({time:a<10?"0"+a:a+"",isActive:!1,flag:e,isDisabled:!1});return t}T.install=function(e){e.component(T.name,T)};function g(e,t,l,a,i,u,o,n){const r=s(!1),p=s(!1),m=s(),v=s(),c=s(-100),d=s(-100),f=s(),h=s(""),T=s(!1),y=s(`${e.value}:${t.value}:${l.value}`),g=s(n),b=()=>{"hh:mm:ss"==i?g.value=`${e.value}:${t.value}:${l.value}`:"mm:hh:ss"==i?g.value=`${t.value}:${e.value}:${l.value}`:"hh:mm"==i?g.value=`${e.value}:${t.value}`:"mm:ss"==i&&(g.value=`${t.value}:${l.value}`)};return{isActive:r,showPopup:p,devuiTimePicker:m,timePickerValue:h,inputDom:v,timePopupDom:f,left:c,top:d,showClearIcon:T,firsthandActiveTime:y,vModeValue:g,getPopupPosition:()=>{!function(e,t,l){const a=e.getBoundingClientRect();window.innerHeight-(a.top+20)>a.top+20?(t.value=a.x,l.value=a.top+20+10):(t.value=a.x,l.value=a.top-316)}(m.value,c,d)},setInputValue:b,getTimeValue:a=>{a.stopPropagation(),p.value&&(e.value=f.value.changTimeData().activeHour.value,t.value=f.value.changTimeData().activeMinute.value,l.value=f.value.changTimeData().activeSecond.value,y.value=`${e.value}:${t.value}:${l.value}`,b())},clickVerifyFun:e=>{if(e.stopPropagation(),r.value=!1,p.value=!1,o)return;(e.composedPath&&e.composedPath()||e.path).map((e=>{e==m.value&&("00:00:00"==y.value&&(""==g.value&&(g.value="00:00:00"),g.value>a?y.value=g.value:y.value=a),b(),r.value=!0,p.value=!0)}))},isOutOpen:()=>{if(u){const a=g.value.split(":");e.value=a[0],t.value=a[1],l.value=a[2],y.value=g.value,b(),r.value=!0,p.value=u}},clearAll:i=>{if(i.stopPropagation(),p.value=!1,"00:00:00"!=a){const i=a.split(":");e.value=i[0],t.value=i[1],l.value=i[2]}else e.value="00",t.value="00",l.value="00";y.value=`${e.value}:${t.value}:${l.value}`,b()},chooseTime:a=>{if(a.type)"hh"==a.type.toLowerCase()?e.value=a.time:"mm"==a.type.toLowerCase()?t.value=a.time:"ss"==a.type.toLowerCase()&&(l.value=a.time),y.value=`${e.value}:${t.value}:${l.value}`,b();else{const i=a.time.split(":");e.value=i[0],t.value=i[1],l.value=i[2],y.value=`${e.value}:${t.value}:${l.value}`,b()}}}}var b=u({name:"TTimeList",props:{hourList:{type:Array,default:()=>[]},minuteList:{type:Array,default:()=>[]},secondList:{type:Array,default:()=>[]},format:{type:String,default:"hh:mm:ss"},minTime:{type:String,default:"00:00:00"},maxTime:{type:String,default:"23:59:59"}},setup(e,t){const l=s(),{getNewTime:a,activeTimeFun:i,resetTimeValue:u}=((e,t,l,a,i,u,o)=>{const n=s("00:00:00"),r=s("00"),p=s("00"),m=s("00"),v=(o,v)=>{let d=[],h=s("");if("hour"==o.flag?(d=e,h=r,c(o)):"minute"==o.flag?(d=t,h=p,c(o)):"second"==o.flag&&(d=l,h=m),d.map(((e,t)=>{e.isActive=!1})),d[v].isActive=!0,h.value=d[v].time,n.value=`${r.value}:${p.value}:${m.value}`,n.value<a)n.value=a,f(a);else if("mm:ss"==u&&`${p.value}:${m.value}`>i.slice(3)){const e=a.slice(0,3)+i.slice(3);f(e)}else n.value>i&&(n.value=i,f(i))},c=e=>{let o="00",n="00";const s=a.split(":")[0],m=a.split(":")[1],v=a.split(":")[2],c=i.split(":")[0],f=i.split(":")[1],h=i.split(":")[2];"hour"==e.flag&&(e.time==s?(o=m,d(t,o,n),p.value<m&&d(l,v,n)):e.time==c?(n=f,d(t,o,n),d(l,o,h)):(d(t,o,n),d(l,o,n))),"minute"==e.flag&&"mm:ss"==u?e.time==m?(o=v,d(l,o,n)):e.time==f?(n=h,d(l,o,n)):d(l,o,n):"minute"==e.flag&&(r.value==s&&e.time==m?(o=v,d(l,o,n)):r.value==c&&e.time==f?(n=h,d(l,o,n)):d(l,o,n))},d=(e,t,l)=>{e.map((e=>{"00"!=t&&e.time<t||"00"!=l&&e.time>l?e.isDisabled=!0:e.isDisabled=!1}))},f=i=>{const n=i.split(":"),s=a.split(":");let v=0,c=0,d=0;"hh:mm:ss"==u?(v=parseInt(n[0]),c=parseInt(n[1]),d=parseInt(n[2]),o.value.children[0].scrollTop=30*v,o.value.children[1].scrollTop=30*c,o.value.children[2].scrollTop=30*d,r.value=n[0],p.value=n[1],m.value=n[2],T(e,n[0]),T(t,n[1]),T(l,n[2]),h(e,r.value),h(t,p.value)):"mm:hh:ss"==u?(v=parseInt(n[0]),c=parseInt(n[1]),d=parseInt(n[2]),o.value.children[0].scrollTop=30*c,o.value.children[1].scrollTop=30*v,o.value.children[2].scrollTop=30*d,r.value=n[0],p.value=n[1],m.value=n[2],T(e,n[0]),T(t,n[1]),T(l,n[2]),h(e,r.value),h(t,p.value)):"hh:mm"==u?(v=parseInt(n[0]),c=parseInt(n[1]),o.value.children[0].scrollTop=30*v,o.value.children[1].scrollTop=30*c,r.value=n[0],p.value=n[1],T(e,n[0]),T(t,n[1]),h(e,r.value)):"mm:ss"==u&&(c=parseInt(n[1]),d=parseInt(n[2]),o.value.children[0].scrollTop=30*c,o.value.children[1].scrollTop=30*d,r.value=s[0],p.value=n[1],m.value=n[2],T(t,n[1]),T(l,n[2]),h(t,p.value))},h=(e,t)=>{e.map((e=>{e.time==t&&c(e)}))},T=(e,t)=>{e.map((e=>{e.time==t?e.isActive=!0:e.isActive=!1}))};return{activeTime:n,activeHour:r,activeMinute:p,activeSecond:m,activeTimeFun:(e,t,l)=>{if(t.isDisabled)return!1;v(t,l),e.target.parentElement.scrollTop=30*l},resetTimeValue:f,getNewTime:()=>({activeTime:n,activeHour:r,activeMinute:p,activeSecond:m})}})(e.hourList,e.minuteList,e.secondList,e.minTime,e.maxTime,e.format,l),n=()=>{const t={hh:e.hourList,mm:e.minuteList,ss:e.secondList};return e.format.split(":").map((l=>(t=>{return o("ul",{class:"time-ul",style:{width:e.format.length>6?"33.33%":"50%"}},[r(" "),(l=t,l.map(((e,t)=>o("li",{class:`${e.flag}Id-${t} ${e.isActive?"active-li":""} ${e.isDisabled?"disabled-li":""}`,onClick:l=>{i(l,e,t)}},[e.time]))))]);var l})(t[l])))};return t.expose({restScrooTop:()=>{for(let e=0;e<l.value.children.length;e++)l.value.children[e].scrollTop=0},setOutoTime:e=>{u(e)},getNewTime:a}),()=>o("div",{class:"devui-time-list",ref:l},[n()])}});var $=u({name:"DButton",props:{type:{type:String,default:"button"},btnStyle:{type:String,default:"primary"},size:{type:String,default:"md"},position:{type:String,default:"default"},bordered:{type:Boolean,default:!1},icon:{type:String,default:""},showLoading:{type:Boolean,default:!1},width:{type:String},disabled:{type:Boolean,default:!1},autofocus:{type:Boolean,default:!1},onClick:{type:Function}},setup(e,t){const l=s(null),a=t=>{var l;e.showLoading||null==(l=e.onClick)||l.call(e,t)},i=p((()=>t.slots.default)),u=p((()=>{const{btnStyle:t,size:l,position:a,bordered:u,icon:o}=e;return`${`devui-btn devui-btn-${t} devui-btn-${l} devui-btn-${a}`} ${u?"bordered":""} ${o&&!i.value&&"primary"!==t?"d-btn-icon":""} ${o?"d-btn-icon-wrap":""}`})),n=p((()=>{if(!e.icon)return;const t="devui-icon-fix icon";return i.value?`${t} clear-right-5`:t}));return()=>{var i,s;const{icon:r,type:p,disabled:v,showLoading:c,width:d}=e;return o("div",m({class:"devui-btn-host"},t.attrs),[o("button",{class:u.value,type:p,disabled:v,style:{width:d},onClick:a},[r?o(T,{name:e.icon,class:n.value},null):null,o("span",{class:"button-content",ref:l},[null==(s=(i=t.slots).default)?void 0:s.call(i)])])])}}});$.install=function(e){e.component($.name,$)};var w=u({name:"DTimePopup",components:{TimeList:b,Button:$},props:{showPopup:{type:Boolean,default:!1},popupTop:{type:Number,default:-100},popupLeft:{type:Number,default:-100},popupWidth:{type:Number,default:300},popupFormat:{type:String,default:"hh:mm:ss"},minTime:{type:String,default:"00:00:00"},maxTime:{type:String,default:"23:59:59"},bindData:{type:String,default:"00:00:00"}},emits:["subData"],setup(e,t){const l=s(),a=s(),i=y("hour"),u=y("minute"),n=y("second");v((()=>{((e,t,l,a,i,u)=>{const o=i.split(":")[0],n=i.split(":")[1],s=a.split(":")[0],r=a.split(":")[1],p=a.split(":")[2];e.map(((e,t)=>{(e.time<s||e.time>o)&&(e.isDisabled=!0)})),"mm:ss"==u?t.map(((e,t)=>{(e.time<r||e.time>n)&&(e.isDisabled=!0)})):t.map(((e,t)=>{e.time<r&&(e.isDisabled=!0)})),l.map(((e,t)=>{e.time<p&&(e.isDisabled=!0)}))})(i,u,n,e.minTime,e.maxTime,e.popupFormat)})),c((()=>[e.showPopup,e.bindData]),(([e,t],[l,i])=>{e||t!=i?a.value.setOutoTime(t):a.value.restScrooTop()}));const p=e=>{e.stopPropagation(),t.emit("subData")};return t.expose({changTimeData:()=>a.value.getNewTime()}),()=>{var s,m;return o(d,null,[o("div",{ref:l,class:"devui-time-popup "+(e.showPopup?"devui-show-time-popup":""),style:{width:e.popupWidth+"px",top:e.popupTop+"px",left:e.popupLeft+"px"}},[o(b,{ref:a,hourList:i,minuteList:u,secondList:n,minTime:e.minTime,maxTime:e.maxTime,format:e.popupFormat},null),o("div",{class:"devui-time-popup-btn"},[o("div",{class:"popup-slots"},[null==(m=(s=t.slots).default)?void 0:m.call(s)]),o("div",{onClick:p},[o($,{btnStyle:"common"},{default:()=>[r("确定")]})])])])])}}}),L=u({name:"DTimePicker",components:{TimePopup:w},props:h,emits:["selectedTimeChage","update:modelValue"],setup(e,t){const l=s("00"),a=s("00"),i=s("00"),u=e.format.toLowerCase(),{isActive:n,showPopup:r,devuiTimePicker:p,inputDom:m,left:h,top:y,showClearIcon:b,firsthandActiveTime:$,chooseTime:L,getTimeValue:S,clickVerifyFun:P,isOutOpen:D,clearAll:k,timePopupDom:x,vModeValue:A,getPopupPosition:C}=g(l,a,i,e.minTime,u,e.autoOpen,e.disabled,e.modelValue),I=e=>{n.value=!1,r.value=!1,t.emit("selectedTimeChage",A.value)};return v((()=>{C(),D(),document.addEventListener("click",P),document.addEventListener("click",S),document.addEventListener("scroll",C),window.addEventListener("resize",C)})),f((()=>{document.removeEventListener("click",P),document.removeEventListener("click",S),document.removeEventListener("scroll",C),window.removeEventListener("resize",C)})),c(A,(l=>{t.emit("update:modelValue",A.value),l!=e.minTime?b.value=!0:b.value=!1})),t.expose({clearAll:k,chooseTime:L}),()=>o(d,null,[o("div",{class:`devui-time-picker ${n.value?"time-picker-active":""} ${e.disabled?"picker-disabled":""}`,ref:p},[o(w,{ref:x,showPopup:r.value,popupTop:y.value,popupLeft:h.value,popupWidth:e.timePickerWidth,popupFormat:e.format.toLowerCase(),minTime:e.minTime,maxTime:e.maxTime,bindData:$.value,onSubData:I},{default:()=>{var e,l;return[null==(l=(e=t.slots).customViewTemplate)?void 0:l.call(e)]}}),o("input",{ref:m,type:"text",value:A.value,placeholder:`${e.placeholder}`,disabled:e.disabled,class:"time-input"},null),o("div",{class:"time-input-icon"},[o("div",{onClick:k},[b.value?o(T,{size:"small",name:"close"},null):""]),o("div",null,[o(T,{size:"small",name:"time"},null)])])])])}});L.install=function(e){e.component(L.name,L)};var S={title:"TimePicker 时间选择器",category:"数据录入",status:"20%",install(e){e.use(L)}};export{L as TimePicker,S as default};
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ var __publicField = (obj, key, value) => {
18
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
19
+ return value;
20
+ };
21
+ import { defineComponent, createVNode, reactive, ref, onMounted, onBeforeUnmount, onUnmounted, Fragment, computed, withDirectives, mergeProps, resolveDirective, h, render, watch, createTextVNode } from "vue";
22
+ const timePickerProps = {
23
+ modelValue: {
24
+ type: String,
25
+ default: ""
26
+ },
27
+ placeholder: {
28
+ type: String,
29
+ default: "00:00:00"
30
+ },
31
+ disabled: {
32
+ type: Boolean,
33
+ default: false
34
+ },
35
+ timePickerWidth: {
36
+ type: Number,
37
+ default: 212
38
+ },
39
+ minTime: {
40
+ type: String,
41
+ default: "00:00:00"
42
+ },
43
+ maxTime: {
44
+ type: String,
45
+ default: "23:59:59"
46
+ },
47
+ format: {
48
+ type: String,
49
+ default: "hh:mm:ss"
50
+ },
51
+ autoOpen: {
52
+ type: Boolean,
53
+ default: false
54
+ },
55
+ showAnimation: {
56
+ type: Boolean,
57
+ default: true
58
+ }
59
+ };
60
+ var Icon = defineComponent({
61
+ name: "DIcon",
62
+ props: {
63
+ name: {
64
+ type: String,
65
+ required: true
66
+ },
67
+ size: {
68
+ type: String,
69
+ default: "inherit"
70
+ },
71
+ color: {
72
+ type: String,
73
+ default: "inherit"
74
+ },
75
+ classPrefix: {
76
+ type: String,
77
+ default: "icon"
78
+ }
79
+ },
80
+ setup(props) {
81
+ return __spreadValues({}, props);
82
+ },
83
+ render() {
84
+ const {
85
+ name,
86
+ size,
87
+ color,
88
+ classPrefix
89
+ } = this;
90
+ return /^((https?):)?\/\//.test(name) ? createVNode("img", {
91
+ "src": name,
92
+ "alt": name.split("/")[name.split("/").length - 1],
93
+ "style": {
94
+ width: size,
95
+ verticalAlign: "text-bottom"
96
+ }
97
+ }, null) : createVNode("i", {
98
+ "class": `${classPrefix} ${classPrefix}-${name}`,
99
+ "style": {
100
+ fontSize: size,
101
+ color
102
+ }
103
+ }, null);
104
+ }
105
+ });
106
+ Icon.install = function(app) {
107
+ app.component(Icon.name, Icon);
108
+ };
109
+ function getPositionFun(el, left, top) {
110
+ const inputDom = el.getBoundingClientRect();
111
+ const button2 = window.innerHeight - (inputDom.top + 20);
112
+ if (button2 > inputDom.top + 20) {
113
+ left.value = inputDom.x;
114
+ top.value = inputDom.top + 20 + 10;
115
+ } else {
116
+ left.value = inputDom.x;
117
+ top.value = inputDom.top - 316;
118
+ }
119
+ }
120
+ function initializeTimeData(type) {
121
+ const timeArr = reactive([]);
122
+ let arrLenght = 0;
123
+ if (type == "hour") {
124
+ arrLenght = 24;
125
+ } else {
126
+ arrLenght = 60;
127
+ }
128
+ for (let i = 0; i < arrLenght; i++) {
129
+ timeArr.push({
130
+ time: i < 10 ? "0" + i : i + "",
131
+ isActive: false,
132
+ flag: type,
133
+ isDisabled: false
134
+ });
135
+ }
136
+ return timeArr;
137
+ }
138
+ const setTimeAstrict = (hourList, minuteList, secondList, minTime, maxTime, format) => {
139
+ const maxTimeHour = maxTime.split(":")[0];
140
+ const maxTimeMinute = maxTime.split(":")[1];
141
+ const minTimeHour = minTime.split(":")[0];
142
+ const minTimeMinute = minTime.split(":")[1];
143
+ const minTimeSecond = minTime.split(":")[2];
144
+ hourList.map((item, index2) => {
145
+ if (item.time < minTimeHour || item.time > maxTimeHour) {
146
+ item.isDisabled = true;
147
+ }
148
+ });
149
+ if (format == "mm:ss") {
150
+ minuteList.map((item, index2) => {
151
+ if (item.time < minTimeMinute || item.time > maxTimeMinute) {
152
+ item.isDisabled = true;
153
+ }
154
+ });
155
+ } else {
156
+ minuteList.map((item, index2) => {
157
+ if (item.time < minTimeMinute) {
158
+ item.isDisabled = true;
159
+ }
160
+ });
161
+ }
162
+ secondList.map((item, index2) => {
163
+ if (item.time < minTimeSecond) {
164
+ item.isDisabled = true;
165
+ }
166
+ });
167
+ };
168
+ function useTimePicker(hh, mm, ss, minTime, maxTime, format, autoOpen, disabled, value) {
169
+ const isActive = ref(false);
170
+ const showPopup = ref(false);
171
+ const devuiTimePicker = ref();
172
+ const inputDom = ref();
173
+ const left = ref(-100);
174
+ const top = ref(-100);
175
+ const timePopupDom = ref();
176
+ const timePickerValue = ref("");
177
+ const showClearIcon = ref(false);
178
+ const firsthandActiveTime = ref(`${hh.value}:${mm.value}:${ss.value}`);
179
+ const vModeValue = ref(value);
180
+ const getPopupPosition = () => {
181
+ getPositionFun(devuiTimePicker.value, left, top);
182
+ };
183
+ const clickVerifyFun = (e) => {
184
+ e.stopPropagation();
185
+ isActive.value = false;
186
+ showPopup.value = false;
187
+ if (disabled)
188
+ return;
189
+ const path = e.composedPath && e.composedPath() || e.path;
190
+ const inInputDom = path.includes(devuiTimePicker.value);
191
+ inInputDom && mouseInIputFun();
192
+ };
193
+ const mouseInIputFun = () => {
194
+ if (firsthandActiveTime.value == "00:00:00") {
195
+ const vModelValueArr = value.split(":");
196
+ const minTimeValueArr = minTime.split(":");
197
+ const maxTimeValueArr = maxTime.split(":");
198
+ vModeValue.value == "" ? vModeValue.value = "00:00:00" : "";
199
+ if (value > minTime && value < maxTime) {
200
+ firsthandActiveTime.value = value;
201
+ setInputValue(vModelValueArr[0], vModelValueArr[1], vModelValueArr[2]);
202
+ } else if (value > maxTime) {
203
+ firsthandActiveTime.value = maxTime;
204
+ setInputValue(maxTimeValueArr[0], maxTimeValueArr[1], maxTimeValueArr[2]);
205
+ } else {
206
+ firsthandActiveTime.value = minTime;
207
+ setInputValue(minTimeValueArr[0], minTimeValueArr[1], minTimeValueArr[2]);
208
+ }
209
+ }
210
+ isActive.value = true;
211
+ showPopup.value = true;
212
+ };
213
+ const vModelIsBeyond = () => {
214
+ if (vModeValue.value != "" && vModeValue.value < minTime) {
215
+ vModeValue.value = minTime;
216
+ } else if (vModeValue.value != "" && vModeValue.value > maxTime) {
217
+ vModeValue.value = maxTime;
218
+ }
219
+ const vModelValueArr = vModeValue.value.split(":");
220
+ vModeValue.value && setInputValue(vModelValueArr[0], vModelValueArr[1], vModelValueArr[2]);
221
+ };
222
+ const getTimeValue = (e) => {
223
+ e.stopPropagation();
224
+ if (showPopup.value) {
225
+ hh.value = timePopupDom.value.changTimeData().activeHour.value;
226
+ mm.value = timePopupDom.value.changTimeData().activeMinute.value;
227
+ ss.value = timePopupDom.value.changTimeData().activeSecond.value;
228
+ firsthandActiveTime.value = `${hh.value}:${mm.value}:${ss.value}`;
229
+ setInputValue(hh.value, mm.value, ss.value);
230
+ }
231
+ };
232
+ const setInputValue = (hh2, mm2, ss2) => {
233
+ if (format == "hh:mm:ss") {
234
+ vModeValue.value = `${hh2}:${mm2}:${ss2}`;
235
+ } else if (format == "mm:hh:ss") {
236
+ vModeValue.value = `${mm2}:${hh2}:${ss2}`;
237
+ } else if (format == "hh:mm") {
238
+ vModeValue.value = `${hh2}:${mm2}`;
239
+ } else if (format == "mm:ss") {
240
+ vModeValue.value = `${mm2}:${ss2}`;
241
+ }
242
+ };
243
+ const clearAll = (e) => {
244
+ e.stopPropagation();
245
+ showPopup.value = false;
246
+ if (minTime != "00:00:00") {
247
+ const minTimeArr = minTime.split(":");
248
+ hh.value = minTimeArr[0];
249
+ mm.value = minTimeArr[1];
250
+ ss.value = minTimeArr[2];
251
+ } else {
252
+ hh.value = "00";
253
+ mm.value = "00";
254
+ ss.value = "00";
255
+ }
256
+ firsthandActiveTime.value = `${hh.value}:${mm.value}:${ss.value}`;
257
+ setInputValue(hh.value, mm.value, ss.value);
258
+ };
259
+ const isOutOpen = () => {
260
+ if (autoOpen) {
261
+ const timeArr = vModeValue.value.split(":");
262
+ hh.value = timeArr[0];
263
+ mm.value = timeArr[1];
264
+ ss.value = timeArr[2];
265
+ firsthandActiveTime.value = vModeValue.value;
266
+ setInputValue(hh.value, mm.value, ss.value);
267
+ isActive.value = true;
268
+ showPopup.value = autoOpen;
269
+ }
270
+ };
271
+ const chooseTime = (slotTime) => {
272
+ if (slotTime.type) {
273
+ if (slotTime.type.toLowerCase() == "hh") {
274
+ hh.value = slotTime.time;
275
+ } else if (slotTime.type.toLowerCase() == "mm") {
276
+ mm.value = slotTime.time;
277
+ } else if (slotTime.type.toLowerCase() == "ss") {
278
+ ss.value = slotTime.time;
279
+ }
280
+ firsthandActiveTime.value = `${hh.value}:${mm.value}:${ss.value}`;
281
+ setInputValue(hh.value, mm.value, ss.value);
282
+ } else {
283
+ const timeArr = slotTime.time.split(":");
284
+ hh.value = timeArr[0];
285
+ mm.value = timeArr[1];
286
+ ss.value = timeArr[2];
287
+ firsthandActiveTime.value = `${hh.value}:${mm.value}:${ss.value}`;
288
+ setInputValue(hh.value, mm.value, ss.value);
289
+ }
290
+ };
291
+ return {
292
+ isActive,
293
+ showPopup,
294
+ devuiTimePicker,
295
+ timePickerValue,
296
+ inputDom,
297
+ timePopupDom,
298
+ left,
299
+ top,
300
+ showClearIcon,
301
+ firsthandActiveTime,
302
+ vModeValue,
303
+ getPopupPosition,
304
+ getTimeValue,
305
+ clickVerifyFun,
306
+ isOutOpen,
307
+ vModelIsBeyond,
308
+ clearAll,
309
+ chooseTime
310
+ };
311
+ }
312
+ const usePopupLine = (hourListRef, minuteListRef, secondListRef, minTime, maxTime, format, timeListDom) => {
313
+ const activeTime = ref("00:00:00");
314
+ const activeHour = ref("00");
315
+ const activeMinute = ref("00");
316
+ const activeSecond = ref("00");
317
+ const activeTimeFun = (e, item, index2) => {
318
+ if (item.isDisabled) {
319
+ return false;
320
+ } else {
321
+ setTimeActive(item, index2);
322
+ e.target.parentElement.parentElement.scrollTop = index2 * 32;
323
+ }
324
+ };
325
+ const setTimeActive = (item, index2) => {
326
+ let activeTimeList = [];
327
+ let acitveTimeValue = ref("");
328
+ if (item.flag == "hour") {
329
+ activeTimeList = hourListRef;
330
+ acitveTimeValue = activeHour;
331
+ getItemAstrict(item);
332
+ } else if (item.flag == "minute") {
333
+ activeTimeList = minuteListRef;
334
+ acitveTimeValue = activeMinute;
335
+ getItemAstrict(item);
336
+ } else if (item.flag == "second") {
337
+ activeTimeList = secondListRef;
338
+ acitveTimeValue = activeSecond;
339
+ }
340
+ activeTimeList.map((tiemItem, tiemeIndex) => {
341
+ tiemItem.isActive = index2 === tiemeIndex;
342
+ });
343
+ acitveTimeValue.value = activeTimeList[index2].time;
344
+ activeTime.value = `${activeHour.value}:${activeMinute.value}:${activeSecond.value}`;
345
+ if (activeTime.value < minTime) {
346
+ activeTime.value = minTime;
347
+ resetTimeValue(minTime);
348
+ } else if (format == "mm:ss" && `${activeMinute.value}:${activeSecond.value}` > maxTime.slice(3)) {
349
+ const newMinTime = minTime.slice(0, 3) + maxTime.slice(3);
350
+ resetTimeValue(newMinTime);
351
+ } else if (activeTime.value > maxTime) {
352
+ activeTime.value = maxTime;
353
+ resetTimeValue(maxTime);
354
+ }
355
+ };
356
+ const getItemAstrict = (item) => {
357
+ let min = "00";
358
+ let max = "00";
359
+ const minTimeHour = minTime.split(":")[0];
360
+ const minTimeMinute = minTime.split(":")[1];
361
+ const minTimeSecond = minTime.split(":")[2];
362
+ const maxTimeHour = maxTime.split(":")[0];
363
+ const maxTimeMinute = maxTime.split(":")[1];
364
+ const maxTimeSecond = maxTime.split(":")[2];
365
+ if (item.flag == "hour") {
366
+ if (item.time == minTimeHour) {
367
+ min = minTimeMinute;
368
+ setItemAstrict(minuteListRef, min, max);
369
+ activeMinute.value < minTimeMinute && setItemAstrict(secondListRef, minTimeSecond, max);
370
+ } else if (item.time == maxTimeHour) {
371
+ max = maxTimeMinute;
372
+ setItemAstrict(minuteListRef, min, max);
373
+ setItemAstrict(secondListRef, min, maxTimeSecond);
374
+ } else {
375
+ setItemAstrict(minuteListRef, min, max);
376
+ setItemAstrict(secondListRef, min, max);
377
+ }
378
+ }
379
+ if (item.flag == "minute" && format == "mm:ss") {
380
+ if (item.time == minTimeMinute) {
381
+ min = minTimeSecond;
382
+ setItemAstrict(secondListRef, min, max);
383
+ } else if (item.time == maxTimeMinute) {
384
+ max = maxTimeSecond;
385
+ setItemAstrict(secondListRef, min, max);
386
+ } else {
387
+ setItemAstrict(secondListRef, min, max);
388
+ }
389
+ } else if (item.flag == "minute") {
390
+ if (activeHour.value == minTimeHour && item.time == minTimeMinute) {
391
+ min = minTimeSecond;
392
+ setItemAstrict(secondListRef, min, max);
393
+ } else if (activeHour.value == maxTimeHour && item.time == maxTimeMinute) {
394
+ max = maxTimeSecond;
395
+ setItemAstrict(secondListRef, min, max);
396
+ } else {
397
+ setItemAstrict(secondListRef, min, max);
398
+ }
399
+ }
400
+ };
401
+ const setItemAstrict = (timeArr, min, max) => {
402
+ timeArr.map((itme) => {
403
+ if (min != "00" && itme.time < min) {
404
+ itme.isDisabled = true;
405
+ } else if (max != "00" && itme.time > max) {
406
+ itme.isDisabled = true;
407
+ } else {
408
+ itme.isDisabled = false;
409
+ }
410
+ });
411
+ };
412
+ const resetTimeValue = (time) => {
413
+ const timeValueArr = time.split(":");
414
+ const minTiveArr = minTime.split(":");
415
+ let hh = 0;
416
+ let mm = 0;
417
+ let ss = 0;
418
+ if (format == "hh:mm:ss") {
419
+ hh = parseInt(timeValueArr[0]);
420
+ mm = parseInt(timeValueArr[1]);
421
+ ss = parseInt(timeValueArr[2]);
422
+ timeListDom.value.children[0].lastElementChild.children[0].scrollTop = hh * 32;
423
+ timeListDom.value.children[1].lastElementChild.children[0].scrollTop = mm * 32;
424
+ timeListDom.value.children[2].lastElementChild.children[0].scrollTop = ss * 32;
425
+ activeHour.value = timeValueArr[0];
426
+ activeMinute.value = timeValueArr[1];
427
+ activeSecond.value = timeValueArr[2];
428
+ resetTimeActive(hourListRef, timeValueArr[0]);
429
+ resetTimeActive(minuteListRef, timeValueArr[1]);
430
+ resetTimeActive(secondListRef, timeValueArr[2]);
431
+ resetTimeAstrict(hourListRef, activeHour.value);
432
+ resetTimeAstrict(minuteListRef, activeMinute.value);
433
+ } else if (format == "mm:hh:ss") {
434
+ hh = parseInt(timeValueArr[0]);
435
+ mm = parseInt(timeValueArr[1]);
436
+ ss = parseInt(timeValueArr[2]);
437
+ timeListDom.value.children[0].lastElementChild.children[0].scrollTop = mm * 32;
438
+ timeListDom.value.children[1].lastElementChild.children[0].scrollTop = hh * 32;
439
+ timeListDom.value.children[2].lastElementChild.children[0].scrollTop = ss * 32;
440
+ activeHour.value = timeValueArr[0];
441
+ activeMinute.value = timeValueArr[1];
442
+ activeSecond.value = timeValueArr[2];
443
+ resetTimeActive(hourListRef, timeValueArr[0]);
444
+ resetTimeActive(minuteListRef, timeValueArr[1]);
445
+ resetTimeActive(secondListRef, timeValueArr[2]);
446
+ resetTimeAstrict(hourListRef, activeHour.value);
447
+ resetTimeAstrict(minuteListRef, activeMinute.value);
448
+ } else if (format == "hh:mm") {
449
+ hh = parseInt(timeValueArr[0]);
450
+ mm = parseInt(timeValueArr[1]);
451
+ timeListDom.value.children[0].lastElementChild.children[0].scrollTop = hh * 32;
452
+ timeListDom.value.children[1].lastElementChild.children[0].scrollTop = mm * 32;
453
+ activeHour.value = timeValueArr[0];
454
+ activeMinute.value = timeValueArr[1];
455
+ resetTimeActive(hourListRef, timeValueArr[0]);
456
+ resetTimeActive(minuteListRef, timeValueArr[1]);
457
+ resetTimeAstrict(hourListRef, activeHour.value);
458
+ } else if (format == "mm:ss") {
459
+ mm = parseInt(timeValueArr[1]);
460
+ ss = parseInt(timeValueArr[2]);
461
+ timeListDom.value.children[0].lastElementChild.children[0].scrollTop = mm * 32;
462
+ timeListDom.value.children[1].lastElementChild.children[0].scrollTop = ss * 32;
463
+ activeHour.value = minTiveArr[0];
464
+ activeMinute.value = timeValueArr[1];
465
+ activeSecond.value = timeValueArr[2];
466
+ resetTimeActive(minuteListRef, timeValueArr[1]);
467
+ resetTimeActive(secondListRef, timeValueArr[2]);
468
+ resetTimeAstrict(minuteListRef, activeMinute.value);
469
+ }
470
+ };
471
+ const resetTimeAstrict = (timeArr, time) => {
472
+ timeArr.map((item) => {
473
+ if (item.time == time) {
474
+ getItemAstrict(item);
475
+ }
476
+ });
477
+ };
478
+ const resetTimeActive = (timeArr, itemValue) => {
479
+ timeArr.map((item) => {
480
+ item.isActive = item.time === itemValue;
481
+ });
482
+ };
483
+ const getNewTime = () => {
484
+ return { activeTime, activeHour, activeMinute, activeSecond };
485
+ };
486
+ const resetScrollTop = () => {
487
+ for (let i = 0; i < timeListDom.value.children.length; i++) {
488
+ timeListDom.value.children[i].lastElementChild.children[0].scrollTop = 0;
489
+ }
490
+ };
491
+ return {
492
+ activeTime,
493
+ activeHour,
494
+ activeMinute,
495
+ activeSecond,
496
+ activeTimeFun,
497
+ resetTimeValue,
498
+ getNewTime,
499
+ resetScrollTop
500
+ };
501
+ };
502
+ function useTimeScroll() {
503
+ const scrollBoxDom = ref();
504
+ const scrollContentDom = ref();
505
+ const scrollThumbDom = ref();
506
+ const scrollTrackDom = ref();
507
+ const isDown = ref(false);
508
+ const getScrollHeight = () => {
509
+ const thumbHeight = scrollContentDom.value.clientHeight / scrollContentDom.value.scrollHeight * 100;
510
+ scrollThumbDom.value.style.height = thumbHeight + "%";
511
+ };
512
+ const setVirtualScroll = () => {
513
+ const thumbMoveY = scrollContentDom.value.scrollTop * 100 / scrollContentDom.value.clientHeight;
514
+ scrollThumbDom.value.style.transform = `translateY(${thumbMoveY}%)`;
515
+ };
516
+ const clickTrackFun = (e) => {
517
+ const offsetNum = scrollTrackDom.value.getBoundingClientRect().top - e.clientY;
518
+ const offset = Math.abs(offsetNum > 0 ? 0 : offsetNum);
519
+ const thumbCenter = scrollThumbDom.value.offsetHeight / 2;
520
+ const thumbPosition = (offset - thumbCenter) * 100 / scrollContentDom.value.offsetHeight;
521
+ scrollContentDom.value.scrollTop = thumbPosition * scrollContentDom.value.scrollHeight / 100;
522
+ scrollContentDom.value.style.top = scrollContentDom.value.scrollTop + "px";
523
+ };
524
+ const mouseDownThum = () => {
525
+ isDown.value = true;
526
+ scrollTrackDom.value.style.opacity = 1;
527
+ };
528
+ const mouseOutThum = (e) => {
529
+ isDown.value = false;
530
+ thumbMouseMove(e);
531
+ };
532
+ const thumbMouseMove = (e) => {
533
+ const path = e.composedPath && e.composedPath() || e.path;
534
+ if (path.includes(scrollBoxDom.value) || isDown.value) {
535
+ scrollTrackDom.value.style.opacity = 1;
536
+ } else {
537
+ scrollTrackDom.value.style.opacity = 0;
538
+ }
539
+ if (!isDown.value)
540
+ return;
541
+ clickTrackFun(e);
542
+ };
543
+ const getScrollWidth = () => {
544
+ const ua = navigator.userAgent;
545
+ let marginRight = -20;
546
+ if (ua.indexOf("Chrome") > -1) {
547
+ marginRight = -8;
548
+ } else {
549
+ const outer = document.createElement("div");
550
+ outer.className = "devui-scrollbar-wrap";
551
+ outer.style.width = "100px";
552
+ outer.style.visibility = "hidden";
553
+ outer.style.position = "absolute";
554
+ outer.style.top = "-9999px";
555
+ document.body.appendChild(outer);
556
+ const widthNoScroll = outer.offsetWidth;
557
+ outer.style.overflow = "scroll";
558
+ const inner = document.createElement("div");
559
+ inner.style.width = "100%";
560
+ outer.appendChild(inner);
561
+ const widthWithScroll = inner.offsetWidth;
562
+ outer.parentNode.removeChild(outer);
563
+ marginRight = (widthNoScroll - widthWithScroll + 3) * -1;
564
+ }
565
+ return marginRight;
566
+ };
567
+ return {
568
+ scrollThumbDom,
569
+ scrollTrackDom,
570
+ scrollContentDom,
571
+ scrollBoxDom,
572
+ isDown,
573
+ getScrollHeight,
574
+ setVirtualScroll,
575
+ clickTrackFun,
576
+ mouseDownThum,
577
+ mouseOutThum,
578
+ thumbMouseMove,
579
+ getScrollWidth
580
+ };
581
+ }
582
+ var index$3 = "";
583
+ var TimeScroll = defineComponent({
584
+ name: "DTimeScroll",
585
+ props: timePickerProps,
586
+ setup(props, ctx) {
587
+ const {
588
+ scrollBoxDom,
589
+ scrollThumbDom,
590
+ scrollTrackDom,
591
+ scrollContentDom,
592
+ isDown,
593
+ getScrollHeight,
594
+ setVirtualScroll,
595
+ clickTrackFun,
596
+ mouseDownThum,
597
+ mouseOutThum,
598
+ thumbMouseMove,
599
+ getScrollWidth
600
+ } = useTimeScroll();
601
+ const marginRight = getScrollWidth();
602
+ onMounted(() => {
603
+ getScrollWidth();
604
+ getScrollHeight();
605
+ scrollBoxDom.value.addEventListener("click", setVirtualScroll);
606
+ scrollContentDom.value.addEventListener("scroll", setVirtualScroll);
607
+ scrollThumbDom.value.addEventListener("mousedown", mouseDownThum);
608
+ document.addEventListener("mouseup", mouseOutThum);
609
+ document.addEventListener("mousemove", thumbMouseMove);
610
+ });
611
+ onBeforeUnmount(() => {
612
+ scrollBoxDom.value.removeEventListener("click", setVirtualScroll);
613
+ scrollContentDom.value.removeEventListener("scroll", setVirtualScroll);
614
+ scrollThumbDom.value.removeEventListener("mousedown", mouseDownThum);
615
+ });
616
+ onUnmounted(() => {
617
+ document.removeEventListener("mouseup", mouseOutThum);
618
+ document.removeEventListener("mousemove", thumbMouseMove);
619
+ });
620
+ return () => {
621
+ var _a, _b;
622
+ return createVNode(Fragment, null, [createVNode("div", {
623
+ "ref": scrollBoxDom,
624
+ "class": "devui-scroll-box"
625
+ }, [createVNode("div", {
626
+ "ref": scrollContentDom,
627
+ "class": `box-content ${isDown.value || !props.showAnimation ? "box-content-behavior-auto" : ""}`,
628
+ "style": {
629
+ "margin-right": marginRight + "px"
630
+ }
631
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]), createVNode("div", {
632
+ "ref": scrollTrackDom,
633
+ "class": "box-sroll",
634
+ "onClick": clickTrackFun
635
+ }, [createVNode("div", {
636
+ "ref": scrollThumbDom,
637
+ "class": "scroll-child"
638
+ }, null)])])]);
639
+ };
640
+ }
641
+ });
642
+ var index$2 = "";
643
+ var TimeList = defineComponent({
644
+ name: "DTimeList",
645
+ components: {
646
+ TimeScroll
647
+ },
648
+ props: {
649
+ hourList: {
650
+ type: Array,
651
+ default: () => []
652
+ },
653
+ minuteList: {
654
+ type: Array,
655
+ default: () => []
656
+ },
657
+ secondList: {
658
+ type: Array,
659
+ default: () => []
660
+ },
661
+ format: {
662
+ type: String,
663
+ default: "hh:mm:ss"
664
+ },
665
+ minTime: {
666
+ type: String,
667
+ default: "00:00:00"
668
+ },
669
+ maxTime: {
670
+ type: String,
671
+ default: "23:59:59"
672
+ }
673
+ },
674
+ setup(props, ctx) {
675
+ const timeListDom = ref();
676
+ const {
677
+ getNewTime,
678
+ activeTimeFun,
679
+ resetTimeValue,
680
+ resetScrollTop
681
+ } = usePopupLine(props.hourList, props.minuteList, props.secondList, props.minTime, props.maxTime, props.format, timeListDom);
682
+ const setOutoTime = (time) => {
683
+ resetTimeValue(time);
684
+ };
685
+ const TimeLi = (timeArr) => {
686
+ return timeArr.map((item, index2) => {
687
+ return createVNode("li", {
688
+ "class": `time-li ${item.flag}Id-${index2} ${item.isActive ? "active-li" : ""} ${item.isDisabled ? "disabled-li" : ""}`,
689
+ "onClick": (e) => {
690
+ activeTimeFun(e, item, index2);
691
+ }
692
+ }, [createVNode("span", null, [item.time])]);
693
+ });
694
+ };
695
+ const TimeUl = (timeList) => {
696
+ return createVNode("div", {
697
+ "class": "time-item",
698
+ "style": {
699
+ "flex": 1
700
+ }
701
+ }, [createVNode(TimeScroll, null, {
702
+ default: () => [createVNode("ul", {
703
+ "class": "time-ul"
704
+ }, [TimeLi(timeList)])]
705
+ })]);
706
+ };
707
+ const formatTimeUl = () => {
708
+ const timeList = {
709
+ "hh": props.hourList,
710
+ "mm": props.minuteList,
711
+ "ss": props.secondList
712
+ };
713
+ const timeFormatArr = props.format.split(":");
714
+ return timeFormatArr.map((timeItme) => {
715
+ return TimeUl(timeList[timeItme]);
716
+ });
717
+ };
718
+ ctx.expose({
719
+ resetScrollTop,
720
+ setOutoTime,
721
+ getNewTime
722
+ });
723
+ return () => {
724
+ return createVNode("div", {
725
+ "class": "devui-time-list",
726
+ "ref": timeListDom
727
+ }, [formatTimeUl()]);
728
+ };
729
+ }
730
+ });
731
+ const buttonProps = {
732
+ type: {
733
+ type: String,
734
+ default: "button"
735
+ },
736
+ btnStyle: {
737
+ type: String,
738
+ default: "primary"
739
+ },
740
+ size: {
741
+ type: String,
742
+ default: "md"
743
+ },
744
+ position: {
745
+ type: String,
746
+ default: "default"
747
+ },
748
+ bordered: {
749
+ type: Boolean,
750
+ default: false
751
+ },
752
+ icon: {
753
+ type: String,
754
+ default: ""
755
+ },
756
+ showLoading: {
757
+ type: Boolean,
758
+ default: false
759
+ },
760
+ width: {
761
+ type: String
762
+ },
763
+ disabled: {
764
+ type: Boolean,
765
+ default: false
766
+ },
767
+ autofocus: {
768
+ type: Boolean,
769
+ default: false
770
+ },
771
+ onClick: {
772
+ type: Function
773
+ }
774
+ };
775
+ var button = "";
776
+ var Button = defineComponent({
777
+ name: "DButton",
778
+ props: buttonProps,
779
+ setup(props, ctx) {
780
+ const buttonContent = ref(null);
781
+ const onClick = (e) => {
782
+ var _a;
783
+ if (props.showLoading) {
784
+ return;
785
+ }
786
+ (_a = props.onClick) == null ? void 0 : _a.call(props, e);
787
+ };
788
+ const hasContent = computed(() => ctx.slots.default);
789
+ const btnClass = computed(() => {
790
+ const {
791
+ btnStyle,
792
+ size,
793
+ position,
794
+ bordered,
795
+ icon
796
+ } = props;
797
+ const origin = `devui-btn devui-btn-${btnStyle} devui-btn-${size} devui-btn-${position}`;
798
+ const borderedClass = bordered ? "bordered" : "";
799
+ const btnIcon = !!icon && !hasContent.value && btnStyle !== "primary" ? "d-btn-icon" : "";
800
+ const btnIconWrap = !!icon ? "d-btn-icon-wrap" : "";
801
+ return `${origin} ${borderedClass} ${btnIcon} ${btnIconWrap}`;
802
+ });
803
+ const iconClass = computed(() => {
804
+ if (!props.icon) {
805
+ return;
806
+ }
807
+ const origin = "devui-icon-fix icon";
808
+ if (hasContent.value) {
809
+ return `${origin} clear-right-5`;
810
+ } else {
811
+ return origin;
812
+ }
813
+ });
814
+ return () => {
815
+ var _a, _b;
816
+ const {
817
+ icon,
818
+ type,
819
+ disabled,
820
+ showLoading,
821
+ width
822
+ } = props;
823
+ return withDirectives(createVNode("div", mergeProps({
824
+ "class": "devui-btn-host"
825
+ }, ctx.attrs), [createVNode("button", {
826
+ "class": btnClass.value,
827
+ "type": type,
828
+ "disabled": disabled,
829
+ "style": {
830
+ width
831
+ },
832
+ "onClick": onClick
833
+ }, [!!icon ? createVNode(Icon, {
834
+ "name": icon,
835
+ "class": iconClass.value
836
+ }, null) : null, createVNode("span", {
837
+ "class": "button-content",
838
+ "ref": buttonContent
839
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])])]), [[resolveDirective("dLoading"), showLoading]]);
840
+ };
841
+ }
842
+ });
843
+ class View {
844
+ constructor() {
845
+ __publicField(this, "top", "50%");
846
+ __publicField(this, "left", "50%");
847
+ }
848
+ }
849
+ const componentProps = {
850
+ message: String,
851
+ backdrop: Boolean,
852
+ view: {
853
+ type: Object,
854
+ default: () => new View()
855
+ },
856
+ zIndex: Number,
857
+ isFull: {
858
+ type: Boolean,
859
+ default: false
860
+ }
861
+ };
862
+ class LoadingProps {
863
+ constructor() {
864
+ __publicField(this, "target");
865
+ __publicField(this, "message");
866
+ __publicField(this, "loadingTemplateRef");
867
+ __publicField(this, "backdrop", true);
868
+ __publicField(this, "positionType", "relative");
869
+ __publicField(this, "view", new View());
870
+ __publicField(this, "zIndex");
871
+ }
872
+ }
873
+ var loading = "";
874
+ var Loading = defineComponent({
875
+ name: "DLoading",
876
+ inheritAttrs: false,
877
+ props: componentProps,
878
+ setup(props) {
879
+ const style = {
880
+ top: props.view.top,
881
+ left: props.view.left,
882
+ zIndex: props.zIndex
883
+ };
884
+ if (!props.message) {
885
+ style.background = "none";
886
+ }
887
+ const isShow = ref(false);
888
+ const open = () => {
889
+ isShow.value = true;
890
+ };
891
+ const close = () => {
892
+ isShow.value = false;
893
+ };
894
+ return {
895
+ style,
896
+ isShow,
897
+ open,
898
+ close
899
+ };
900
+ },
901
+ render() {
902
+ var _a;
903
+ const {
904
+ isShow,
905
+ isFull,
906
+ backdrop,
907
+ style,
908
+ message,
909
+ $slots
910
+ } = this;
911
+ return isShow && createVNode("div", {
912
+ "class": ["devui-loading-contanier", isFull ? "devui-loading--full" : ""]
913
+ }, [((_a = $slots.default) == null ? void 0 : _a.call($slots)) || createVNode("div", {
914
+ "class": "devui-loading-wrapper"
915
+ }, [backdrop ? createVNode("div", {
916
+ "class": "devui-loading-mask"
917
+ }, null) : null, createVNode("div", {
918
+ "style": style,
919
+ "class": "devui-loading-area"
920
+ }, [createVNode("div", {
921
+ "class": "devui-busy-default-spinner"
922
+ }, [createVNode("div", {
923
+ "class": "devui-loading-bar1"
924
+ }, null), createVNode("div", {
925
+ "class": "devui-loading-bar2"
926
+ }, null), createVNode("div", {
927
+ "class": "devui-loading-bar3"
928
+ }, null), createVNode("div", {
929
+ "class": "devui-loading-bar4"
930
+ }, null)]), message ? createVNode("span", {
931
+ "class": "devui-loading-text"
932
+ }, [message]) : null])])]);
933
+ }
934
+ });
935
+ const COMPONENT_CONTAINER_SYMBOL = Symbol("dev_component_container");
936
+ function createComponent(Component, props, children = null) {
937
+ const vnode = h(Component, __spreadValues({}, props), children);
938
+ const container = document.createElement("div");
939
+ vnode[COMPONENT_CONTAINER_SYMBOL] = container;
940
+ render(vnode, container);
941
+ return vnode.component;
942
+ }
943
+ function unmountComponent(ComponnetInstance) {
944
+ render(null, ComponnetInstance == null ? void 0 : ComponnetInstance.vnode[COMPONENT_CONTAINER_SYMBOL]);
945
+ }
946
+ const loadingConstructor = defineComponent(Loading);
947
+ const cacheInstance = new WeakSet();
948
+ const isEmpty = (val) => {
949
+ if (!val)
950
+ return true;
951
+ if (Array.isArray(val))
952
+ return val.length === 0;
953
+ if (val instanceof Set || val instanceof Map)
954
+ return val.size === 0;
955
+ if (val instanceof Promise)
956
+ return false;
957
+ if (typeof val === "object") {
958
+ try {
959
+ return Object.keys(val).length === 0;
960
+ } catch (e) {
961
+ return false;
962
+ }
963
+ }
964
+ return false;
965
+ };
966
+ const getType = (vari) => {
967
+ return Object.prototype.toString.call(vari).slice(8, -1).toLowerCase();
968
+ };
969
+ const isPromise = (value) => {
970
+ const type = getType(value);
971
+ switch (type) {
972
+ case "promise":
973
+ return [value];
974
+ case "array":
975
+ if (value.some((val) => getType(val) !== "promise")) {
976
+ console.error(new TypeError("Binding values should all be of type Promise"));
977
+ return "error";
978
+ }
979
+ return value;
980
+ default:
981
+ return false;
982
+ }
983
+ };
984
+ const unmount = (el) => {
985
+ cacheInstance.delete(el);
986
+ el.instance.proxy.close();
987
+ unmountComponent(el.instance);
988
+ };
989
+ const toggleLoading = (el, binding) => {
990
+ if (binding.value) {
991
+ const vals = isPromise(binding.value);
992
+ if (vals === "error")
993
+ return;
994
+ el.instance.proxy.open();
995
+ el.appendChild(el.mask);
996
+ cacheInstance.add(el);
997
+ if (vals) {
998
+ Promise.all(vals).catch((err) => {
999
+ console.error(new Error("Promise handling errors"), err);
1000
+ }).finally(() => {
1001
+ unmount(el);
1002
+ });
1003
+ }
1004
+ } else {
1005
+ unmount(el);
1006
+ }
1007
+ };
1008
+ const removeAttribute = (el) => {
1009
+ el.removeAttribute("zindex");
1010
+ el.removeAttribute("positiontype");
1011
+ el.removeAttribute("backdrop");
1012
+ el.removeAttribute("message");
1013
+ el.removeAttribute("view");
1014
+ el.removeAttribute("loadingtemplateref");
1015
+ };
1016
+ const handleProps = (el, vprops) => {
1017
+ const props = __spreadValues(__spreadValues({}, new LoadingProps()), vprops);
1018
+ const loadingTemplateRef = props.loadingTemplateRef;
1019
+ const loadingInstance = createComponent(loadingConstructor, __spreadValues({}, props), loadingTemplateRef ? () => loadingTemplateRef : null);
1020
+ el.style.position = props.positionType;
1021
+ el.options = props;
1022
+ el.instance = loadingInstance;
1023
+ el.mask = loadingInstance.proxy.$el;
1024
+ };
1025
+ const loadingDirective = {
1026
+ mounted: function(el, binding, vnode) {
1027
+ handleProps(el, vnode.props);
1028
+ removeAttribute(el);
1029
+ !isEmpty(binding.value) && toggleLoading(el, binding);
1030
+ },
1031
+ updated: function(el, binding, vnode) {
1032
+ if (!isEmpty(binding.value) && cacheInstance.has(el) || isEmpty(binding.value) && !cacheInstance.has(el))
1033
+ return;
1034
+ !cacheInstance.has(el) && handleProps(el, vnode.props);
1035
+ removeAttribute(el);
1036
+ toggleLoading(el, binding);
1037
+ }
1038
+ };
1039
+ defineComponent(Loading);
1040
+ Button.install = function(app) {
1041
+ app.directive("dLoading", loadingDirective);
1042
+ app.component(Button.name, Button);
1043
+ };
1044
+ var index$1 = "";
1045
+ var TimePopup = defineComponent({
1046
+ name: "DTimePopup",
1047
+ components: {
1048
+ TimeList,
1049
+ Button
1050
+ },
1051
+ props: {
1052
+ showPopup: {
1053
+ type: Boolean,
1054
+ default: false
1055
+ },
1056
+ popupTop: {
1057
+ type: Number,
1058
+ default: -100
1059
+ },
1060
+ popupLeft: {
1061
+ type: Number,
1062
+ default: -100
1063
+ },
1064
+ popupWidth: {
1065
+ type: Number,
1066
+ default: 300
1067
+ },
1068
+ popupFormat: {
1069
+ type: String,
1070
+ default: "hh:mm:ss"
1071
+ },
1072
+ minTime: {
1073
+ type: String,
1074
+ default: "00:00:00"
1075
+ },
1076
+ maxTime: {
1077
+ type: String,
1078
+ default: "23:59:59"
1079
+ },
1080
+ bindData: {
1081
+ type: String,
1082
+ default: "00:00:00"
1083
+ }
1084
+ },
1085
+ emits: ["subData"],
1086
+ setup(props, ctx) {
1087
+ const popupDome = ref();
1088
+ const timeListDom = ref();
1089
+ const hourList = initializeTimeData("hour");
1090
+ const minuteList = initializeTimeData("minute");
1091
+ const secondList = initializeTimeData("second");
1092
+ onMounted(() => {
1093
+ setTimeAstrict(hourList, minuteList, secondList, props.minTime, props.maxTime, props.popupFormat);
1094
+ });
1095
+ watch(() => [props.showPopup, props.bindData], ([showPopup, newTimeVal], [oldShowPopup, oldTimeVal]) => {
1096
+ if (showPopup || newTimeVal != oldTimeVal) {
1097
+ timeListDom.value.setOutoTime(newTimeVal);
1098
+ } else {
1099
+ timeListDom.value.resetScrollTop();
1100
+ }
1101
+ });
1102
+ const changTimeData = () => {
1103
+ return timeListDom.value.getNewTime();
1104
+ };
1105
+ const subDataFun = (e) => {
1106
+ e.stopPropagation();
1107
+ ctx.emit("subData");
1108
+ };
1109
+ ctx.expose({
1110
+ changTimeData
1111
+ });
1112
+ return () => {
1113
+ var _a, _b;
1114
+ return createVNode(Fragment, null, [createVNode("div", {
1115
+ "ref": popupDome,
1116
+ "class": `devui-time-popup ${props.showPopup ? "devui-show-time-popup" : ""}`,
1117
+ "style": {
1118
+ "width": props.popupWidth + "px",
1119
+ "top": props.popupTop + "px",
1120
+ "left": props.popupLeft + "px"
1121
+ }
1122
+ }, [createVNode(TimeList, {
1123
+ "ref": timeListDom,
1124
+ "hourList": hourList,
1125
+ "minuteList": minuteList,
1126
+ "secondList": secondList,
1127
+ "minTime": props.minTime,
1128
+ "maxTime": props.maxTime,
1129
+ "format": props.popupFormat
1130
+ }, null), createVNode("div", {
1131
+ "class": "devui-time-popup-btn"
1132
+ }, [createVNode("div", {
1133
+ "class": "popup-slots"
1134
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]), createVNode("div", {
1135
+ "onClick": subDataFun
1136
+ }, [createVNode(Button, {
1137
+ "btnStyle": "common"
1138
+ }, {
1139
+ default: () => [createTextVNode("\u786E\u5B9A")]
1140
+ })])])])]);
1141
+ };
1142
+ }
1143
+ });
1144
+ var timePicker = "";
1145
+ var TimePicker = defineComponent({
1146
+ name: "DTimePicker",
1147
+ components: {
1148
+ TimePopup
1149
+ },
1150
+ props: timePickerProps,
1151
+ emits: ["selectedTimeChage", "update:modelValue"],
1152
+ setup(props, ctx) {
1153
+ const activeHour = ref("00");
1154
+ const activeMinute = ref("00");
1155
+ const activeSecond = ref("00");
1156
+ const format = props.format.toLowerCase();
1157
+ const {
1158
+ isActive,
1159
+ showPopup,
1160
+ devuiTimePicker,
1161
+ inputDom,
1162
+ left,
1163
+ top,
1164
+ showClearIcon,
1165
+ firsthandActiveTime,
1166
+ chooseTime,
1167
+ getTimeValue,
1168
+ clickVerifyFun,
1169
+ isOutOpen,
1170
+ vModelIsBeyond,
1171
+ clearAll,
1172
+ timePopupDom,
1173
+ vModeValue,
1174
+ getPopupPosition
1175
+ } = useTimePicker(activeHour, activeMinute, activeSecond, props.minTime, props.maxTime, format, props.autoOpen, props.disabled, props.modelValue);
1176
+ const selectedTimeChage = (e) => {
1177
+ isActive.value = false;
1178
+ showPopup.value = false;
1179
+ ctx.emit("selectedTimeChage", vModeValue.value);
1180
+ };
1181
+ onMounted(() => {
1182
+ getPopupPosition();
1183
+ isOutOpen();
1184
+ vModelIsBeyond();
1185
+ document.addEventListener("click", clickVerifyFun);
1186
+ document.addEventListener("click", getTimeValue);
1187
+ document.addEventListener("scroll", getPopupPosition);
1188
+ window.addEventListener("resize", getPopupPosition);
1189
+ });
1190
+ onUnmounted(() => {
1191
+ document.removeEventListener("click", clickVerifyFun);
1192
+ document.removeEventListener("click", getTimeValue);
1193
+ document.removeEventListener("scroll", getPopupPosition);
1194
+ window.removeEventListener("resize", getPopupPosition);
1195
+ });
1196
+ watch(vModeValue, (newValue) => {
1197
+ ctx.emit("update:modelValue", vModeValue.value);
1198
+ if (newValue != props.minTime && newValue != "00:00") {
1199
+ showClearIcon.value = true;
1200
+ } else {
1201
+ showClearIcon.value = false;
1202
+ }
1203
+ });
1204
+ ctx.expose({
1205
+ clearAll,
1206
+ chooseTime
1207
+ });
1208
+ return () => {
1209
+ return createVNode(Fragment, null, [createVNode("div", {
1210
+ "class": `devui-time-picker ${isActive.value ? "time-picker-active" : ""} ${props.disabled ? "picker-disabled" : ""}`,
1211
+ "ref": devuiTimePicker
1212
+ }, [createVNode(TimePopup, {
1213
+ "ref": timePopupDom,
1214
+ "showPopup": showPopup.value,
1215
+ "popupTop": top.value,
1216
+ "popupLeft": left.value,
1217
+ "popupWidth": props.timePickerWidth,
1218
+ "popupFormat": props.format.toLowerCase(),
1219
+ "minTime": props.minTime,
1220
+ "maxTime": props.maxTime,
1221
+ "bindData": firsthandActiveTime.value,
1222
+ "onSubData": selectedTimeChage
1223
+ }, {
1224
+ default: () => {
1225
+ var _a, _b;
1226
+ return [(_b = (_a = ctx.slots).customViewTemplate) == null ? void 0 : _b.call(_a)];
1227
+ }
1228
+ }), createVNode("input", {
1229
+ "ref": inputDom,
1230
+ "type": "text",
1231
+ "value": vModeValue.value,
1232
+ "placeholder": `${props.placeholder}`,
1233
+ "disabled": props.disabled,
1234
+ "class": "time-input"
1235
+ }, null), createVNode("div", {
1236
+ "class": "time-input-icon"
1237
+ }, [createVNode("div", {
1238
+ "onClick": clearAll
1239
+ }, [showClearIcon.value ? createVNode(Icon, {
1240
+ "size": "small",
1241
+ "name": "close"
1242
+ }, null) : ""]), createVNode("div", null, [createVNode(Icon, {
1243
+ "size": "small",
1244
+ "name": "time"
1245
+ }, null)])])])]);
1246
+ };
1247
+ }
1248
+ });
1249
+ TimePicker.install = function(app) {
1250
+ app.component(TimePicker.name, TimePicker);
1251
+ };
1252
+ var index = {
1253
+ title: "TimePicker \u65F6\u95F4\u9009\u62E9\u5668",
1254
+ category: "\u6570\u636E\u5F55\u5165",
1255
+ status: "90%",
1256
+ install(app) {
1257
+ app.use(TimePicker);
1258
+ }
1259
+ };
1260
+ export { TimePicker, index as default };