vue-devui 1.0.0-alpha.4 → 1.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion/index.d.ts +7 -0
- package/accordion/index.es.js +237 -1
- package/accordion/index.umd.js +1 -1
- package/accordion/style.css +1 -1
- package/alert/index.d.ts +7 -0
- package/alert/index.es.js +175 -1
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/anchor/index.d.ts +7 -0
- package/anchor/index.es.js +263 -1
- package/anchor/index.umd.js +1 -1
- package/avatar/index.d.ts +7 -0
- package/avatar/index.es.js +301 -1
- package/avatar/index.umd.js +1 -1
- package/back-top/index.d.ts +7 -0
- package/back-top/index.es.js +128 -0
- package/back-top/index.umd.js +1 -0
- package/back-top/package.json +7 -0
- package/back-top/style.css +1 -0
- package/badge/index.d.ts +7 -0
- package/badge/index.es.js +95 -1
- package/badge/index.umd.js +1 -1
- package/breadcrumb/index.d.ts +7 -0
- package/breadcrumb/index.es.js +127 -1
- package/breadcrumb/index.umd.js +1 -1
- package/breadcrumb/style.css +1 -1
- package/button/index.d.ts +7 -0
- package/button/index.es.js +190 -1
- package/button/index.umd.js +1 -1
- package/card/index.d.ts +7 -0
- package/card/index.es.js +61 -1
- package/card/index.umd.js +1 -1
- package/carousel/index.d.ts +7 -0
- package/carousel/index.es.js +329 -1
- package/carousel/index.umd.js +1 -1
- package/cascader/index.d.ts +7 -0
- package/cascader/index.es.js +1343 -1
- package/cascader/index.umd.js +1 -1
- package/cascader/style.css +1 -1
- package/checkbox/index.d.ts +7 -0
- package/checkbox/index.es.js +377 -1
- package/checkbox/index.umd.js +1 -1
- package/comment/index.d.ts +7 -0
- package/comment/index.es.js +85 -0
- package/comment/index.umd.js +1 -0
- package/comment/package.json +7 -0
- package/comment/style.css +1 -0
- package/countdown/index.d.ts +7 -0
- package/countdown/index.es.js +176 -0
- package/countdown/index.umd.js +1 -0
- package/countdown/package.json +7 -0
- package/countdown/style.css +1 -0
- package/date-picker/index.d.ts +7 -0
- package/date-picker/index.es.js +1172 -1
- package/date-picker/index.umd.js +1 -1
- package/date-picker/style.css +1 -1
- package/dragdrop/index.d.ts +7 -0
- package/dragdrop/index.es.js +32 -0
- package/dragdrop/index.umd.js +1 -0
- package/dragdrop/package.json +7 -0
- package/drawer/index.d.ts +7 -0
- package/drawer/index.es.js +288 -0
- package/drawer/index.umd.js +1 -0
- package/drawer/package.json +7 -0
- package/drawer/style.css +1 -0
- package/dropdown/index.d.ts +7 -0
- package/dropdown/index.es.js +527 -0
- package/dropdown/index.umd.js +1 -0
- package/dropdown/package.json +7 -0
- package/dropdown/style.css +1 -0
- package/editable-select/index.d.ts +7 -0
- package/editable-select/index.es.js +5793 -1
- package/editable-select/index.umd.js +27 -1
- package/editable-select/style.css +1 -1
- package/form/index.d.ts +7 -0
- package/form/index.es.js +2244 -0
- package/form/index.umd.js +1 -0
- package/form/package.json +7 -0
- package/form/style.css +1 -0
- package/fullscreen/index.d.ts +7 -0
- package/fullscreen/index.es.js +163 -1
- package/fullscreen/index.umd.js +1 -1
- package/gantt/index.d.ts +7 -0
- package/gantt/index.es.js +535 -0
- package/gantt/index.umd.js +1 -0
- package/gantt/package.json +7 -0
- package/gantt/style.css +1 -0
- package/grid/index.d.ts +7 -0
- package/grid/index.es.js +269 -0
- package/grid/index.umd.js +1 -0
- package/grid/package.json +7 -0
- package/grid/style.css +1 -0
- package/icon/index.d.ts +7 -0
- package/icon/index.es.js +75 -1
- package/icon/index.umd.js +1 -1
- package/image-preview/index.d.ts +7 -0
- package/image-preview/index.es.js +480 -1
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/index.d.ts +7 -0
- package/input/index.d.ts +7 -0
- package/input/index.es.js +190 -1
- package/input/index.umd.js +1 -1
- package/input-icon/index.d.ts +7 -0
- package/input-icon/index.es.js +332 -0
- package/input-icon/index.umd.js +1 -0
- package/input-icon/package.json +7 -0
- package/input-icon/style.css +1 -0
- package/input-number/index.d.ts +7 -0
- package/input-number/index.es.js +240 -1
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.d.ts +7 -0
- package/layout/index.es.js +100 -0
- package/layout/index.umd.js +1 -0
- package/layout/package.json +7 -0
- package/layout/style.css +1 -0
- package/loading/index.d.ts +7 -0
- package/loading/index.es.js +256 -1
- package/loading/index.umd.js +1 -1
- package/modal/index.d.ts +7 -0
- package/modal/index.es.js +1027 -1
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/nav-sprite/index.d.ts +7 -0
- package/nav-sprite/index.es.js +742 -0
- package/nav-sprite/index.umd.js +1 -0
- package/nav-sprite/package.json +7 -0
- package/nuxt/components/Accordion.js +3 -0
- package/nuxt/components/Alert.js +3 -0
- package/nuxt/components/Anchor.js +3 -0
- package/nuxt/components/Aside.js +3 -0
- package/nuxt/components/Avatar.js +3 -0
- package/nuxt/components/BackTop.js +3 -0
- package/nuxt/components/Badge.js +3 -0
- package/nuxt/components/Breadcrumb.js +3 -0
- package/nuxt/components/Button.js +3 -0
- package/nuxt/components/Card.js +3 -0
- package/nuxt/components/Carousel.js +3 -0
- package/nuxt/components/Cascader.js +3 -0
- package/nuxt/components/Checkbox.js +3 -0
- package/nuxt/components/Col.js +3 -0
- package/nuxt/components/Column.js +3 -0
- package/nuxt/components/Comment.js +3 -0
- package/nuxt/components/Content.js +3 -0
- package/nuxt/components/Countdown.js +3 -0
- package/nuxt/components/DatePicker.js +3 -0
- package/nuxt/components/Drawer.js +3 -0
- package/nuxt/components/Dropdown.js +3 -0
- package/nuxt/components/EditableSelect.js +3 -0
- package/nuxt/components/FixedOverlay.js +3 -0
- package/nuxt/components/FlexibleOverlay.js +3 -0
- package/nuxt/components/Footer.js +3 -0
- package/nuxt/components/Form.js +3 -0
- package/nuxt/components/FormControl.js +3 -0
- package/nuxt/components/FormItem.js +3 -0
- package/nuxt/components/FormLabel.js +3 -0
- package/nuxt/components/FormOperation.js +3 -0
- package/nuxt/components/Fullscreen.js +3 -0
- package/nuxt/components/Gantt.js +3 -0
- package/nuxt/components/Header.js +3 -0
- package/nuxt/components/Icon.js +2 -0
- package/nuxt/components/ImagePreviewService.js +3 -0
- package/nuxt/components/Input.js +3 -0
- package/nuxt/components/InputIcon.js +3 -0
- package/nuxt/components/InputNumber.js +3 -0
- package/nuxt/components/Layout.js +3 -0
- package/nuxt/components/Loading.js +3 -0
- package/nuxt/components/LoadingService.js +3 -0
- package/nuxt/components/Modal.js +3 -0
- package/nuxt/components/MultiUpload.js +3 -0
- package/nuxt/components/NavSprite.js +2 -0
- package/nuxt/components/Pagination.js +3 -0
- package/nuxt/components/Panel.js +3 -0
- package/nuxt/components/Popover.js +3 -0
- package/nuxt/components/Progress.js +3 -0
- package/nuxt/components/QuadrantDiagram.js +3 -0
- package/nuxt/components/Radio.js +3 -0
- package/nuxt/components/RadioGroup.js +3 -0
- package/nuxt/components/Rate.js +3 -0
- package/nuxt/components/ReadTip.js +3 -0
- package/nuxt/components/Result.js +3 -0
- package/nuxt/components/Row.js +3 -0
- package/nuxt/components/Search.js +3 -0
- package/nuxt/components/Select.js +3 -0
- package/nuxt/components/Skeleton.js +3 -0
- package/nuxt/components/SkeletonItem.js +3 -0
- package/nuxt/components/Slider.js +3 -0
- package/nuxt/components/Splitter.js +3 -0
- package/nuxt/components/Statistic.js +3 -0
- package/nuxt/components/Status.js +3 -0
- package/nuxt/components/StepsGuide.js +3 -0
- package/nuxt/components/StickSlider.js +3 -0
- package/nuxt/components/Sticky.js +2 -0
- package/nuxt/components/Switch.js +3 -0
- package/nuxt/components/Table.js +3 -0
- package/nuxt/components/Tabs.js +3 -0
- package/nuxt/components/Tag.js +3 -0
- package/nuxt/components/TagInput.js +3 -0
- package/nuxt/components/Textarea.js +3 -0
- package/nuxt/components/TimeAxis.js +3 -0
- package/nuxt/components/TimeAxisItem.js +3 -0
- package/nuxt/components/TimePicker.js +3 -0
- package/nuxt/components/Toast.js +3 -0
- package/nuxt/components/ToastService.js +3 -0
- package/nuxt/components/Tooltip.js +3 -0
- package/nuxt/components/Transfer.js +3 -0
- package/nuxt/components/Tree.js +3 -0
- package/nuxt/components/TreeSelect.js +3 -0
- package/nuxt/components/Upload.js +3 -0
- package/nuxt/components/buttonProps.js +3 -0
- package/nuxt/index.js +13 -0
- package/overlay/index.d.ts +7 -0
- package/overlay/index.es.js +368 -1
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +8 -33
- package/pagination/index.d.ts +7 -0
- package/pagination/index.es.js +642 -1
- package/pagination/index.umd.js +1 -1
- package/panel/index.d.ts +7 -0
- package/panel/index.es.js +205 -1
- package/panel/index.umd.js +1 -1
- package/panel/style.css +1 -1
- package/popover/index.d.ts +7 -0
- package/popover/index.es.js +236 -1
- package/popover/index.umd.js +1 -1
- package/popover/style.css +1 -1
- package/progress/index.d.ts +7 -0
- package/progress/index.es.js +153 -1
- package/progress/index.umd.js +3 -1
- package/quadrant-diagram/index.d.ts +7 -0
- package/quadrant-diagram/index.es.js +489 -1
- package/quadrant-diagram/index.umd.js +1 -1
- package/radio/index.d.ts +7 -0
- package/radio/index.es.js +225 -1
- package/radio/index.umd.js +1 -1
- package/rate/index.d.ts +7 -0
- package/rate/index.es.js +220 -1
- package/rate/index.umd.js +1 -1
- package/read-tip/index.d.ts +7 -0
- package/read-tip/index.es.js +258 -0
- package/read-tip/index.umd.js +1 -0
- package/read-tip/package.json +7 -0
- package/read-tip/style.css +1 -0
- package/result/index.d.ts +7 -0
- package/result/index.es.js +119 -0
- package/result/index.umd.js +1 -0
- package/result/package.json +7 -0
- package/result/style.css +1 -0
- package/ripple/index.d.ts +7 -0
- package/ripple/index.es.js +181 -1
- package/ripple/index.umd.js +1 -1
- package/search/index.d.ts +7 -0
- package/search/index.es.js +543 -1
- package/search/index.umd.js +1 -1
- package/select/index.d.ts +7 -0
- package/select/index.es.js +706 -1
- package/select/index.umd.js +1 -1
- package/skeleton/index.d.ts +7 -0
- package/skeleton/index.es.js +297 -1
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.d.ts +7 -0
- package/slider/index.es.js +199 -1
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.d.ts +7 -0
- package/splitter/index.es.js +636 -1
- package/splitter/index.umd.js +1 -1
- package/statistic/index.d.ts +7 -0
- package/statistic/index.es.js +280 -0
- package/statistic/index.umd.js +1 -0
- package/statistic/package.json +7 -0
- package/statistic/style.css +1 -0
- package/status/index.d.ts +7 -0
- package/status/index.es.js +42 -1
- package/status/index.umd.js +1 -1
- package/steps-guide/index.d.ts +7 -0
- package/steps-guide/index.es.js +239 -1
- package/steps-guide/index.umd.js +1 -1
- package/steps-guide/style.css +1 -1
- package/sticky/index.d.ts +7 -0
- package/sticky/index.es.js +197 -1
- package/sticky/index.umd.js +1 -1
- package/style.css +1 -1
- package/switch/index.d.ts +7 -0
- package/switch/index.es.js +100 -1
- package/switch/index.umd.js +1 -1
- package/switch/style.css +1 -1
- package/table/index.d.ts +7 -0
- package/table/index.es.js +1626 -1
- package/table/index.umd.js +1 -1
- package/table/style.css +1 -1
- package/tabs/index.d.ts +7 -0
- package/tabs/index.es.js +195 -1
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.d.ts +7 -0
- package/tag/index.es.js +131 -0
- package/tag/index.umd.js +1 -0
- package/tag/package.json +7 -0
- package/tag/style.css +1 -0
- package/tag-input/index.d.ts +7 -0
- package/tag-input/index.es.js +329 -1
- package/tag-input/index.umd.js +1 -1
- package/textarea/index.d.ts +7 -0
- package/textarea/index.es.js +132 -0
- package/textarea/index.umd.js +1 -0
- package/textarea/package.json +7 -0
- package/textarea/style.css +1 -0
- package/time-axis/index.d.ts +7 -0
- package/time-axis/index.es.js +299 -0
- package/time-axis/index.umd.js +1 -0
- package/time-axis/package.json +7 -0
- package/time-axis/style.css +1 -0
- package/time-picker/index.d.ts +7 -0
- package/time-picker/index.es.js +1053 -1
- package/time-picker/index.umd.js +1 -1
- package/time-picker/style.css +1 -1
- package/toast/index.d.ts +7 -0
- package/toast/index.es.js +2060 -1
- package/toast/index.umd.js +1 -1
- package/toast/style.css +1 -1
- package/tooltip/index.d.ts +7 -0
- package/tooltip/index.es.js +171 -1
- package/tooltip/index.umd.js +1 -1
- package/transfer/index.d.ts +7 -0
- package/transfer/index.es.js +1725 -1
- package/transfer/index.umd.js +1 -1
- package/transfer/style.css +1 -1
- package/tree/index.d.ts +7 -0
- package/tree/index.es.js +907 -1
- package/tree/index.umd.js +1 -1
- package/tree/style.css +1 -1
- package/tree-select/index.d.ts +7 -0
- package/tree-select/index.es.js +528 -0
- package/tree-select/index.umd.js +1 -0
- package/tree-select/package.json +7 -0
- package/tree-select/style.css +1 -0
- package/upload/index.d.ts +7 -0
- package/upload/index.es.js +3179 -1
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +27755 -1
- package/vue-devui.umd.js +29 -1
package/time-picker/index.es.js
CHANGED
|
@@ -1 +1,1053 @@
|
|
|
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:void 0,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
|
+
import { defineComponent, createVNode, reactive, ref, onMounted, onBeforeUnmount, onUnmounted, Fragment, computed, withDirectives, mergeProps, resolveDirective, watch, createTextVNode } from "vue";
|
|
18
|
+
const timePickerProps = {
|
|
19
|
+
modelValue: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: ""
|
|
22
|
+
},
|
|
23
|
+
placeholder: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: "00:00:00"
|
|
26
|
+
},
|
|
27
|
+
disabled: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false
|
|
30
|
+
},
|
|
31
|
+
timePickerWidth: {
|
|
32
|
+
type: Number,
|
|
33
|
+
default: 212
|
|
34
|
+
},
|
|
35
|
+
minTime: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: "00:00:00"
|
|
38
|
+
},
|
|
39
|
+
maxTime: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: "23:59:59"
|
|
42
|
+
},
|
|
43
|
+
format: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: "hh:mm:ss"
|
|
46
|
+
},
|
|
47
|
+
autoOpen: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false
|
|
50
|
+
},
|
|
51
|
+
showAnimation: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: true
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
var Icon = defineComponent({
|
|
57
|
+
name: "DIcon",
|
|
58
|
+
props: {
|
|
59
|
+
name: {
|
|
60
|
+
type: String,
|
|
61
|
+
required: true
|
|
62
|
+
},
|
|
63
|
+
size: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: "inherit"
|
|
66
|
+
},
|
|
67
|
+
color: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: "inherit"
|
|
70
|
+
},
|
|
71
|
+
classPrefix: {
|
|
72
|
+
type: String,
|
|
73
|
+
default: "icon"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
setup(props) {
|
|
77
|
+
return __spreadValues({}, props);
|
|
78
|
+
},
|
|
79
|
+
render() {
|
|
80
|
+
const {
|
|
81
|
+
name,
|
|
82
|
+
size,
|
|
83
|
+
color,
|
|
84
|
+
classPrefix
|
|
85
|
+
} = this;
|
|
86
|
+
return /^((https?):)?\/\//.test(name) ? createVNode("img", {
|
|
87
|
+
"src": name,
|
|
88
|
+
"alt": name.split("/")[name.split("/").length - 1],
|
|
89
|
+
"style": {
|
|
90
|
+
width: size,
|
|
91
|
+
verticalAlign: "text-bottom"
|
|
92
|
+
}
|
|
93
|
+
}, null) : createVNode("i", {
|
|
94
|
+
"class": `${classPrefix} ${classPrefix}-${name}`,
|
|
95
|
+
"style": {
|
|
96
|
+
fontSize: size,
|
|
97
|
+
color
|
|
98
|
+
}
|
|
99
|
+
}, null);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
Icon.install = function(app) {
|
|
103
|
+
app.component(Icon.name, Icon);
|
|
104
|
+
};
|
|
105
|
+
function getPositionFun(el, left, top) {
|
|
106
|
+
const inputDom = el.getBoundingClientRect();
|
|
107
|
+
const button2 = window.innerHeight - (inputDom.top + 20);
|
|
108
|
+
if (button2 > inputDom.top + 20) {
|
|
109
|
+
left.value = inputDom.x;
|
|
110
|
+
top.value = inputDom.top + 20 + 10;
|
|
111
|
+
} else {
|
|
112
|
+
left.value = inputDom.x;
|
|
113
|
+
top.value = inputDom.top - 316;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function initializeTimeData(type) {
|
|
117
|
+
const timeArr = reactive([]);
|
|
118
|
+
let arrLenght = 0;
|
|
119
|
+
if (type == "hour") {
|
|
120
|
+
arrLenght = 24;
|
|
121
|
+
} else {
|
|
122
|
+
arrLenght = 60;
|
|
123
|
+
}
|
|
124
|
+
for (let i = 0; i < arrLenght; i++) {
|
|
125
|
+
timeArr.push({
|
|
126
|
+
time: i < 10 ? "0" + i : i + "",
|
|
127
|
+
isActive: false,
|
|
128
|
+
flag: type,
|
|
129
|
+
isDisabled: false
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return timeArr;
|
|
133
|
+
}
|
|
134
|
+
const setTimeAstrict = (hourList, minuteList, secondList, minTime, maxTime, format) => {
|
|
135
|
+
const maxTimeHour = maxTime.split(":")[0];
|
|
136
|
+
const maxTimeMinute = maxTime.split(":")[1];
|
|
137
|
+
const minTimeHour = minTime.split(":")[0];
|
|
138
|
+
const minTimeMinute = minTime.split(":")[1];
|
|
139
|
+
const minTimeSecond = minTime.split(":")[2];
|
|
140
|
+
hourList.map((item, index2) => {
|
|
141
|
+
if (item.time < minTimeHour || item.time > maxTimeHour) {
|
|
142
|
+
item.isDisabled = true;
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
if (format == "mm:ss") {
|
|
146
|
+
minuteList.map((item, index2) => {
|
|
147
|
+
if (item.time < minTimeMinute || item.time > maxTimeMinute) {
|
|
148
|
+
item.isDisabled = true;
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
} else {
|
|
152
|
+
minuteList.map((item, index2) => {
|
|
153
|
+
if (item.time < minTimeMinute) {
|
|
154
|
+
item.isDisabled = true;
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
secondList.map((item, index2) => {
|
|
159
|
+
if (item.time < minTimeSecond) {
|
|
160
|
+
item.isDisabled = true;
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
function useTimePicker(hh, mm, ss, minTime, maxTime, format, autoOpen, disabled, value) {
|
|
165
|
+
const isActive = ref(false);
|
|
166
|
+
const showPopup = ref(false);
|
|
167
|
+
const devuiTimePicker = ref();
|
|
168
|
+
const inputDom = ref();
|
|
169
|
+
const left = ref(-100);
|
|
170
|
+
const top = ref(-100);
|
|
171
|
+
const timePopupDom = ref();
|
|
172
|
+
const timePickerValue = ref("");
|
|
173
|
+
const showClearIcon = ref(false);
|
|
174
|
+
const firsthandActiveTime = ref(`${hh.value}:${mm.value}:${ss.value}`);
|
|
175
|
+
const vModeValue = ref(value);
|
|
176
|
+
const getPopupPosition = () => {
|
|
177
|
+
getPositionFun(devuiTimePicker.value, left, top);
|
|
178
|
+
};
|
|
179
|
+
const clickVerifyFun = (e) => {
|
|
180
|
+
e.stopPropagation();
|
|
181
|
+
isActive.value = false;
|
|
182
|
+
showPopup.value = false;
|
|
183
|
+
if (disabled)
|
|
184
|
+
return;
|
|
185
|
+
const path = e.composedPath && e.composedPath() || e.path;
|
|
186
|
+
const inInputDom = path.includes(devuiTimePicker.value);
|
|
187
|
+
inInputDom && mouseInIputFun();
|
|
188
|
+
};
|
|
189
|
+
const mouseInIputFun = () => {
|
|
190
|
+
if (firsthandActiveTime.value == "00:00:00") {
|
|
191
|
+
const vModelValueArr = value.split(":");
|
|
192
|
+
const minTimeValueArr = minTime.split(":");
|
|
193
|
+
vModeValue.value == "" ? vModeValue.value = "00:00:00" : "";
|
|
194
|
+
if (vModeValue.value > minTime) {
|
|
195
|
+
firsthandActiveTime.value = value;
|
|
196
|
+
setInputValue(vModelValueArr[0], vModelValueArr[1], vModelValueArr[2]);
|
|
197
|
+
} else {
|
|
198
|
+
firsthandActiveTime.value = minTime;
|
|
199
|
+
setInputValue(minTimeValueArr[0], minTimeValueArr[1], minTimeValueArr[2]);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
isActive.value = true;
|
|
203
|
+
showPopup.value = true;
|
|
204
|
+
};
|
|
205
|
+
const vModelIsBeyond = () => {
|
|
206
|
+
if (vModeValue.value != "" && vModeValue.value < minTime) {
|
|
207
|
+
vModeValue.value = minTime;
|
|
208
|
+
} else if (vModeValue.value != "" && vModeValue.value > maxTime) {
|
|
209
|
+
vModeValue.value = maxTime;
|
|
210
|
+
}
|
|
211
|
+
const vModelValueArr = vModeValue.value.split(":");
|
|
212
|
+
vModeValue.value && setInputValue(vModelValueArr[0], vModelValueArr[1], vModelValueArr[2]);
|
|
213
|
+
};
|
|
214
|
+
const getTimeValue = (e) => {
|
|
215
|
+
e.stopPropagation();
|
|
216
|
+
if (showPopup.value) {
|
|
217
|
+
hh.value = timePopupDom.value.changTimeData().activeHour.value;
|
|
218
|
+
mm.value = timePopupDom.value.changTimeData().activeMinute.value;
|
|
219
|
+
ss.value = timePopupDom.value.changTimeData().activeSecond.value;
|
|
220
|
+
firsthandActiveTime.value = `${hh.value}:${mm.value}:${ss.value}`;
|
|
221
|
+
setInputValue(hh.value, mm.value, ss.value);
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
const setInputValue = (hh2, mm2, ss2) => {
|
|
225
|
+
if (format == "hh:mm:ss") {
|
|
226
|
+
vModeValue.value = `${hh2}:${mm2}:${ss2}`;
|
|
227
|
+
} else if (format == "mm:hh:ss") {
|
|
228
|
+
vModeValue.value = `${mm2}:${hh2}:${ss2}`;
|
|
229
|
+
} else if (format == "hh:mm") {
|
|
230
|
+
vModeValue.value = `${hh2}:${mm2}`;
|
|
231
|
+
} else if (format == "mm:ss") {
|
|
232
|
+
vModeValue.value = `${mm2}:${ss2}`;
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
const clearAll = (e) => {
|
|
236
|
+
e.stopPropagation();
|
|
237
|
+
showPopup.value = false;
|
|
238
|
+
if (minTime != "00:00:00") {
|
|
239
|
+
const minTimeArr = minTime.split(":");
|
|
240
|
+
hh.value = minTimeArr[0];
|
|
241
|
+
mm.value = minTimeArr[1];
|
|
242
|
+
ss.value = minTimeArr[2];
|
|
243
|
+
} else {
|
|
244
|
+
hh.value = "00";
|
|
245
|
+
mm.value = "00";
|
|
246
|
+
ss.value = "00";
|
|
247
|
+
}
|
|
248
|
+
firsthandActiveTime.value = `${hh.value}:${mm.value}:${ss.value}`;
|
|
249
|
+
setInputValue(hh.value, mm.value, ss.value);
|
|
250
|
+
};
|
|
251
|
+
const isOutOpen = () => {
|
|
252
|
+
if (autoOpen) {
|
|
253
|
+
const timeArr = vModeValue.value.split(":");
|
|
254
|
+
hh.value = timeArr[0];
|
|
255
|
+
mm.value = timeArr[1];
|
|
256
|
+
ss.value = timeArr[2];
|
|
257
|
+
firsthandActiveTime.value = vModeValue.value;
|
|
258
|
+
setInputValue(hh.value, mm.value, ss.value);
|
|
259
|
+
isActive.value = true;
|
|
260
|
+
showPopup.value = autoOpen;
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
const chooseTime = (slotTime) => {
|
|
264
|
+
if (slotTime.type) {
|
|
265
|
+
if (slotTime.type.toLowerCase() == "hh") {
|
|
266
|
+
hh.value = slotTime.time;
|
|
267
|
+
} else if (slotTime.type.toLowerCase() == "mm") {
|
|
268
|
+
mm.value = slotTime.time;
|
|
269
|
+
} else if (slotTime.type.toLowerCase() == "ss") {
|
|
270
|
+
ss.value = slotTime.time;
|
|
271
|
+
}
|
|
272
|
+
firsthandActiveTime.value = `${hh.value}:${mm.value}:${ss.value}`;
|
|
273
|
+
setInputValue(hh.value, mm.value, ss.value);
|
|
274
|
+
} else {
|
|
275
|
+
const timeArr = slotTime.time.split(":");
|
|
276
|
+
hh.value = timeArr[0];
|
|
277
|
+
mm.value = timeArr[1];
|
|
278
|
+
ss.value = timeArr[2];
|
|
279
|
+
firsthandActiveTime.value = `${hh.value}:${mm.value}:${ss.value}`;
|
|
280
|
+
setInputValue(hh.value, mm.value, ss.value);
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
return {
|
|
284
|
+
isActive,
|
|
285
|
+
showPopup,
|
|
286
|
+
devuiTimePicker,
|
|
287
|
+
timePickerValue,
|
|
288
|
+
inputDom,
|
|
289
|
+
timePopupDom,
|
|
290
|
+
left,
|
|
291
|
+
top,
|
|
292
|
+
showClearIcon,
|
|
293
|
+
firsthandActiveTime,
|
|
294
|
+
vModeValue,
|
|
295
|
+
getPopupPosition,
|
|
296
|
+
getTimeValue,
|
|
297
|
+
clickVerifyFun,
|
|
298
|
+
isOutOpen,
|
|
299
|
+
vModelIsBeyond,
|
|
300
|
+
clearAll,
|
|
301
|
+
chooseTime
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
const usePopupLine = (hourListRef, minuteListRef, secondListRef, minTime, maxTime, format, timeListDom) => {
|
|
305
|
+
const activeTime = ref("00:00:00");
|
|
306
|
+
const activeHour = ref("00");
|
|
307
|
+
const activeMinute = ref("00");
|
|
308
|
+
const activeSecond = ref("00");
|
|
309
|
+
const activeTimeFun = (e, item, index2) => {
|
|
310
|
+
if (item.isDisabled) {
|
|
311
|
+
return false;
|
|
312
|
+
} else {
|
|
313
|
+
setTimeActive(item, index2);
|
|
314
|
+
e.target.parentElement.parentElement.scrollTop = index2 * 32;
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
const setTimeActive = (item, index2) => {
|
|
318
|
+
let activeTimeList = [];
|
|
319
|
+
let acitveTimeValue = ref("");
|
|
320
|
+
if (item.flag == "hour") {
|
|
321
|
+
activeTimeList = hourListRef;
|
|
322
|
+
acitveTimeValue = activeHour;
|
|
323
|
+
getItemAstrict(item);
|
|
324
|
+
} else if (item.flag == "minute") {
|
|
325
|
+
activeTimeList = minuteListRef;
|
|
326
|
+
acitveTimeValue = activeMinute;
|
|
327
|
+
getItemAstrict(item);
|
|
328
|
+
} else if (item.flag == "second") {
|
|
329
|
+
activeTimeList = secondListRef;
|
|
330
|
+
acitveTimeValue = activeSecond;
|
|
331
|
+
}
|
|
332
|
+
activeTimeList.map((tiemItem, tiemeIndex) => {
|
|
333
|
+
tiemItem.isActive = index2 === tiemeIndex;
|
|
334
|
+
});
|
|
335
|
+
acitveTimeValue.value = activeTimeList[index2].time;
|
|
336
|
+
activeTime.value = `${activeHour.value}:${activeMinute.value}:${activeSecond.value}`;
|
|
337
|
+
if (activeTime.value < minTime) {
|
|
338
|
+
activeTime.value = minTime;
|
|
339
|
+
resetTimeValue(minTime);
|
|
340
|
+
} else if (format == "mm:ss" && `${activeMinute.value}:${activeSecond.value}` > maxTime.slice(3)) {
|
|
341
|
+
const newMinTime = minTime.slice(0, 3) + maxTime.slice(3);
|
|
342
|
+
resetTimeValue(newMinTime);
|
|
343
|
+
} else if (activeTime.value > maxTime) {
|
|
344
|
+
activeTime.value = maxTime;
|
|
345
|
+
resetTimeValue(maxTime);
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
const getItemAstrict = (item) => {
|
|
349
|
+
let min = "00";
|
|
350
|
+
let max = "00";
|
|
351
|
+
const minTimeHour = minTime.split(":")[0];
|
|
352
|
+
const minTimeMinute = minTime.split(":")[1];
|
|
353
|
+
const minTimeSecond = minTime.split(":")[2];
|
|
354
|
+
const maxTimeHour = maxTime.split(":")[0];
|
|
355
|
+
const maxTimeMinute = maxTime.split(":")[1];
|
|
356
|
+
const maxTimeSecond = maxTime.split(":")[2];
|
|
357
|
+
if (item.flag == "hour") {
|
|
358
|
+
if (item.time == minTimeHour) {
|
|
359
|
+
min = minTimeMinute;
|
|
360
|
+
setItemAstrict(minuteListRef, min, max);
|
|
361
|
+
activeMinute.value < minTimeMinute && setItemAstrict(secondListRef, minTimeSecond, max);
|
|
362
|
+
} else if (item.time == maxTimeHour) {
|
|
363
|
+
max = maxTimeMinute;
|
|
364
|
+
setItemAstrict(minuteListRef, min, max);
|
|
365
|
+
setItemAstrict(secondListRef, min, maxTimeSecond);
|
|
366
|
+
} else {
|
|
367
|
+
setItemAstrict(minuteListRef, min, max);
|
|
368
|
+
setItemAstrict(secondListRef, min, max);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
if (item.flag == "minute" && format == "mm:ss") {
|
|
372
|
+
if (item.time == minTimeMinute) {
|
|
373
|
+
min = minTimeSecond;
|
|
374
|
+
setItemAstrict(secondListRef, min, max);
|
|
375
|
+
} else if (item.time == maxTimeMinute) {
|
|
376
|
+
max = maxTimeSecond;
|
|
377
|
+
setItemAstrict(secondListRef, min, max);
|
|
378
|
+
} else {
|
|
379
|
+
setItemAstrict(secondListRef, min, max);
|
|
380
|
+
}
|
|
381
|
+
} else if (item.flag == "minute") {
|
|
382
|
+
if (activeHour.value == minTimeHour && item.time == minTimeMinute) {
|
|
383
|
+
min = minTimeSecond;
|
|
384
|
+
setItemAstrict(secondListRef, min, max);
|
|
385
|
+
} else if (activeHour.value == maxTimeHour && item.time == maxTimeMinute) {
|
|
386
|
+
max = maxTimeSecond;
|
|
387
|
+
setItemAstrict(secondListRef, min, max);
|
|
388
|
+
} else {
|
|
389
|
+
setItemAstrict(secondListRef, min, max);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
const setItemAstrict = (timeArr, min, max) => {
|
|
394
|
+
timeArr.map((itme) => {
|
|
395
|
+
if (min != "00" && itme.time < min) {
|
|
396
|
+
itme.isDisabled = true;
|
|
397
|
+
} else if (max != "00" && itme.time > max) {
|
|
398
|
+
itme.isDisabled = true;
|
|
399
|
+
} else {
|
|
400
|
+
itme.isDisabled = false;
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
};
|
|
404
|
+
const resetTimeValue = (time) => {
|
|
405
|
+
const timeValueArr = time.split(":");
|
|
406
|
+
const minTiveArr = minTime.split(":");
|
|
407
|
+
let hh = 0;
|
|
408
|
+
let mm = 0;
|
|
409
|
+
let ss = 0;
|
|
410
|
+
if (format == "hh:mm:ss") {
|
|
411
|
+
hh = parseInt(timeValueArr[0]);
|
|
412
|
+
mm = parseInt(timeValueArr[1]);
|
|
413
|
+
ss = parseInt(timeValueArr[2]);
|
|
414
|
+
timeListDom.value.children[0].lastElementChild.children[0].scrollTop = hh * 32;
|
|
415
|
+
timeListDom.value.children[1].lastElementChild.children[0].scrollTop = mm * 32;
|
|
416
|
+
timeListDom.value.children[2].lastElementChild.children[0].scrollTop = ss * 32;
|
|
417
|
+
activeHour.value = timeValueArr[0];
|
|
418
|
+
activeMinute.value = timeValueArr[1];
|
|
419
|
+
activeSecond.value = timeValueArr[2];
|
|
420
|
+
resetTimeActive(hourListRef, timeValueArr[0]);
|
|
421
|
+
resetTimeActive(minuteListRef, timeValueArr[1]);
|
|
422
|
+
resetTimeActive(secondListRef, timeValueArr[2]);
|
|
423
|
+
resetTimeAstrict(hourListRef, activeHour.value);
|
|
424
|
+
resetTimeAstrict(minuteListRef, activeMinute.value);
|
|
425
|
+
} else if (format == "mm:hh:ss") {
|
|
426
|
+
hh = parseInt(timeValueArr[0]);
|
|
427
|
+
mm = parseInt(timeValueArr[1]);
|
|
428
|
+
ss = parseInt(timeValueArr[2]);
|
|
429
|
+
timeListDom.value.children[0].lastElementChild.children[0].scrollTop = mm * 32;
|
|
430
|
+
timeListDom.value.children[1].lastElementChild.children[0].scrollTop = hh * 32;
|
|
431
|
+
timeListDom.value.children[2].lastElementChild.children[0].scrollTop = ss * 32;
|
|
432
|
+
activeHour.value = timeValueArr[0];
|
|
433
|
+
activeMinute.value = timeValueArr[1];
|
|
434
|
+
activeSecond.value = timeValueArr[2];
|
|
435
|
+
resetTimeActive(hourListRef, timeValueArr[0]);
|
|
436
|
+
resetTimeActive(minuteListRef, timeValueArr[1]);
|
|
437
|
+
resetTimeActive(secondListRef, timeValueArr[2]);
|
|
438
|
+
resetTimeAstrict(hourListRef, activeHour.value);
|
|
439
|
+
resetTimeAstrict(minuteListRef, activeMinute.value);
|
|
440
|
+
} else if (format == "hh:mm") {
|
|
441
|
+
hh = parseInt(timeValueArr[0]);
|
|
442
|
+
mm = parseInt(timeValueArr[1]);
|
|
443
|
+
timeListDom.value.children[0].lastElementChild.children[0].scrollTop = hh * 32;
|
|
444
|
+
timeListDom.value.children[1].lastElementChild.children[0].scrollTop = mm * 32;
|
|
445
|
+
activeHour.value = timeValueArr[0];
|
|
446
|
+
activeMinute.value = timeValueArr[1];
|
|
447
|
+
resetTimeActive(hourListRef, timeValueArr[0]);
|
|
448
|
+
resetTimeActive(minuteListRef, timeValueArr[1]);
|
|
449
|
+
resetTimeAstrict(hourListRef, activeHour.value);
|
|
450
|
+
} else if (format == "mm:ss") {
|
|
451
|
+
mm = parseInt(timeValueArr[1]);
|
|
452
|
+
ss = parseInt(timeValueArr[2]);
|
|
453
|
+
timeListDom.value.children[0].lastElementChild.children[0].scrollTop = mm * 32;
|
|
454
|
+
timeListDom.value.children[1].lastElementChild.children[0].scrollTop = ss * 32;
|
|
455
|
+
activeHour.value = minTiveArr[0];
|
|
456
|
+
activeMinute.value = timeValueArr[1];
|
|
457
|
+
activeSecond.value = timeValueArr[2];
|
|
458
|
+
resetTimeActive(minuteListRef, timeValueArr[1]);
|
|
459
|
+
resetTimeActive(secondListRef, timeValueArr[2]);
|
|
460
|
+
resetTimeAstrict(minuteListRef, activeMinute.value);
|
|
461
|
+
}
|
|
462
|
+
};
|
|
463
|
+
const resetTimeAstrict = (timeArr, time) => {
|
|
464
|
+
timeArr.map((item) => {
|
|
465
|
+
if (item.time == time) {
|
|
466
|
+
getItemAstrict(item);
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
};
|
|
470
|
+
const resetTimeActive = (timeArr, itemValue) => {
|
|
471
|
+
timeArr.map((item) => {
|
|
472
|
+
item.isActive = item.time === itemValue;
|
|
473
|
+
});
|
|
474
|
+
};
|
|
475
|
+
const getNewTime = () => {
|
|
476
|
+
return { activeTime, activeHour, activeMinute, activeSecond };
|
|
477
|
+
};
|
|
478
|
+
const resetScrollTop = () => {
|
|
479
|
+
for (let i = 0; i < timeListDom.value.children.length; i++) {
|
|
480
|
+
timeListDom.value.children[i].lastElementChild.children[0].scrollTop = 0;
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
return {
|
|
484
|
+
activeTime,
|
|
485
|
+
activeHour,
|
|
486
|
+
activeMinute,
|
|
487
|
+
activeSecond,
|
|
488
|
+
activeTimeFun,
|
|
489
|
+
resetTimeValue,
|
|
490
|
+
getNewTime,
|
|
491
|
+
resetScrollTop
|
|
492
|
+
};
|
|
493
|
+
};
|
|
494
|
+
function useTimeScroll() {
|
|
495
|
+
const scrollBoxDom = ref();
|
|
496
|
+
const scrollContentDom = ref();
|
|
497
|
+
const scrollThumbDom = ref();
|
|
498
|
+
const scrollTrackDom = ref();
|
|
499
|
+
const isDown = ref(false);
|
|
500
|
+
const getScrollHeight = () => {
|
|
501
|
+
const thumbHeight = scrollContentDom.value.clientHeight / scrollContentDom.value.scrollHeight * 100;
|
|
502
|
+
scrollThumbDom.value.style.height = thumbHeight + "%";
|
|
503
|
+
};
|
|
504
|
+
const setVirtualScroll = () => {
|
|
505
|
+
const thumbMoveY = scrollContentDom.value.scrollTop * 100 / scrollContentDom.value.clientHeight;
|
|
506
|
+
scrollThumbDom.value.style.transform = `translateY(${thumbMoveY}%)`;
|
|
507
|
+
};
|
|
508
|
+
const clickTrackFun = (e) => {
|
|
509
|
+
const offset = Math.abs(scrollTrackDom.value.getBoundingClientRect().top - e.clientY);
|
|
510
|
+
const thumbCenter = scrollThumbDom.value.offsetHeight / 2;
|
|
511
|
+
const thumbPosition = (offset - thumbCenter) * 100 / scrollContentDom.value.offsetHeight;
|
|
512
|
+
scrollContentDom.value.scrollTop = thumbPosition * scrollContentDom.value.scrollHeight / 100;
|
|
513
|
+
scrollContentDom.value.style.top = scrollContentDom.value.scrollTop + "px";
|
|
514
|
+
};
|
|
515
|
+
const mouseDownThum = () => {
|
|
516
|
+
isDown.value = true;
|
|
517
|
+
scrollTrackDom.value.style.opacity = 1;
|
|
518
|
+
};
|
|
519
|
+
const mouseOutThum = (e) => {
|
|
520
|
+
isDown.value = false;
|
|
521
|
+
thumbMouseMove(e);
|
|
522
|
+
};
|
|
523
|
+
const thumbMouseMove = (e) => {
|
|
524
|
+
const path = e.composedPath && e.composedPath() || e.path;
|
|
525
|
+
if (path.includes(scrollBoxDom.value) || isDown.value) {
|
|
526
|
+
scrollTrackDom.value.style.opacity = 1;
|
|
527
|
+
} else {
|
|
528
|
+
scrollTrackDom.value.style.opacity = 0;
|
|
529
|
+
}
|
|
530
|
+
if (!isDown.value)
|
|
531
|
+
return;
|
|
532
|
+
clickTrackFun(e);
|
|
533
|
+
};
|
|
534
|
+
const getScrollWidth = () => {
|
|
535
|
+
const ua = navigator.userAgent;
|
|
536
|
+
let marginRight = -20;
|
|
537
|
+
if (ua.indexOf("Chrome") > -1) {
|
|
538
|
+
marginRight = -8;
|
|
539
|
+
} else {
|
|
540
|
+
const outer = document.createElement("div");
|
|
541
|
+
outer.className = "devui-scrollbar-wrap";
|
|
542
|
+
outer.style.width = "100px";
|
|
543
|
+
outer.style.visibility = "hidden";
|
|
544
|
+
outer.style.position = "absolute";
|
|
545
|
+
outer.style.top = "-9999px";
|
|
546
|
+
document.body.appendChild(outer);
|
|
547
|
+
const widthNoScroll = outer.offsetWidth;
|
|
548
|
+
outer.style.overflow = "scroll";
|
|
549
|
+
const inner = document.createElement("div");
|
|
550
|
+
inner.style.width = "100%";
|
|
551
|
+
outer.appendChild(inner);
|
|
552
|
+
const widthWithScroll = inner.offsetWidth;
|
|
553
|
+
outer.parentNode.removeChild(outer);
|
|
554
|
+
marginRight = (widthNoScroll - widthWithScroll + 3) * -1;
|
|
555
|
+
}
|
|
556
|
+
return marginRight;
|
|
557
|
+
};
|
|
558
|
+
return {
|
|
559
|
+
scrollThumbDom,
|
|
560
|
+
scrollTrackDom,
|
|
561
|
+
scrollContentDom,
|
|
562
|
+
scrollBoxDom,
|
|
563
|
+
isDown,
|
|
564
|
+
getScrollHeight,
|
|
565
|
+
setVirtualScroll,
|
|
566
|
+
clickTrackFun,
|
|
567
|
+
mouseDownThum,
|
|
568
|
+
mouseOutThum,
|
|
569
|
+
thumbMouseMove,
|
|
570
|
+
getScrollWidth
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
var index$3 = "";
|
|
574
|
+
var TimeScroll = defineComponent({
|
|
575
|
+
name: "DTimeScroll",
|
|
576
|
+
props: timePickerProps,
|
|
577
|
+
setup(props, ctx) {
|
|
578
|
+
const {
|
|
579
|
+
scrollBoxDom,
|
|
580
|
+
scrollThumbDom,
|
|
581
|
+
scrollTrackDom,
|
|
582
|
+
scrollContentDom,
|
|
583
|
+
isDown,
|
|
584
|
+
getScrollHeight,
|
|
585
|
+
setVirtualScroll,
|
|
586
|
+
clickTrackFun,
|
|
587
|
+
mouseDownThum,
|
|
588
|
+
mouseOutThum,
|
|
589
|
+
thumbMouseMove,
|
|
590
|
+
getScrollWidth
|
|
591
|
+
} = useTimeScroll();
|
|
592
|
+
const marginRight = getScrollWidth();
|
|
593
|
+
onMounted(() => {
|
|
594
|
+
getScrollWidth();
|
|
595
|
+
getScrollHeight();
|
|
596
|
+
scrollBoxDom.value.addEventListener("click", setVirtualScroll);
|
|
597
|
+
scrollContentDom.value.addEventListener("scroll", setVirtualScroll);
|
|
598
|
+
scrollThumbDom.value.addEventListener("mousedown", mouseDownThum);
|
|
599
|
+
document.addEventListener("mouseup", mouseOutThum);
|
|
600
|
+
document.addEventListener("mousemove", thumbMouseMove);
|
|
601
|
+
});
|
|
602
|
+
onBeforeUnmount(() => {
|
|
603
|
+
scrollBoxDom.value.removeEventListener("click", setVirtualScroll);
|
|
604
|
+
scrollContentDom.value.removeEventListener("scroll", setVirtualScroll);
|
|
605
|
+
scrollThumbDom.value.removeEventListener("mousedown", mouseDownThum);
|
|
606
|
+
});
|
|
607
|
+
onUnmounted(() => {
|
|
608
|
+
document.removeEventListener("mouseup", mouseOutThum);
|
|
609
|
+
document.removeEventListener("mousemove", thumbMouseMove);
|
|
610
|
+
});
|
|
611
|
+
return () => {
|
|
612
|
+
var _a, _b;
|
|
613
|
+
return createVNode(Fragment, null, [createVNode("div", {
|
|
614
|
+
"ref": scrollBoxDom,
|
|
615
|
+
"class": "devui-scroll-box"
|
|
616
|
+
}, [createVNode("div", {
|
|
617
|
+
"ref": scrollContentDom,
|
|
618
|
+
"class": `box-content ${isDown.value || !props.showAnimation ? "box-content-behavior-auto" : ""}`,
|
|
619
|
+
"style": {
|
|
620
|
+
"margin-right": marginRight + "px"
|
|
621
|
+
}
|
|
622
|
+
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]), createVNode("div", {
|
|
623
|
+
"ref": scrollTrackDom,
|
|
624
|
+
"class": "box-sroll",
|
|
625
|
+
"onClick": clickTrackFun
|
|
626
|
+
}, [createVNode("div", {
|
|
627
|
+
"ref": scrollThumbDom,
|
|
628
|
+
"class": "scroll-child"
|
|
629
|
+
}, null)])])]);
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
});
|
|
633
|
+
var index$2 = "";
|
|
634
|
+
var TimeList = defineComponent({
|
|
635
|
+
name: "DTimeList",
|
|
636
|
+
components: {
|
|
637
|
+
TimeScroll
|
|
638
|
+
},
|
|
639
|
+
props: {
|
|
640
|
+
hourList: {
|
|
641
|
+
type: Array,
|
|
642
|
+
default: () => []
|
|
643
|
+
},
|
|
644
|
+
minuteList: {
|
|
645
|
+
type: Array,
|
|
646
|
+
default: () => []
|
|
647
|
+
},
|
|
648
|
+
secondList: {
|
|
649
|
+
type: Array,
|
|
650
|
+
default: () => []
|
|
651
|
+
},
|
|
652
|
+
format: {
|
|
653
|
+
type: String,
|
|
654
|
+
default: "hh:mm:ss"
|
|
655
|
+
},
|
|
656
|
+
minTime: {
|
|
657
|
+
type: String,
|
|
658
|
+
default: "00:00:00"
|
|
659
|
+
},
|
|
660
|
+
maxTime: {
|
|
661
|
+
type: String,
|
|
662
|
+
default: "23:59:59"
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
setup(props, ctx) {
|
|
666
|
+
const timeListDom = ref();
|
|
667
|
+
const {
|
|
668
|
+
getNewTime,
|
|
669
|
+
activeTimeFun,
|
|
670
|
+
resetTimeValue,
|
|
671
|
+
resetScrollTop
|
|
672
|
+
} = usePopupLine(props.hourList, props.minuteList, props.secondList, props.minTime, props.maxTime, props.format, timeListDom);
|
|
673
|
+
const setOutoTime = (time) => {
|
|
674
|
+
resetTimeValue(time);
|
|
675
|
+
};
|
|
676
|
+
const TimeLi = (timeArr) => {
|
|
677
|
+
return timeArr.map((item, index2) => {
|
|
678
|
+
return createVNode("li", {
|
|
679
|
+
"class": `time-li ${item.flag}Id-${index2} ${item.isActive ? "active-li" : ""} ${item.isDisabled ? "disabled-li" : ""}`,
|
|
680
|
+
"onClick": (e) => {
|
|
681
|
+
activeTimeFun(e, item, index2);
|
|
682
|
+
}
|
|
683
|
+
}, [createVNode("span", null, [item.time])]);
|
|
684
|
+
});
|
|
685
|
+
};
|
|
686
|
+
const TimeUl = (timeList) => {
|
|
687
|
+
return createVNode("div", {
|
|
688
|
+
"class": "time-item",
|
|
689
|
+
"style": {
|
|
690
|
+
"flex": 1
|
|
691
|
+
}
|
|
692
|
+
}, [createVNode(TimeScroll, null, {
|
|
693
|
+
default: () => [createVNode("ul", {
|
|
694
|
+
"class": "time-ul"
|
|
695
|
+
}, [TimeLi(timeList)])]
|
|
696
|
+
})]);
|
|
697
|
+
};
|
|
698
|
+
const formatTimeUl = () => {
|
|
699
|
+
const timeList = {
|
|
700
|
+
"hh": props.hourList,
|
|
701
|
+
"mm": props.minuteList,
|
|
702
|
+
"ss": props.secondList
|
|
703
|
+
};
|
|
704
|
+
const timeFormatArr = props.format.split(":");
|
|
705
|
+
return timeFormatArr.map((timeItme) => {
|
|
706
|
+
return TimeUl(timeList[timeItme]);
|
|
707
|
+
});
|
|
708
|
+
};
|
|
709
|
+
ctx.expose({
|
|
710
|
+
resetScrollTop,
|
|
711
|
+
setOutoTime,
|
|
712
|
+
getNewTime
|
|
713
|
+
});
|
|
714
|
+
return () => {
|
|
715
|
+
return createVNode("div", {
|
|
716
|
+
"class": "devui-time-list",
|
|
717
|
+
"ref": timeListDom
|
|
718
|
+
}, [formatTimeUl()]);
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
});
|
|
722
|
+
const buttonProps = {
|
|
723
|
+
type: {
|
|
724
|
+
type: String,
|
|
725
|
+
default: "button"
|
|
726
|
+
},
|
|
727
|
+
btnStyle: {
|
|
728
|
+
type: String,
|
|
729
|
+
default: "primary"
|
|
730
|
+
},
|
|
731
|
+
size: {
|
|
732
|
+
type: String,
|
|
733
|
+
default: "md"
|
|
734
|
+
},
|
|
735
|
+
position: {
|
|
736
|
+
type: String,
|
|
737
|
+
default: "default"
|
|
738
|
+
},
|
|
739
|
+
bordered: {
|
|
740
|
+
type: Boolean,
|
|
741
|
+
default: false
|
|
742
|
+
},
|
|
743
|
+
icon: {
|
|
744
|
+
type: String,
|
|
745
|
+
default: ""
|
|
746
|
+
},
|
|
747
|
+
showLoading: {
|
|
748
|
+
type: Boolean,
|
|
749
|
+
default: false
|
|
750
|
+
},
|
|
751
|
+
width: {
|
|
752
|
+
type: String
|
|
753
|
+
},
|
|
754
|
+
disabled: {
|
|
755
|
+
type: Boolean,
|
|
756
|
+
default: false
|
|
757
|
+
},
|
|
758
|
+
autofocus: {
|
|
759
|
+
type: Boolean,
|
|
760
|
+
default: false
|
|
761
|
+
},
|
|
762
|
+
onClick: {
|
|
763
|
+
type: Function
|
|
764
|
+
}
|
|
765
|
+
};
|
|
766
|
+
var button = "";
|
|
767
|
+
var Button = defineComponent({
|
|
768
|
+
name: "DButton",
|
|
769
|
+
props: buttonProps,
|
|
770
|
+
setup(props, ctx) {
|
|
771
|
+
const buttonContent = ref(null);
|
|
772
|
+
const onClick = (e) => {
|
|
773
|
+
var _a;
|
|
774
|
+
if (props.showLoading) {
|
|
775
|
+
return;
|
|
776
|
+
}
|
|
777
|
+
(_a = props.onClick) == null ? void 0 : _a.call(props, e);
|
|
778
|
+
};
|
|
779
|
+
const hasContent = computed(() => ctx.slots.default);
|
|
780
|
+
const btnClass = computed(() => {
|
|
781
|
+
const {
|
|
782
|
+
btnStyle,
|
|
783
|
+
size,
|
|
784
|
+
position,
|
|
785
|
+
bordered,
|
|
786
|
+
icon
|
|
787
|
+
} = props;
|
|
788
|
+
const origin = `devui-btn devui-btn-${btnStyle} devui-btn-${size} devui-btn-${position}`;
|
|
789
|
+
const borderedClass = bordered ? "bordered" : "";
|
|
790
|
+
const btnIcon = !!icon && !hasContent.value && btnStyle !== "primary" ? "d-btn-icon" : "";
|
|
791
|
+
const btnIconWrap = !!icon ? "d-btn-icon-wrap" : "";
|
|
792
|
+
return `${origin} ${borderedClass} ${btnIcon} ${btnIconWrap}`;
|
|
793
|
+
});
|
|
794
|
+
const iconClass = computed(() => {
|
|
795
|
+
if (!props.icon) {
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
const origin = "devui-icon-fix icon";
|
|
799
|
+
if (hasContent.value) {
|
|
800
|
+
return `${origin} clear-right-5`;
|
|
801
|
+
} else {
|
|
802
|
+
return origin;
|
|
803
|
+
}
|
|
804
|
+
});
|
|
805
|
+
return () => {
|
|
806
|
+
var _a, _b;
|
|
807
|
+
const {
|
|
808
|
+
icon,
|
|
809
|
+
type,
|
|
810
|
+
disabled,
|
|
811
|
+
showLoading,
|
|
812
|
+
width
|
|
813
|
+
} = props;
|
|
814
|
+
return withDirectives(createVNode("div", mergeProps({
|
|
815
|
+
"class": "devui-btn-host"
|
|
816
|
+
}, ctx.attrs), [createVNode("button", {
|
|
817
|
+
"class": btnClass.value,
|
|
818
|
+
"type": type,
|
|
819
|
+
"disabled": disabled,
|
|
820
|
+
"style": {
|
|
821
|
+
width
|
|
822
|
+
},
|
|
823
|
+
"onClick": onClick
|
|
824
|
+
}, [!!icon ? createVNode(Icon, {
|
|
825
|
+
"name": icon,
|
|
826
|
+
"class": iconClass.value
|
|
827
|
+
}, null) : null, createVNode("span", {
|
|
828
|
+
"class": "button-content",
|
|
829
|
+
"ref": buttonContent
|
|
830
|
+
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])])]), [[resolveDirective("dLoading"), showLoading]]);
|
|
831
|
+
};
|
|
832
|
+
}
|
|
833
|
+
});
|
|
834
|
+
Button.install = function(app) {
|
|
835
|
+
app.component(Button.name, Button);
|
|
836
|
+
};
|
|
837
|
+
var index$1 = "";
|
|
838
|
+
var TimePopup = defineComponent({
|
|
839
|
+
name: "DTimePopup",
|
|
840
|
+
components: {
|
|
841
|
+
TimeList,
|
|
842
|
+
Button
|
|
843
|
+
},
|
|
844
|
+
props: {
|
|
845
|
+
showPopup: {
|
|
846
|
+
type: Boolean,
|
|
847
|
+
default: false
|
|
848
|
+
},
|
|
849
|
+
popupTop: {
|
|
850
|
+
type: Number,
|
|
851
|
+
default: -100
|
|
852
|
+
},
|
|
853
|
+
popupLeft: {
|
|
854
|
+
type: Number,
|
|
855
|
+
default: -100
|
|
856
|
+
},
|
|
857
|
+
popupWidth: {
|
|
858
|
+
type: Number,
|
|
859
|
+
default: 300
|
|
860
|
+
},
|
|
861
|
+
popupFormat: {
|
|
862
|
+
type: String,
|
|
863
|
+
default: "hh:mm:ss"
|
|
864
|
+
},
|
|
865
|
+
minTime: {
|
|
866
|
+
type: String,
|
|
867
|
+
default: "00:00:00"
|
|
868
|
+
},
|
|
869
|
+
maxTime: {
|
|
870
|
+
type: String,
|
|
871
|
+
default: "23:59:59"
|
|
872
|
+
},
|
|
873
|
+
bindData: {
|
|
874
|
+
type: String,
|
|
875
|
+
default: "00:00:00"
|
|
876
|
+
}
|
|
877
|
+
},
|
|
878
|
+
emits: ["subData"],
|
|
879
|
+
setup(props, ctx) {
|
|
880
|
+
const popupDome = ref();
|
|
881
|
+
const timeListDom = ref();
|
|
882
|
+
const hourList = initializeTimeData("hour");
|
|
883
|
+
const minuteList = initializeTimeData("minute");
|
|
884
|
+
const secondList = initializeTimeData("second");
|
|
885
|
+
onMounted(() => {
|
|
886
|
+
setTimeAstrict(hourList, minuteList, secondList, props.minTime, props.maxTime, props.popupFormat);
|
|
887
|
+
});
|
|
888
|
+
watch(() => [props.showPopup, props.bindData], ([showPopup, newTimeVal], [oldShowPopup, oldTimeVal]) => {
|
|
889
|
+
if (showPopup || newTimeVal != oldTimeVal) {
|
|
890
|
+
timeListDom.value.setOutoTime(newTimeVal);
|
|
891
|
+
} else {
|
|
892
|
+
timeListDom.value.resetScrollTop();
|
|
893
|
+
}
|
|
894
|
+
});
|
|
895
|
+
const changTimeData = () => {
|
|
896
|
+
return timeListDom.value.getNewTime();
|
|
897
|
+
};
|
|
898
|
+
const subDataFun = (e) => {
|
|
899
|
+
e.stopPropagation();
|
|
900
|
+
ctx.emit("subData");
|
|
901
|
+
};
|
|
902
|
+
ctx.expose({
|
|
903
|
+
changTimeData
|
|
904
|
+
});
|
|
905
|
+
return () => {
|
|
906
|
+
var _a, _b;
|
|
907
|
+
return createVNode(Fragment, null, [createVNode("div", {
|
|
908
|
+
"ref": popupDome,
|
|
909
|
+
"class": `devui-time-popup ${props.showPopup ? "devui-show-time-popup" : ""}`,
|
|
910
|
+
"style": {
|
|
911
|
+
"width": props.popupWidth + "px",
|
|
912
|
+
"top": props.popupTop + "px",
|
|
913
|
+
"left": props.popupLeft + "px"
|
|
914
|
+
}
|
|
915
|
+
}, [createVNode(TimeList, {
|
|
916
|
+
"ref": timeListDom,
|
|
917
|
+
"hourList": hourList,
|
|
918
|
+
"minuteList": minuteList,
|
|
919
|
+
"secondList": secondList,
|
|
920
|
+
"minTime": props.minTime,
|
|
921
|
+
"maxTime": props.maxTime,
|
|
922
|
+
"format": props.popupFormat
|
|
923
|
+
}, null), createVNode("div", {
|
|
924
|
+
"class": "devui-time-popup-btn"
|
|
925
|
+
}, [createVNode("div", {
|
|
926
|
+
"class": "popup-slots"
|
|
927
|
+
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]), createVNode("div", {
|
|
928
|
+
"onClick": subDataFun
|
|
929
|
+
}, [createVNode(Button, {
|
|
930
|
+
"btnStyle": "common"
|
|
931
|
+
}, {
|
|
932
|
+
default: () => [createTextVNode("\u786E\u5B9A")]
|
|
933
|
+
})])])])]);
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
});
|
|
937
|
+
var timePicker = "";
|
|
938
|
+
var TimePicker = defineComponent({
|
|
939
|
+
name: "DTimePicker",
|
|
940
|
+
components: {
|
|
941
|
+
TimePopup
|
|
942
|
+
},
|
|
943
|
+
props: timePickerProps,
|
|
944
|
+
emits: ["selectedTimeChage", "update:modelValue"],
|
|
945
|
+
setup(props, ctx) {
|
|
946
|
+
const activeHour = ref("00");
|
|
947
|
+
const activeMinute = ref("00");
|
|
948
|
+
const activeSecond = ref("00");
|
|
949
|
+
const format = props.format.toLowerCase();
|
|
950
|
+
const {
|
|
951
|
+
isActive,
|
|
952
|
+
showPopup,
|
|
953
|
+
devuiTimePicker,
|
|
954
|
+
inputDom,
|
|
955
|
+
left,
|
|
956
|
+
top,
|
|
957
|
+
showClearIcon,
|
|
958
|
+
firsthandActiveTime,
|
|
959
|
+
chooseTime,
|
|
960
|
+
getTimeValue,
|
|
961
|
+
clickVerifyFun,
|
|
962
|
+
isOutOpen,
|
|
963
|
+
vModelIsBeyond,
|
|
964
|
+
clearAll,
|
|
965
|
+
timePopupDom,
|
|
966
|
+
vModeValue,
|
|
967
|
+
getPopupPosition
|
|
968
|
+
} = useTimePicker(activeHour, activeMinute, activeSecond, props.minTime, props.maxTime, format, props.autoOpen, props.disabled, props.modelValue);
|
|
969
|
+
const selectedTimeChage = (e) => {
|
|
970
|
+
isActive.value = false;
|
|
971
|
+
showPopup.value = false;
|
|
972
|
+
ctx.emit("selectedTimeChage", vModeValue.value);
|
|
973
|
+
};
|
|
974
|
+
onMounted(() => {
|
|
975
|
+
getPopupPosition();
|
|
976
|
+
isOutOpen();
|
|
977
|
+
vModelIsBeyond();
|
|
978
|
+
document.addEventListener("click", clickVerifyFun);
|
|
979
|
+
document.addEventListener("click", getTimeValue);
|
|
980
|
+
document.addEventListener("scroll", getPopupPosition);
|
|
981
|
+
window.addEventListener("resize", getPopupPosition);
|
|
982
|
+
});
|
|
983
|
+
onUnmounted(() => {
|
|
984
|
+
document.removeEventListener("click", clickVerifyFun);
|
|
985
|
+
document.removeEventListener("click", getTimeValue);
|
|
986
|
+
document.removeEventListener("scroll", getPopupPosition);
|
|
987
|
+
window.removeEventListener("resize", getPopupPosition);
|
|
988
|
+
});
|
|
989
|
+
watch(vModeValue, (newValue) => {
|
|
990
|
+
ctx.emit("update:modelValue", vModeValue.value);
|
|
991
|
+
if (newValue != props.minTime && newValue != "00:00") {
|
|
992
|
+
showClearIcon.value = true;
|
|
993
|
+
} else {
|
|
994
|
+
showClearIcon.value = false;
|
|
995
|
+
}
|
|
996
|
+
});
|
|
997
|
+
ctx.expose({
|
|
998
|
+
clearAll,
|
|
999
|
+
chooseTime
|
|
1000
|
+
});
|
|
1001
|
+
return () => {
|
|
1002
|
+
return createVNode(Fragment, null, [createVNode("div", {
|
|
1003
|
+
"class": `devui-time-picker ${isActive.value ? "time-picker-active" : ""} ${props.disabled ? "picker-disabled" : ""}`,
|
|
1004
|
+
"ref": devuiTimePicker
|
|
1005
|
+
}, [createVNode(TimePopup, {
|
|
1006
|
+
"ref": timePopupDom,
|
|
1007
|
+
"showPopup": showPopup.value,
|
|
1008
|
+
"popupTop": top.value,
|
|
1009
|
+
"popupLeft": left.value,
|
|
1010
|
+
"popupWidth": props.timePickerWidth,
|
|
1011
|
+
"popupFormat": props.format.toLowerCase(),
|
|
1012
|
+
"minTime": props.minTime,
|
|
1013
|
+
"maxTime": props.maxTime,
|
|
1014
|
+
"bindData": firsthandActiveTime.value,
|
|
1015
|
+
"onSubData": selectedTimeChage
|
|
1016
|
+
}, {
|
|
1017
|
+
default: () => {
|
|
1018
|
+
var _a, _b;
|
|
1019
|
+
return [(_b = (_a = ctx.slots).customViewTemplate) == null ? void 0 : _b.call(_a)];
|
|
1020
|
+
}
|
|
1021
|
+
}), createVNode("input", {
|
|
1022
|
+
"ref": inputDom,
|
|
1023
|
+
"type": "text",
|
|
1024
|
+
"value": vModeValue.value,
|
|
1025
|
+
"placeholder": `${props.placeholder}`,
|
|
1026
|
+
"disabled": props.disabled,
|
|
1027
|
+
"class": "time-input"
|
|
1028
|
+
}, null), createVNode("div", {
|
|
1029
|
+
"class": "time-input-icon"
|
|
1030
|
+
}, [createVNode("div", {
|
|
1031
|
+
"onClick": clearAll
|
|
1032
|
+
}, [showClearIcon.value ? createVNode(Icon, {
|
|
1033
|
+
"size": "small",
|
|
1034
|
+
"name": "close"
|
|
1035
|
+
}, null) : ""]), createVNode("div", null, [createVNode(Icon, {
|
|
1036
|
+
"size": "small",
|
|
1037
|
+
"name": "time"
|
|
1038
|
+
}, null)])])])]);
|
|
1039
|
+
};
|
|
1040
|
+
}
|
|
1041
|
+
});
|
|
1042
|
+
TimePicker.install = function(app) {
|
|
1043
|
+
app.component(TimePicker.name, TimePicker);
|
|
1044
|
+
};
|
|
1045
|
+
var index = {
|
|
1046
|
+
title: "TimePicker \u65F6\u95F4\u9009\u62E9\u5668",
|
|
1047
|
+
category: "\u6570\u636E\u5F55\u5165",
|
|
1048
|
+
status: "90%",
|
|
1049
|
+
install(app) {
|
|
1050
|
+
app.use(TimePicker);
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
1053
|
+
export { TimePicker, index as default };
|