vue-devui 1.0.0-rc.6 → 1.0.0-rc.9
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/README.md +5 -0
- package/alert/index.es.js +37 -11
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/auto-complete/index.es.js +311 -77
- package/auto-complete/index.umd.js +3 -5
- package/auto-complete/style.css +1 -1
- package/avatar/index.es.js +81 -70
- package/avatar/index.umd.js +1 -1
- package/avatar/style.css +1 -1
- package/badge/index.es.js +29 -4
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/button/index.es.js +5632 -87
- package/button/index.umd.js +27 -1
- package/button/style.css +1 -1
- package/card/index.es.js +56 -29
- package/card/index.umd.js +1 -1
- package/card/style.css +1 -1
- package/checkbox/index.es.js +364 -234
- package/checkbox/index.umd.js +1 -1
- package/checkbox/style.css +1 -1
- package/date-picker/index.es.js +310 -157
- package/date-picker/index.umd.js +1 -1
- package/date-picker/style.css +1 -1
- package/drawer/index.es.js +28 -3
- package/drawer/index.umd.js +1 -1
- package/drawer/style.css +1 -1
- package/dropdown/index.es.js +125 -45
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/editable-select/index.es.js +437 -22
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/form/index.es.js +490 -605
- package/form/index.umd.js +15 -15
- package/form/style.css +1 -1
- package/fullscreen/index.es.js +29 -5
- package/fullscreen/index.umd.js +1 -1
- package/fullscreen/style.css +1 -1
- package/grid/index.es.js +71 -50
- package/grid/index.umd.js +1 -1
- package/grid/style.css +1 -1
- package/icon/index.es.js +109 -13
- package/icon/index.umd.js +1 -1
- package/icon/style.css +1 -0
- package/image-preview/index.es.js +34 -11
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/input/index.es.js +330 -130
- package/input/index.umd.js +1 -1
- package/input/style.css +1 -1
- package/input-number/index.es.js +272 -199
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.es.js +34 -6
- package/layout/index.umd.js +1 -1
- package/layout/style.css +1 -1
- package/loading/index.es.js +34 -10
- package/loading/index.umd.js +1 -1
- package/loading/style.css +1 -1
- package/modal/index.es.js +126 -27
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/notification/index.es.js +125 -25
- package/notification/index.umd.js +1 -1
- package/notification/style.css +1 -1
- package/nuxt/components/ButtonGroup.js +3 -0
- package/nuxt/components/CheckboxButton.js +3 -0
- package/nuxt/components/CheckboxGroup.js +3 -0
- package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
- package/nuxt/components/FORM_TOKEN.js +3 -0
- package/nuxt/components/Icon.js +1 -0
- package/nuxt/components/LABEL_DATA.js +3 -0
- package/nuxt/components/Option.js +3 -0
- package/nuxt/components/buttonGroupInjectionKey.js +3 -0
- package/nuxt/components/buttonGroupProps.js +3 -0
- package/nuxt/components/formControlProps.js +3 -0
- package/nuxt/components/formItemProps.js +3 -0
- package/nuxt/components/formProps.js +3 -0
- package/nuxt/components/iconProps.js +1 -0
- package/nuxt/components/svgIconProps.js +3 -0
- package/overlay/index.es.js +31 -9
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +2 -1
- package/pagination/index.es.js +135 -124
- package/pagination/index.umd.js +1 -1
- package/pagination/style.css +1 -1
- package/popover/index.es.js +198 -83
- package/popover/index.umd.js +16 -16
- package/popover/style.css +1 -1
- package/progress/index.es.js +76 -20
- package/progress/index.umd.js +3 -3
- package/progress/style.css +1 -1
- package/radio/index.es.js +161 -140
- package/radio/index.umd.js +1 -1
- package/radio/style.css +1 -1
- package/rate/index.es.js +48 -16
- package/rate/index.umd.js +1 -1
- package/rate/style.css +1 -1
- package/result/index.es.js +108 -12
- package/result/index.umd.js +1 -1
- package/result/style.css +1 -1
- package/search/index.es.js +379 -167
- package/search/index.umd.js +17 -17
- package/search/style.css +1 -1
- package/select/index.es.js +7339 -556
- package/select/index.umd.js +27 -1
- package/select/style.css +1 -1
- package/skeleton/index.es.js +37 -12
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.es.js +34 -10
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.es.js +201 -84
- package/splitter/index.umd.js +14 -14
- package/splitter/style.css +1 -1
- package/status/index.es.js +26 -2
- package/status/index.umd.js +1 -1
- package/status/style.css +1 -1
- package/style.css +1 -1
- package/switch/index.es.js +30 -6
- package/switch/index.umd.js +1 -1
- package/switch/style.css +1 -1
- package/table/index.es.js +6808 -585
- package/table/index.umd.js +27 -1
- package/table/style.css +1 -1
- package/tabs/index.es.js +136 -70
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.es.js +31 -7
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/textarea/index.es.js +5631 -80
- package/textarea/index.umd.js +35 -1
- package/textarea/style.css +1 -1
- package/timeline/index.es.js +108 -12
- package/timeline/index.umd.js +1 -1
- package/timeline/style.css +1 -1
- package/tooltip/index.es.js +190 -74
- package/tooltip/index.umd.js +17 -17
- package/tooltip/style.css +1 -1
- package/tree/index.es.js +376 -256
- package/tree/index.umd.js +1 -1
- package/tree/style.css +1 -1
- package/upload/index.es.js +138 -34
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +6770 -5769
- package/vue-devui.umd.js +27 -21
- package/comment/index.d.ts +0 -7
- package/comment/index.es.js +0 -84
- package/comment/index.umd.js +0 -1
- package/comment/package.json +0 -7
- package/comment/style.css +0 -1
- package/nuxt/components/Comment.js +0 -3
- package/nuxt/components/FormControl.js +0 -3
- package/nuxt/components/FormLabel.js +0 -3
- package/nuxt/components/ReadTip.js +0 -3
- package/nuxt/components/commentProps.js +0 -3
- package/nuxt/components/readTipProps.js +0 -3
- package/read-tip/index.d.ts +0 -7
- package/read-tip/index.es.js +0 -261
- package/read-tip/index.umd.js +0 -1
- package/read-tip/package.json +0 -7
- package/read-tip/style.css +0 -1
package/checkbox/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var E=Object.defineProperty,H=Object.defineProperties;var J=Object.getOwnPropertyDescriptors;var x=Object.getOwnPropertySymbols;var Q=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable;var _=(d,l,m)=>l in d?E(d,l,{enumerable:!0,configurable:!0,writable:!0,value:m}):d[l]=m,$=(d,l)=>{for(var m in l||(l={}))Q.call(l,m)&&_(d,m,l[m]);if(x)for(var m of x(l))X.call(l,m)&&_(d,m,l[m]);return d},j=(d,l)=>H(d,J(l));(function(d,l){typeof exports=="object"&&typeof module!="undefined"?l(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],l):(d=typeof globalThis!="undefined"?globalThis:d||self,l(d.index={},d.Vue))})(this,function(d,l){"use strict";const m={name:{type:String,default:void 0},halfChecked:{type:Boolean,default:!1},isShowTitle:{type:Boolean,default:!0},title:{type:String},color:{type:String,default:void 0},showAnimation:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},beforeChange:{type:Function,default:void 0},size:{type:String,default:"md"}},p=j($({},m),{checked:{type:Boolean,default:!1},value:{type:[Number,String]},label:{type:String,default:""},"onUpdate:checked":{type:Function,default:void 0},onChange:{type:Function,default:void 0},modelValue:{type:Boolean},"onUpdate:modelValue":{type:Function},border:{type:Boolean,default:!1}}),z=j($({},m),{modelValue:{type:Array,required:!0},direction:{type:String,default:"column"},itemWidth:{type:Number,default:void 0},options:{type:Array,default:()=>[]},onChange:{type:Function,default:void 0},"onUpdate:modelValue":{type:Function,default:void 0},border:{type:Boolean,default:!1},max:{type:Number,default:void 0},textColor:{type:String,default:""}}),S=Symbol("d-checkbox-group");function N(t,o,e){let i=t;return o&&(i+=`__${o}`),e&&(i+=`--${e}`),i}function R(t,o=!1){const e=o?`.devui-${t}`:`devui-${t}`;return{b:()=>N(e),e:a=>a?N(e,a):"",m:a=>a?N(e,"",a):"",em:(a,c)=>a&&c?N(e,a,c):""}}function D(t,o){const e=l.inject(S,null),i=l.computed(()=>t.checked||t.modelValue),s=l.computed(()=>{var n,C;return(C=(n=e==null?void 0:e.isItemChecked)==null?void 0:n.call(e,t.value))!=null?C:i.value}),f=l.computed(()=>{const n=e==null?void 0:e.max.value;return!!n&&(e==null?void 0:e.modelValue.value.length)>=n&&!s.value}),u=l.computed(()=>(e==null?void 0:e.disabled.value)||t.disabled||f.value),a=l.computed(()=>{var n;return(n=e==null?void 0:e.isShowTitle.value)!=null?n:t.isShowTitle}),c=l.computed(()=>{var n;return(n=e==null?void 0:e.showAnimation.value)!=null?n:t.showAnimation}),r=l.computed(()=>{var n;return(n=e==null?void 0:e.color.value)!=null?n:t.color}),h=e==null?void 0:e.itemWidth.value,g=e==null?void 0:e.direction.value,b=(n,C)=>{var P;if(u.value)return Promise.resolve(!1);const B=(P=t.beforeChange)!=null?P:e==null?void 0:e.beforeChange;if(B){const w=B(n,C);return typeof w=="boolean"?Promise.resolve(w):w}return Promise.resolve(!0)},V=()=>{const n=!i.value;e==null||e.toggleGroupVal(t.value),o.emit("update:checked",n),o.emit("update:modelValue",n),o.emit("change",n)},v=()=>{b(!i.value,t.label).then(n=>n&&V())},y=l.computed(()=>{var n;return(n=e==null?void 0:e.size.value)!=null?n:t.size}),k=l.computed(()=>{var n;return(n=e==null?void 0:e.border.value)!=null?n:t.border});return{mergedChecked:s,mergedDisabled:u,mergedIsShowTitle:a,mergedShowAnimation:c,mergedColor:r,itemWidth:h,direction:g,handleClick:v,size:y,border:k}}function U(t,o){const e=l.toRef(t,"modelValue"),i={checked:!1,isShowTitle:!0,halfChecked:!1,showAnimation:!0,disabled:!1},s=u=>{let a=-1;if(["string","number"].includes(typeof e.value[0])?a=e.value.findIndex(c=>c===u):typeof e.value[0]=="object"&&(a=e.value.findIndex(c=>c.value===u)),a===-1){if(typeof t.options[0]=="object"){const r=t.options.find(g=>g.value===u),h=[...e.value,r];o.emit("update:modelValue",h),o.emit("change",h);return}const c=[...e.value,u];o.emit("update:modelValue",c),o.emit("change",c);return}e.value.splice(a,1),o.emit("update:modelValue",e.value),o.emit("change",e.value)},f=u=>{if(["string","number"].includes(typeof e.value[0]))return e.value.includes(u);if(typeof e.value[0]=="object")return e.value.some(a=>a.value===u)};return l.provide(S,{disabled:l.toRef(t,"disabled"),isShowTitle:l.toRef(t,"isShowTitle"),color:l.toRef(t,"color"),showAnimation:l.toRef(t,"showAnimation"),beforeChange:t.beforeChange,isItemChecked:f,toggleGroupVal:s,itemWidth:l.toRef(t,"itemWidth"),direction:l.toRef(t,"direction"),size:l.toRef(t,"size"),border:l.toRef(t,"border"),max:l.toRef(t,"max"),modelValue:l.toRef(t,"modelValue"),textColor:l.toRef(t,"textColor")}),{defaultOpt:i}}function q(){const t=l.inject(S,null);return{mergedTextColor:l.computed(()=>{var e;return(e=t==null?void 0:t.textColor.value)!=null?e:void 0})}}var Y="",T=l.defineComponent({name:"DCheckbox",props:p,emits:["change","update:checked","update:modelValue"],setup(t,o){const e=R("checkbox"),{mergedChecked:i,mergedDisabled:s,mergedIsShowTitle:f,mergedShowAnimation:u,mergedColor:a,itemWidth:c,direction:r,handleClick:h,size:g,border:b}=D(t,o);return()=>{var O,W;const V={[e.e("column-margin")]:r==="column",[e.e("wrap")]:typeof c!="undefined"},v=c?[`width: ${c}px`]:[],y={[e.b()]:!0,active:i.value,"half-checked":t.halfChecked,disabled:s.value,unchecked:!i.value},k=f.value?t.title||t.label:"",n=a.value&&t.halfChecked||a.value?`linear-gradient(${a.value}, ${a.value})`:"",C=[`border-color:${(i.value||t.halfChecked)&&a.value?a.value:""}`,`background-image:${n}`,`background-color:${a.value&&t.halfChecked?a.value:""}`],B={[e.e("material")]:!0,"custom-color":a.value,[e.m("no-label")]:!t.label&&!o.slots.default,[e.m("no-animation")]:!u.value,[e.e("default-background")]:!t.halfChecked},P={[e.e("tick")]:!0,[e.m("no-animation")]:!u.value},w={[e.m(g.value)]:b.value,[e.m("bordered")]:b.value},F=M=>M.stopPropagation(),L={indeterminate:t.halfChecked};return l.createVNode("div",{class:V,style:v},[l.createVNode("div",{class:y},[l.createVNode("label",{title:k,onClick:h,class:w,style:{width:c?"100%":"auto"}},[l.createVNode("input",l.mergeProps({name:t.name||t.value,class:e.e("input"),type:"checkbox"},L,{checked:i.value,disabled:s.value,onClick:F,onChange:F}),null),l.createVNode("span",{style:C,class:B},[l.createVNode("span",{class:e.e("halfchecked-bg")},null),l.createVNode("svg",{viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg",class:e.e("tick-wrap")},[l.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[l.createVNode("polygon",{"fill-rule":"nonzero",points:"5.17391304 6.56521739 7.7173913 9.10869565 11.826087 5 13 6.17391304 7.7173913 11.4565217 4 7.73913043",class:P},null)])])]),t.label||((W=(O=o.slots).default)==null?void 0:W.call(O))])])])}}}),Z="",A=l.defineComponent({name:"DCheckboxGroup",props:z,emits:["change","update:modelValue"],setup(t,o){const e=R("checkbox"),{defaultOpt:i}=U(t,o);return()=>{var u,a;let s=(a=(u=o.slots).default)==null?void 0:a.call(u);const f=()=>{var c;return s||(((c=t.options)==null?void 0:c.length)>0&&(s=t.options.map(r=>{let h=null;return typeof r=="string"?h=Object.assign({},i,{label:r,value:r}):typeof r=="object"&&(h=Object.assign({},i,j($({},r),{label:r.name}))),l.createVNode(T,h,null)})),s)};return l.createVNode("div",{class:e.e("group")},[l.createVNode("div",{class:{[e.m("list-inline")]:t.direction==="row"}},[f()])])}}}),G="",I=l.defineComponent({name:"DCheckboxButton",props:p,emits:["change","update:checked","update:modelValue"],setup(t,o){const e=R("checkbox-button"),{mergedChecked:i,mergedDisabled:s,mergedIsShowTitle:f,mergedColor:u,handleClick:a,size:c}=D(t,o),{mergedTextColor:r}=q();return()=>{var y,k;const h=f.value?t.title||t.label:"",g=[`border-color:${i.value&&u.value?u.value:""}`,`background-color:${i.value&&u.value?u.value:""}`,`color:${i.value&&r.value?r.value:""}`],b={[e.b()]:!0,active:i.value,disabled:s.value,unchecked:!i.value},V={[e.e("content")]:!0,[e.m(c.value)]:!0},v=n=>n.stopPropagation();return l.createVNode("label",{title:h,onClick:a,class:b},[l.createVNode("input",{name:t.name||t.value,class:e.e("input"),type:"checkbox",checked:i.value,disabled:s.value,onClick:v,onChange:v},null),l.createVNode("span",{style:g,class:V},[t.label||((k=(y=o.slots).default)==null?void 0:k.call(y))])])}}}),K={title:"Checkbox \u590D\u9009\u6846",category:"\u6570\u636E\u5F55\u5165",status:"100%",install(t){t.component(T.name,T),t.component(A.name,A),t.component(I.name,I)}};d.Checkbox=T,d.CheckboxButton=I,d.CheckboxGroup=A,d.checkboxGroupInjectionKey=S,d.checkboxGroupProps=z,d.checkboxProps=p,d.default=K,Object.defineProperty(d,"__esModule",{value:!0}),d[Symbol.toStringTag]="Module"});
|
package/checkbox/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.devui-checkbox{position:relative;display:flex;display:-ms-flexbox;align-items:center;-ms-flex-align:center;height:100%;margin:0}.devui-checkbox .devui-
|
|
1
|
+
.devui-checkbox{position:relative;display:flex;display:-ms-flexbox;align-items:center;-ms-flex-align:center;height:100%;margin:0}.devui-checkbox .devui-checkbox__tick-wrap{position:absolute}.devui-checkbox .devui-checkbox__tick-wrap .devui-checkbox__tick{fill:var(--devui-light-text, #ffffff);stroke-dashoffset:50;opacity:0;transform:scale(0);transform-origin:50% 50%;transition:stroke-dashoffset .2s ease-in-out,opacity .2s ease-in-out,transform .2s ease-in-out}.devui-checkbox.active:not(.half-checked) .devui-checkbox__tick{opacity:1;stroke-dashoffset:0;transform:scale(1);transition:stroke-dashoffset .3s cubic-bezier(.755,.05,.855,.06),opacity .2s cubic-bezier(.755,.05,.855,.06)}.devui-checkbox.active:not(.disabled) .devui-checkbox__material:not(.custom-color),.devui-checkbox.half-checked:not(.disabled) .devui-checkbox__material:not(.custom-color){border-color:var(--devui-brand, #5e7ce0)}.devui-checkbox.active .devui-checkbox--bordered,.devui-checkbox.half-checked .devui-checkbox--bordered{border-color:var(--devui-brand, #5e7ce0)}.devui-checkbox.active:not(.disabled) .devui-checkbox__material{background-size:100% 100%;transition:background-size .2s ease-in-out,border-color .2s ease-in-out}.devui-checkbox.unchecked:not(.disabled) .devui-checkbox__material:not(.custom-color){background-size:0% 0%;transition:background-size .2s ease-in-out,border-color .2s ease-in-out}.devui-checkbox.unchecked:not(.disabled) .devui-checkbox__material:not(.custom-color):hover{border-color:var(--devui-icon-fill-active, #5e7ce0)}.devui-checkbox.unchecked:not(.disabled) .devui-checkbox__material.custom-color{background-size:0% 0%;transition:background-size .2s ease-in-out,border-color .2s ease-in-out}.devui-checkbox.half-checked .devui-checkbox__material:not(.custom-color){background-color:var(--devui-brand, #5e7ce0)}.devui-checkbox.half-checked .devui-checkbox__material:not(.custom-color)>.devui-checkbox__halfchecked-bg{opacity:1;transform:scale(.4288);transition:transform .2s cubic-bezier(.755,.05,.855,.06);background-color:var(--devui-light-text, #ffffff)}.devui-checkbox.half-checked .devui-checkbox__material.custom-color>.devui-checkbox__halfchecked-bg{opacity:1;transform:scale(.4288);transition:transform .2s cubic-bezier(.755,.05,.855,.06);background-color:var(--devui-light-text, #ffffff)}.devui-checkbox .devui-checkbox__material{text-align:initial;height:14px;width:14px;position:relative;user-select:none;border:1px solid var(--devui-line, #adb0b8);border-radius:var(--devui-border-radius, 2px);background:linear-gradient(var(--devui-brand, #5e7ce0),var(--devui-brand, #5e7ce0)) no-repeat center/0%;margin-right:8px;vertical-align:text-bottom}.devui-checkbox .devui-checkbox__material.devui-checkbox__default-background{background-color:var(--devui-base-bg, #ffffff)}.devui-checkbox .devui-checkbox__material.devui-checkbox--no-label{margin-right:0}.devui-checkbox .devui-checkbox__material>.devui-checkbox__halfchecked-bg{display:inline-block;position:absolute;content:"";background-color:var(--devui-light-text, #ffffff);top:0;left:0;height:100%;width:100%;transform:scale(1);opacity:0}.devui-checkbox .devui-checkbox__material>svg{width:14px;height:14px}.devui-checkbox:not(.disabled).half-checked .devui-checkbox__material:not(.custom-color):focus,.devui-checkbox:not(.disabled).half-checked .devui-checkbox__material:not(.custom-color):active,.devui-checkbox:not(.disabled).half-checked .devui-checkbox__material:not(.custom-color):hover{background-color:var(--devui-icon-fill-active, #5e7ce0)}.devui-checkbox:not(.disabled).half-checked .devui-checkbox__material:not(.custom-color):active,.devui-checkbox:not(.disabled).half-checked .devui-checkbox__material:not(.custom-color):focus,.devui-checkbox:not(.disabled).half-checked .devui-checkbox__material:not(.custom-color):hover:active,.devui-checkbox:not(.disabled).half-checked .devui-checkbox__material:not(.custom-color):hover:focus{background-color:var(--devui-brand-active-focus, #344899)}.devui-checkbox__input{opacity:0;position:absolute;margin:0;z-index:-1;width:0;height:0;overflow:hidden;left:0;pointer-events:none}.devui-checkbox label{position:relative;font-weight:400;height:18px;line-height:18px;cursor:pointer;color:var(--devui-text, #252b3a);margin:0;display:block}.devui-checkbox label.devui-checkbox--lg{font-size:14px}.devui-checkbox label.devui-checkbox--lg .devui-checkbox__material{width:16px;height:16px}.devui-checkbox label.devui-checkbox--lg .devui-checkbox__material>svg{width:16px;height:16px}.devui-checkbox label.devui-checkbox--lg.devui-checkbox--bordered{height:40px;line-height:40px;padding:0 15px 0 10px}.devui-checkbox label.devui-checkbox--md{font-size:14px}.devui-checkbox label.devui-checkbox--md .devui-checkbox__material{width:16px;height:16px}.devui-checkbox label.devui-checkbox--md .devui-checkbox__material>svg{width:16px;height:16px}.devui-checkbox label.devui-checkbox--md.devui-checkbox--bordered{height:36px;line-height:36px;padding:0 15px 0 10px}.devui-checkbox label.devui-checkbox--sm{font-size:12px}.devui-checkbox label.devui-checkbox--sm .devui-checkbox__material{width:14px;height:14px}.devui-checkbox label.devui-checkbox--sm .devui-checkbox__material>svg{width:14px;height:14px}.devui-checkbox label.devui-checkbox--sm.devui-checkbox--bordered{height:32px;line-height:32px;padding:0 15px 0 10px}.devui-checkbox label.devui-checkbox--xs{font-size:12px}.devui-checkbox label.devui-checkbox--xs .devui-checkbox__material{width:14px;height:14px}.devui-checkbox label.devui-checkbox--xs .devui-checkbox__material>svg{width:14px;height:14px}.devui-checkbox label.devui-checkbox--xs.devui-checkbox--bordered{height:28px;line-height:28px;padding:0 15px 0 10px}.devui-checkbox label.devui-checkbox--bordered{border:1px solid var(--devui-disabled-line, #dfe1e6);border-radius:var(--devui-border-radius, 2px)}.devui-checkbox label>span{display:inline-block;box-sizing:content-box;vertical-align:top}.devui-checkbox.disabled label{cursor:not-allowed;color:var(--devui-disabled-text, #adb0b8)}.devui-checkbox.disabled .devui-checkbox__material{border-color:var(--devui-icon-fill-active-disabled, #beccfa);background-color:var(--devui-icon-fill-active-disabled, #beccfa)}.devui-checkbox.disabled.unchecked .devui-checkbox__material{border-color:var(--devui-disabled-line, #dfe1e6);background-color:var(--devui-disabled-bg, #f5f5f6)}.devui-checkbox.disabled.half-checked .devui-checkbox__material{background-color:var(--devui-disabled-bg, #f5f5f6)}.devui-checkbox.disabled.half-checked .devui-checkbox__material .devui-checkbox__halfchecked-bg{transform:scale(.4288);background-color:var(--devui-disabled-text, #adb0b8);opacity:1}.devui-checkbox.disabled.active svg polygon{fill:var(--devui-light-text, #ffffff)}.devui-checkbox--no-animation{transition:none!important}.devui-checkbox__column-margin{height:28px;line-height:28px}.devui-checkbox__wrap .devui-checkbox label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host{display:block}.devui-checkbox--list-inline{min-height:28px;line-height:28px;display:flex;flex-wrap:wrap;justify-content:flex-start;align-items:center;margin:-8px 0 0}.devui-checkbox--list-inline div:not(:last-child){margin-right:20px}.devui-checkbox--list-inline>*{margin-top:8px}.devui-checkbox-button{display:inline-block;position:relative}.devui-checkbox-button__input{opacity:0;position:absolute;margin:0;z-index:-1;width:0;height:0;overflow:hidden;left:0;pointer-events:none}.devui-checkbox-button__content{font-size:14px;color:var(--devui-text, #252b3a);padding:10px 20px;cursor:pointer;border:1px solid var(--devui-line, #adb0b8);border-left:none;display:inline-block;line-height:1;user-select:none;box-shadow:-1px 0 #e5f0fb}.devui-checkbox-button__content.devui-checkbox-button--lg{font-size:14px;padding:12px 20px}.devui-checkbox-button__content.devui-checkbox-button--md{font-size:14px;padding:10px 20px}.devui-checkbox-button__content.devui-checkbox-button--sm{font-size:12px;padding:9px 15px}.devui-checkbox-button__content.devui-checkbox-button--xs{font-size:12px;padding:7px 15px}.devui-checkbox-button.active .devui-checkbox-button__content{color:#fff;background-color:var(--devui-brand, #5e7ce0);border-color:var(--devui-brand, #5e7ce0)}.devui-checkbox-button.active.disabled .devui-checkbox-button__content{color:#fff;background-color:var(--devui-icon-fill-active-disabled, #beccfa)}.devui-checkbox-button.disabled .devui-checkbox-button__content{cursor:not-allowed;color:var(--devui-disabled-text, #adb0b8);background-color:#fff;border-color:var(--devui-disabled-line, #dfe1e6)}.devui-checkbox-button:first-child .devui-checkbox-button__content{border-top-left-radius:var(--devui-border-radius, 2px);border-bottom-left-radius:var(--devui-border-radius, 2px);border-left:1px solid var(--devui-line, #adb0b8);box-shadow:none}.devui-checkbox-button:last-child .devui-checkbox-button__content{border-top-right-radius:var(--devui-border-radius, 2px);border-bottom-right-radius:var(--devui-border-radius, 2px)}
|
package/date-picker/index.es.js
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
2
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
3
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var __objRest = (source, exclude) => {
|
|
5
|
+
var target = {};
|
|
6
|
+
for (var prop in source)
|
|
7
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
8
|
+
target[prop] = source[prop];
|
|
9
|
+
if (source != null && __getOwnPropSymbols)
|
|
10
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
11
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
12
|
+
target[prop] = source[prop];
|
|
13
|
+
}
|
|
14
|
+
return target;
|
|
15
|
+
};
|
|
16
|
+
import { inject, computed, ref, toRefs, defineComponent, createVNode, resolveDynamicComponent, mergeProps, shallowRef, watch, createTextVNode, reactive, onMounted, onUnmounted } from "vue";
|
|
2
17
|
const getDateTime = (d) => {
|
|
3
18
|
const year = d.getFullYear();
|
|
4
19
|
const month = d.getMonth() + 1;
|
|
@@ -201,175 +216,145 @@ const betweenDate = (date, left, right) => {
|
|
|
201
216
|
return true;
|
|
202
217
|
};
|
|
203
218
|
const inputProps = {
|
|
204
|
-
|
|
219
|
+
modelValue: {
|
|
205
220
|
type: String,
|
|
206
|
-
default:
|
|
221
|
+
default: ""
|
|
207
222
|
},
|
|
208
223
|
disabled: {
|
|
209
224
|
type: Boolean,
|
|
210
225
|
default: false
|
|
211
226
|
},
|
|
212
|
-
autoFocus: {
|
|
213
|
-
type: Boolean,
|
|
214
|
-
default: false
|
|
215
|
-
},
|
|
216
|
-
maxLength: {
|
|
217
|
-
type: Number,
|
|
218
|
-
default: Number.MAX_SAFE_INTEGER
|
|
219
|
-
},
|
|
220
|
-
cssClass: {
|
|
221
|
-
type: String,
|
|
222
|
-
default: ""
|
|
223
|
-
},
|
|
224
227
|
error: {
|
|
225
228
|
type: Boolean,
|
|
226
229
|
default: false
|
|
227
230
|
},
|
|
228
231
|
size: {
|
|
229
232
|
type: String,
|
|
230
|
-
default: ""
|
|
233
|
+
default: "md"
|
|
231
234
|
},
|
|
232
|
-
|
|
235
|
+
validateEvent: {
|
|
233
236
|
type: Boolean,
|
|
234
|
-
default:
|
|
237
|
+
default: true
|
|
235
238
|
},
|
|
236
|
-
|
|
239
|
+
prefix: {
|
|
237
240
|
type: String,
|
|
238
241
|
default: ""
|
|
239
242
|
},
|
|
240
|
-
|
|
241
|
-
type:
|
|
242
|
-
default:
|
|
243
|
-
},
|
|
244
|
-
onChange: {
|
|
245
|
-
type: Function,
|
|
246
|
-
default: void 0
|
|
247
|
-
},
|
|
248
|
-
onKeydown: {
|
|
249
|
-
type: Function,
|
|
250
|
-
default: void 0
|
|
243
|
+
suffix: {
|
|
244
|
+
type: String,
|
|
245
|
+
default: ""
|
|
251
246
|
},
|
|
252
|
-
|
|
253
|
-
type:
|
|
254
|
-
default:
|
|
247
|
+
showPassword: {
|
|
248
|
+
type: Boolean,
|
|
249
|
+
default: false
|
|
255
250
|
},
|
|
256
|
-
|
|
257
|
-
type:
|
|
258
|
-
default:
|
|
251
|
+
clearable: {
|
|
252
|
+
type: Boolean,
|
|
253
|
+
default: false
|
|
259
254
|
}
|
|
260
255
|
};
|
|
261
256
|
const FORM_ITEM_TOKEN = Symbol("dFormItem");
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
focus: {
|
|
267
|
-
mounted: function(el, binding) {
|
|
268
|
-
if (binding.value) {
|
|
269
|
-
el.focus();
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
},
|
|
274
|
-
props: inputProps,
|
|
275
|
-
emits: ["update:modelValue", "focus", "blur", "change", "keydown"],
|
|
276
|
-
setup(props, ctx) {
|
|
277
|
-
const formItemContext = inject(FORM_ITEM_TOKEN);
|
|
278
|
-
const sizeCls = computed(() => `devui-input-${props.size}`);
|
|
279
|
-
const showPwdIcon = ref(false);
|
|
280
|
-
const inputType = ref("text");
|
|
281
|
-
const isValidateError = computed(() => (formItemContext == null ? void 0 : formItemContext.validateState) === "error");
|
|
282
|
-
const inputCls = computed(() => ({
|
|
283
|
-
"devui-error": props.error || isValidateError.value,
|
|
284
|
-
[props.cssClass]: true,
|
|
285
|
-
"devui-input-restore": showPwdIcon.value,
|
|
286
|
-
[sizeCls.value]: props.size !== ""
|
|
287
|
-
}));
|
|
288
|
-
const showPreviewIcon = computed(() => inputType.value === "password");
|
|
289
|
-
watch(() => props.showPassword, (flg) => {
|
|
290
|
-
inputType.value = flg ? "password" : "text";
|
|
291
|
-
showPwdIcon.value = props.showPassword;
|
|
292
|
-
}, {
|
|
293
|
-
immediate: true
|
|
294
|
-
});
|
|
295
|
-
watch(() => props.modelValue, () => {
|
|
296
|
-
formItemContext == null ? void 0 : formItemContext.validate("change").catch((err) => console.warn(err));
|
|
297
|
-
});
|
|
298
|
-
const onInput = ($event) => {
|
|
299
|
-
ctx.emit("update:modelValue", $event.target.value);
|
|
300
|
-
}, onFocus = () => {
|
|
301
|
-
ctx.emit("focus");
|
|
302
|
-
}, onBlur = () => {
|
|
303
|
-
ctx.emit("blur");
|
|
304
|
-
formItemContext == null ? void 0 : formItemContext.validate("blur").catch((err) => console.warn(err));
|
|
305
|
-
}, onChange = ($event) => {
|
|
306
|
-
ctx.emit("change", $event.target.value);
|
|
307
|
-
}, onKeydown = ($event) => {
|
|
308
|
-
ctx.emit("keydown", $event);
|
|
309
|
-
}, onChangeInputType = () => {
|
|
310
|
-
inputType.value = inputType.value === "password" ? "text" : "password";
|
|
311
|
-
};
|
|
312
|
-
return {
|
|
313
|
-
inputCls,
|
|
314
|
-
inputType,
|
|
315
|
-
showPreviewIcon,
|
|
316
|
-
showPwdIcon,
|
|
317
|
-
onInput,
|
|
318
|
-
onFocus,
|
|
319
|
-
onBlur,
|
|
320
|
-
onChange,
|
|
321
|
-
onKeydown,
|
|
322
|
-
onChangeInputType
|
|
323
|
-
};
|
|
324
|
-
},
|
|
325
|
-
render() {
|
|
326
|
-
const {
|
|
327
|
-
modelValue,
|
|
328
|
-
showPreviewIcon,
|
|
329
|
-
showPwdIcon,
|
|
330
|
-
inputCls,
|
|
331
|
-
inputType,
|
|
332
|
-
maxLength,
|
|
333
|
-
autoFocus,
|
|
334
|
-
placeholder,
|
|
335
|
-
disabled,
|
|
336
|
-
onInput,
|
|
337
|
-
onFocus,
|
|
338
|
-
onBlur,
|
|
339
|
-
onChange,
|
|
340
|
-
onKeydown,
|
|
341
|
-
onChangeInputType
|
|
342
|
-
} = this;
|
|
343
|
-
return createVNode("div", {
|
|
344
|
-
"class": "devui-input__wrap"
|
|
345
|
-
}, [withDirectives(createVNode("input", mergeProps({
|
|
346
|
-
dinput: true
|
|
347
|
-
}, {
|
|
348
|
-
"value": modelValue,
|
|
349
|
-
"disabled": disabled,
|
|
350
|
-
"type": inputType,
|
|
351
|
-
"maxlength": maxLength,
|
|
352
|
-
"placeholder": placeholder,
|
|
353
|
-
"class": inputCls,
|
|
354
|
-
"onInput": onInput,
|
|
355
|
-
"onFocus": onFocus,
|
|
356
|
-
"onBlur": onBlur,
|
|
357
|
-
"onChange": onChange,
|
|
358
|
-
"onKeydown": onKeydown
|
|
359
|
-
}), null), [[resolveDirective("focus"), autoFocus]]), showPwdIcon && createVNode("div", {
|
|
360
|
-
"class": "devui-input__preview",
|
|
361
|
-
"onClick": onChangeInputType
|
|
362
|
-
}, [showPreviewIcon ? createVNode(resolveComponent("d-icon"), {
|
|
363
|
-
"name": "preview-forbidden",
|
|
364
|
-
"size": "12px",
|
|
365
|
-
"key": 1
|
|
366
|
-
}, null) : createVNode(resolveComponent("d-icon"), {
|
|
367
|
-
"name": "preview",
|
|
368
|
-
"size": "12px",
|
|
369
|
-
"key": 2
|
|
370
|
-
}, null)])]);
|
|
257
|
+
function createBem(namespace, element, modifier) {
|
|
258
|
+
let cls = namespace;
|
|
259
|
+
if (element) {
|
|
260
|
+
cls += `__${element}`;
|
|
371
261
|
}
|
|
372
|
-
|
|
262
|
+
if (modifier) {
|
|
263
|
+
cls += `--${modifier}`;
|
|
264
|
+
}
|
|
265
|
+
return cls;
|
|
266
|
+
}
|
|
267
|
+
function useNamespace(block, needDot = false) {
|
|
268
|
+
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
269
|
+
const b = () => createBem(namespace);
|
|
270
|
+
const e = (element) => element ? createBem(namespace, element) : "";
|
|
271
|
+
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
272
|
+
const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
|
|
273
|
+
return {
|
|
274
|
+
b,
|
|
275
|
+
e,
|
|
276
|
+
m,
|
|
277
|
+
em
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
function useInputRender(props, ctx) {
|
|
281
|
+
const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
|
|
282
|
+
const isValidateError = computed(() => (formItemContext == null ? void 0 : formItemContext.validateState) === "error");
|
|
283
|
+
const ns = useNamespace("input");
|
|
284
|
+
const slotNs = useNamespace("input-slot");
|
|
285
|
+
const isFocus = ref(false);
|
|
286
|
+
const { error, size, disabled } = toRefs(props);
|
|
287
|
+
const slots = ctx.slots;
|
|
288
|
+
const _a = ctx.attrs, { style, class: customClass } = _a, otherAttrs = __objRest(_a, ["style", "class"]);
|
|
289
|
+
const customStyle = { style };
|
|
290
|
+
const wrapClasses = computed(() => ({
|
|
291
|
+
[ns.e("wrapper")]: true,
|
|
292
|
+
[ns.m("focus")]: isFocus.value,
|
|
293
|
+
[ns.m("disabled")]: disabled.value,
|
|
294
|
+
[ns.m("error")]: error.value || isValidateError.value,
|
|
295
|
+
[ns.m("feedback")]: formItemContext == null ? void 0 : formItemContext.showFeedback
|
|
296
|
+
}));
|
|
297
|
+
const inputClasses = computed(() => [
|
|
298
|
+
{
|
|
299
|
+
[ns.b()]: true,
|
|
300
|
+
[ns.m(size.value)]: true,
|
|
301
|
+
[slotNs.b()]: slots.prepend || slots.append,
|
|
302
|
+
[ns.m("append")]: slots.append,
|
|
303
|
+
[ns.m("prepend")]: slots.prepend
|
|
304
|
+
},
|
|
305
|
+
customClass
|
|
306
|
+
]);
|
|
307
|
+
return { isFocus, wrapClasses, inputClasses, customStyle, otherAttrs };
|
|
308
|
+
}
|
|
309
|
+
function useInputEvent(isFocus, props, ctx) {
|
|
310
|
+
const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
|
|
311
|
+
const onFocus = (e) => {
|
|
312
|
+
isFocus.value = true;
|
|
313
|
+
ctx.emit("focus", e);
|
|
314
|
+
};
|
|
315
|
+
const onBlur = (e) => {
|
|
316
|
+
isFocus.value = false;
|
|
317
|
+
ctx.emit("blur", e);
|
|
318
|
+
if (props.validateEvent) {
|
|
319
|
+
formItemContext == null ? void 0 : formItemContext.validate("blur").catch((err) => console.warn(err));
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
const onInput = (e) => {
|
|
323
|
+
ctx.emit("update:modelValue", e.target.value);
|
|
324
|
+
};
|
|
325
|
+
const onChange = (e) => {
|
|
326
|
+
ctx.emit("change", e.target.value);
|
|
327
|
+
};
|
|
328
|
+
const onKeydown = (e) => {
|
|
329
|
+
ctx.emit("keydown", e);
|
|
330
|
+
};
|
|
331
|
+
const onClear = () => {
|
|
332
|
+
ctx.emit("update:modelValue", "");
|
|
333
|
+
ctx.emit("clear");
|
|
334
|
+
};
|
|
335
|
+
return { onFocus, onBlur, onInput, onChange, onKeydown, onClear };
|
|
336
|
+
}
|
|
337
|
+
function useInputFunction(input2) {
|
|
338
|
+
const refInput = computed(() => input2.value);
|
|
339
|
+
const select = () => {
|
|
340
|
+
var _a;
|
|
341
|
+
(_a = refInput.value) == null ? void 0 : _a.select();
|
|
342
|
+
};
|
|
343
|
+
const focus = () => {
|
|
344
|
+
var _a;
|
|
345
|
+
(_a = refInput.value) == null ? void 0 : _a.focus();
|
|
346
|
+
};
|
|
347
|
+
const blur = () => {
|
|
348
|
+
var _a;
|
|
349
|
+
(_a = refInput.value) == null ? void 0 : _a.blur();
|
|
350
|
+
};
|
|
351
|
+
return { select, focus, blur };
|
|
352
|
+
}
|
|
353
|
+
var input = "";
|
|
354
|
+
function isUrl(value) {
|
|
355
|
+
return /^((http|https):)?\/\//.test(value);
|
|
356
|
+
}
|
|
357
|
+
const DEFAULT_PREFIX = "icon";
|
|
373
358
|
const iconProps = {
|
|
374
359
|
name: {
|
|
375
360
|
type: String,
|
|
@@ -377,43 +362,211 @@ const iconProps = {
|
|
|
377
362
|
required: true
|
|
378
363
|
},
|
|
379
364
|
size: {
|
|
380
|
-
type: String,
|
|
365
|
+
type: [Number, String],
|
|
381
366
|
default: "inherit"
|
|
382
367
|
},
|
|
383
368
|
color: {
|
|
384
369
|
type: String,
|
|
385
370
|
default: "inherit"
|
|
386
371
|
},
|
|
372
|
+
component: {
|
|
373
|
+
type: Object,
|
|
374
|
+
default: null
|
|
375
|
+
},
|
|
387
376
|
classPrefix: {
|
|
388
377
|
type: String,
|
|
389
|
-
default:
|
|
378
|
+
default: DEFAULT_PREFIX
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
const svgIconProps = {
|
|
382
|
+
name: {
|
|
383
|
+
type: String,
|
|
384
|
+
default: "",
|
|
385
|
+
required: true
|
|
386
|
+
},
|
|
387
|
+
color: {
|
|
388
|
+
type: String,
|
|
389
|
+
default: "inherit"
|
|
390
|
+
},
|
|
391
|
+
size: {
|
|
392
|
+
type: [Number, String],
|
|
393
|
+
default: "inherit"
|
|
390
394
|
}
|
|
391
395
|
};
|
|
396
|
+
var icon = "";
|
|
397
|
+
var svgIcon = defineComponent({
|
|
398
|
+
name: "DSvgIcon",
|
|
399
|
+
props: svgIconProps,
|
|
400
|
+
setup(props) {
|
|
401
|
+
const {
|
|
402
|
+
name,
|
|
403
|
+
color,
|
|
404
|
+
size
|
|
405
|
+
} = toRefs(props);
|
|
406
|
+
const ns = useNamespace("svg-icon");
|
|
407
|
+
const iconName = computed(() => `#icon-${name.value}`);
|
|
408
|
+
const iconSize = computed(() => {
|
|
409
|
+
return typeof size.value === "number" ? `${size.value}px` : size.value;
|
|
410
|
+
});
|
|
411
|
+
const styles = {
|
|
412
|
+
width: iconSize.value,
|
|
413
|
+
height: iconSize.value
|
|
414
|
+
};
|
|
415
|
+
return () => {
|
|
416
|
+
return createVNode("svg", {
|
|
417
|
+
"class": ns.b(),
|
|
418
|
+
"style": styles
|
|
419
|
+
}, [createVNode("use", {
|
|
420
|
+
"xlink:href": iconName.value,
|
|
421
|
+
"fill": color.value
|
|
422
|
+
}, null)]);
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
});
|
|
392
426
|
var Icon = defineComponent({
|
|
393
427
|
name: "DIcon",
|
|
394
428
|
props: iconProps,
|
|
395
|
-
setup(props
|
|
429
|
+
setup(props, {
|
|
430
|
+
attrs
|
|
431
|
+
}) {
|
|
396
432
|
const {
|
|
433
|
+
component,
|
|
397
434
|
name,
|
|
398
435
|
size,
|
|
399
436
|
color,
|
|
400
437
|
classPrefix
|
|
401
438
|
} = toRefs(props);
|
|
402
|
-
|
|
403
|
-
|
|
439
|
+
const IconComponent = component.value ? resolveDynamicComponent(component.value) : resolveDynamicComponent(svgIcon);
|
|
440
|
+
const iconSize = computed(() => {
|
|
441
|
+
return typeof size.value === "number" ? `${size.value}px` : size.value;
|
|
442
|
+
});
|
|
443
|
+
const svgIconDom = () => {
|
|
444
|
+
return createVNode(IconComponent, mergeProps({
|
|
445
|
+
"name": name.value,
|
|
446
|
+
"color": color.value,
|
|
447
|
+
"size": iconSize.value
|
|
448
|
+
}, attrs), null);
|
|
449
|
+
};
|
|
450
|
+
const imgIconDom = () => {
|
|
451
|
+
return createVNode("img", mergeProps({
|
|
404
452
|
"src": name.value,
|
|
405
453
|
"alt": name.value.split("/")[name.value.split("/").length - 1],
|
|
406
454
|
"style": {
|
|
407
|
-
width:
|
|
408
|
-
verticalAlign: "text-bottom"
|
|
455
|
+
width: iconSize.value || ""
|
|
409
456
|
}
|
|
410
|
-
},
|
|
411
|
-
|
|
457
|
+
}, attrs), null);
|
|
458
|
+
};
|
|
459
|
+
const fontIconDom = () => {
|
|
460
|
+
const fontIconClass = /^icon-/.test(name.value) ? name.value : `${classPrefix.value}-${name.value}`;
|
|
461
|
+
return createVNode("i", mergeProps({
|
|
462
|
+
"class": [classPrefix.value, fontIconClass],
|
|
412
463
|
"style": {
|
|
413
|
-
fontSize:
|
|
464
|
+
fontSize: iconSize.value,
|
|
414
465
|
color: color.value
|
|
415
466
|
}
|
|
416
|
-
}, null);
|
|
467
|
+
}, attrs), null);
|
|
468
|
+
};
|
|
469
|
+
return () => {
|
|
470
|
+
return component.value ? svgIconDom() : isUrl(name.value) ? imgIconDom() : fontIconDom();
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
var Input = defineComponent({
|
|
475
|
+
name: "DInput",
|
|
476
|
+
inheritAttrs: false,
|
|
477
|
+
props: inputProps,
|
|
478
|
+
emits: ["update:modelValue", "focus", "blur", "input", "change", "keydown", "clear"],
|
|
479
|
+
setup(props, ctx) {
|
|
480
|
+
const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
|
|
481
|
+
const {
|
|
482
|
+
modelValue,
|
|
483
|
+
disabled
|
|
484
|
+
} = toRefs(props);
|
|
485
|
+
const ns = useNamespace("input");
|
|
486
|
+
const slotNs = useNamespace("input-slot");
|
|
487
|
+
const {
|
|
488
|
+
isFocus,
|
|
489
|
+
wrapClasses,
|
|
490
|
+
inputClasses,
|
|
491
|
+
customStyle,
|
|
492
|
+
otherAttrs
|
|
493
|
+
} = useInputRender(props, ctx);
|
|
494
|
+
const {
|
|
495
|
+
onFocus,
|
|
496
|
+
onBlur,
|
|
497
|
+
onInput,
|
|
498
|
+
onChange,
|
|
499
|
+
onKeydown,
|
|
500
|
+
onClear
|
|
501
|
+
} = useInputEvent(isFocus, props, ctx);
|
|
502
|
+
const input2 = shallowRef();
|
|
503
|
+
const {
|
|
504
|
+
select,
|
|
505
|
+
focus,
|
|
506
|
+
blur
|
|
507
|
+
} = useInputFunction(input2);
|
|
508
|
+
const passwordVisible = ref(false);
|
|
509
|
+
const clickPasswordIcon = () => {
|
|
510
|
+
passwordVisible.value = !passwordVisible.value;
|
|
511
|
+
focus();
|
|
512
|
+
};
|
|
513
|
+
const prefixVisiable = ctx.slots.prefix || props.prefix;
|
|
514
|
+
const suffixVisiable = ctx.slots.suffix || props.suffix || props.showPassword || props.clearable;
|
|
515
|
+
const showPwdVisible = computed(() => props.showPassword && !props.disabled);
|
|
516
|
+
const showClearable = computed(() => props.clearable && !props.disabled);
|
|
517
|
+
watch(() => props.modelValue, () => {
|
|
518
|
+
if (props.validateEvent) {
|
|
519
|
+
formItemContext == null ? void 0 : formItemContext.validate("change").catch((err) => console.warn(err));
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
ctx.expose({
|
|
523
|
+
select,
|
|
524
|
+
focus,
|
|
525
|
+
blur
|
|
526
|
+
});
|
|
527
|
+
return () => {
|
|
528
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
529
|
+
return createVNode("div", mergeProps({
|
|
530
|
+
"class": inputClasses.value
|
|
531
|
+
}, customStyle), [ctx.slots.prepend && createVNode("div", {
|
|
532
|
+
"class": slotNs.e("prepend")
|
|
533
|
+
}, [(_b = (_a = ctx.slots).prepend) == null ? void 0 : _b.call(_a)]), createVNode("div", {
|
|
534
|
+
"class": wrapClasses.value
|
|
535
|
+
}, [prefixVisiable && createVNode("span", {
|
|
536
|
+
"class": slotNs.e("prefix")
|
|
537
|
+
}, [ctx.slots.prefix && createVNode("div", null, [(_d = (_c = ctx.slots).prefix) == null ? void 0 : _d.call(_c)]), props.prefix && createVNode(Icon, {
|
|
538
|
+
"size": props.size,
|
|
539
|
+
"name": props.prefix
|
|
540
|
+
}, null)]), createVNode("input", mergeProps({
|
|
541
|
+
"ref": input2,
|
|
542
|
+
"value": modelValue.value,
|
|
543
|
+
"disabled": disabled.value,
|
|
544
|
+
"class": ns.e("inner")
|
|
545
|
+
}, otherAttrs, {
|
|
546
|
+
"type": props.showPassword ? passwordVisible.value ? "text" : "password" : "text",
|
|
547
|
+
"onInput": onInput,
|
|
548
|
+
"onFocus": onFocus,
|
|
549
|
+
"onBlur": onBlur,
|
|
550
|
+
"onChange": onChange,
|
|
551
|
+
"onKeydown": onKeydown
|
|
552
|
+
}), null), suffixVisiable && createVNode("span", {
|
|
553
|
+
"class": slotNs.e("suffix")
|
|
554
|
+
}, [props.suffix && createVNode(Icon, {
|
|
555
|
+
"size": props.size,
|
|
556
|
+
"name": props.suffix
|
|
557
|
+
}, null), ctx.slots.suffix && createVNode("div", null, [(_f = (_e = ctx.slots).suffix) == null ? void 0 : _f.call(_e)]), showPwdVisible.value && createVNode(Icon, {
|
|
558
|
+
"size": props.size,
|
|
559
|
+
"class": ns.em("password", "icon"),
|
|
560
|
+
"name": passwordVisible.value ? "preview" : "preview-forbidden",
|
|
561
|
+
"onClick": clickPasswordIcon
|
|
562
|
+
}, null), showClearable.value && createVNode(Icon, {
|
|
563
|
+
"size": props.size,
|
|
564
|
+
"class": ns.em("clear", "icon"),
|
|
565
|
+
"name": "close",
|
|
566
|
+
"onClick": onClear
|
|
567
|
+
}, null)])]), ctx.slots.append && createVNode("div", {
|
|
568
|
+
"class": slotNs.e("append")
|
|
569
|
+
}, [(_h = (_g = ctx.slots).append) == null ? void 0 : _h.call(_g)])]);
|
|
417
570
|
};
|
|
418
571
|
}
|
|
419
572
|
});
|