vue-devui 1.0.0-beta.13 → 1.0.0-beta.14

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.
@@ -0,0 +1 @@
1
+ var Ue=Object.defineProperty;var re=Object.getOwnPropertySymbols;var qe=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable;var j=(m,t,w)=>t in m?Ue(m,t,{enumerable:!0,configurable:!0,writable:!0,value:w}):m[t]=w,D=(m,t)=>{for(var w in t||(t={}))qe.call(t,w)&&j(m,w,t[w]);if(re)for(var w of re(t))Ge.call(t,w)&&j(m,w,t[w]);return m};var S=(m,t,w)=>(j(m,typeof t!="symbol"?t+"":t,w),w);(function(m,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(m=typeof globalThis!="undefined"?globalThis:m||self,t(m.index={},m.Vue))})(this,function(m,t){"use strict";const se={modelValue:{type:String,default:""},source:{type:Array,default:null},allowEmptyValueSearch:{type:Boolean,default:!1},appendToBody:{type:Boolean,default:!1},appendToBodyDirections:{type:Object,default:()=>({originX:"left",originY:"bottom",overlayX:"left",overlayY:"top"})},disabled:{type:Boolean,default:!1},delay:{type:Number,default:300},disabledKey:{type:String,default:null},formatter:{type:Function,default:e=>e?e.label||e.toString():""},isSearching:{type:Boolean,default:!1},sceneType:{type:String,default:null},searchFn:{type:Function,default:null},tipsText:{type:String,default:"\u6700\u8FD1\u8F93\u5165"},latestSource:{type:Array,default:null},valueParser:{type:Function,default:e=>e},enableLazyLoad:{type:Boolean,default:!1},dAutoCompleteWidth:{type:Number,default:null},showAnimation:{type:Boolean,default:!0},maxHeight:{type:Number,default:300},transInputFocusEmit:{type:Function,default:null},selectValue:{type:Function,default:null},loadMore:{type:Function,default:null}},M=Symbol("DropdownPropsKey");function ie(e,n){const o=(a,c)=>{const i={item:a,index:c};return e.slots.itemTemplate?e.slots.itemTemplate(i):null},l=()=>e.slots.noResultItemTemplate?e.slots.noResultItemTemplate(n.value):null,r=()=>e.slots.searchingTemplate?e.slots.searchingTemplate(n.value):null;return{customRenderSolts:()=>{const a={};return e.slots.itemTemplate&&(a.itemTemplate=o),e.slots.noResultItemTemplate&&(a.noResultItemTemplate=l),e.slots.searchingTemplate&&(a.searchingTemplate=r),a}}}function ue(e,n,o,l,r){const s=t.ref([]),a=t.ref(!1);return{handleSearch:async(u,f)=>{if(u==""&&!n.value){s.value=[],a.value=!1;return}let y=[];u=u.toLowerCase(),f?y=o.value:l.value?y=await l.value(u):o.value.forEach(d=>{let p=r.value(d);p=p.toLowerCase(),p.startsWith(u)&&y.push(d)}),s.value=y,s.value.length==0?a.value=!0:a.value=!1},recentlyFocus:u=>{u&&(s.value=u)},searchList:s,showNoResultItemTemplate:a}}function ce(e,n,o,l,r,s,a,c,i,u){const f=t.ref(!1),y=t.ref(),d=t.ref(!1),g=((k,O)=>{let b;return(...V)=>{b&&clearTimeout(b),b=setTimeout(async()=>{d.value=!0,await k(...V),d.value=!1},O)}})(async k=>{await a(k),f.value=!0},s.value),T=k=>{const O=k.target;d.value=!1,o.value=!1,e.emit("update:modelValue",O.value),g(O.value)},C=()=>{a(l.value),i(u.value),c.value&&c.value()},h=()=>{f.value=!1,d.value=!1,o.value=!1};return{handleClose:h,toggleMenu:()=>{r.value||(f.value?h():(f.value=!0,e.slots.noResultItemTemplate&&n.value.length==0&&l.value.trim()!=""&&(o.value=!0)))},onInput:T,onFocus:C,inputRef:y,visible:f,searchStatus:d}}function de(e,n,o,l,r,s){const a=t.ref(0),c=u=>{if(n.value.length==0)return 0;const f=n.value.indexOf(u);return f==-1?0:f};return{selectedIndex:a,selectOptionClick:async u=>{const f=r.value(u);e.emit("update:modelValue",f),s(),await l(f),a.value=c(f),o.value&&o.value()}}}function fe(e,n,o){const l=t.ref(!1),r=t.ref(),s=()=>{if(!e.enableLazyLoad&&l)return;const c=r.value,i=c.scrollHeight,u=c.clientHeight+c.scrollTop;u>=i&&u>=e.maxHeight&&(e.loadMore(),l.value=!0)};n.expose({loadFinish:a});async function a(){await o(e.modelValue,e.enableLazyLoad),l.value=!1}return{showLoading:l,dropDownRef:r,loadMore:s}}function pe(e,n,o,l,r,s,a,c){var y;const i=t.ref((y=l.value)!=null?y:0),u=d=>{const p=e.value,v=p.children[d];t.nextTick(()=>{if(v.scrollIntoViewIfNeeded)v.scrollIntoViewIfNeeded(!1);else{const g=p.getBoundingClientRect(),T=v.getBoundingClientRect();(T.bottom>g.bottom||T.top<g.top)&&v.scrollIntoView(!1)}})};return{hoverIndex:i,handlekeyDown:d=>{var g;const p=d.key||d.code;if(p==="Escape"&&(n.value&&o.value.length||r.value||s.value)){c();return}const v=n.value&&o.value.length&&!r.value&&!s.value;if(p==="ArrowDown"&&v){if(i.value===o.value.length-1){i.value=0,u(i.value);return}i.value=i.value+1,u(i.value)}else if(p==="ArrowUp"&&v){if(i.value===0){i.value=o.value.length-1,u(i.value);return}i.value=i.value-1,u(i.value)}if(p==="Enter"&&v){a(o.value[i.value]),i.value=(g=l.value)!=null?g:0;return}}}}var Qe="";class P{constructor(){S(this,"top","50%");S(this,"left","50%")}}const ve={message:String,backdrop:Boolean,view:{type:Object,default:()=>new P},zIndex:Number,isFull:{type:Boolean,default:!1}};class ye{constructor(){S(this,"target");S(this,"message");S(this,"loadingTemplateRef");S(this,"backdrop",!0);S(this,"positionType","relative");S(this,"view",new P);S(this,"zIndex")}}var Ze="",me=t.defineComponent({name:"DLoading",inheritAttrs:!1,props:ve,setup(e){const n={top:e.view.top,left:e.view.left,zIndex:e.zIndex};e.message||(n.background="none");const o=t.ref(!1);return{style:n,isShow:o,open:()=>{o.value=!0},close:()=>{o.value=!1}}},render(){var a;const{isShow:e,isFull:n,backdrop:o,style:l,message:r,$slots:s}=this;return e&&t.createVNode("div",{class:["devui-loading-contanier",n?"devui-loading--full":""]},[((a=s.default)==null?void 0:a.call(s))||t.createVNode("div",{class:"devui-loading-wrapper"},[o?t.createVNode("div",{class:"devui-loading-mask"},null):null,t.createVNode("div",{style:l,class:"devui-loading-area"},[t.createVNode("div",{class:"devui-busy-default-spinner"},[t.createVNode("div",{class:"devui-loading-bar1"},null),t.createVNode("div",{class:"devui-loading-bar2"},null),t.createVNode("div",{class:"devui-loading-bar3"},null),t.createVNode("div",{class:"devui-loading-bar4"},null)]),r?t.createVNode("span",{class:"devui-loading-text"},[r]):null])])])}});const z=Symbol("dev_component_container");function ge(e,n,o=null){const l=t.h(e,D({},n),o),r=document.createElement("div");return l[z]=r,t.render(l,r),l.component}function he(e){t.render(null,e==null?void 0:e.vnode[z])}const be=t.defineComponent(me),I=new WeakSet,E=e=>{if(!e)return!0;if(Array.isArray(e))return e.length===0;if(e instanceof Set||e instanceof Map)return e.size===0;if(e instanceof Promise)return!1;if(typeof e=="object")try{return Object.keys(e).length===0}catch{return!1}return!1},_=e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase(),we=e=>{switch(_(e)){case"promise":return[e];case"array":return e.some(o=>_(o)!=="promise")?(console.error(new TypeError("Binding values should all be of type Promise")),"error"):e;default:return!1}},H=e=>{I.delete(e),e.instance.proxy.close(),he(e.instance)},Y=(e,n)=>{if(n.value){const o=we(n.value);if(o==="error")return;e.instance.proxy.open(),e.appendChild(e.mask),I.add(e),o&&Promise.all(o).catch(l=>{console.error(new Error("Promise handling errors"),l)}).finally(()=>{H(e)})}else H(e)},X=e=>{e.removeAttribute("zindex"),e.removeAttribute("positiontype"),e.removeAttribute("backdrop"),e.removeAttribute("message"),e.removeAttribute("view"),e.removeAttribute("loadingtemplateref")},$=(e,n)=>{const o=D(D({},new ye),n),l=o.loadingTemplateRef,r=ge(be,D({},o),l?()=>l:null);e.style.position=o.positionType,e.options=o,e.instance=r,e.mask=r.proxy.$el},Ce={mounted:function(e,n,o){$(e,o.props),X(e),!E(n.value)&&Y(e,n)},updated:function(e,n,o){!E(n.value)&&I.has(e)||E(n.value)&&!I.has(e)||(!I.has(e)&&$(e,o.props),X(e),Y(e,n))}};var K=t.defineComponent({name:"DAutoCompleteDropdown",directives:{dLoading:Ce},setup(e,n){const o=t.inject(M),{visible:l,selectedIndex:r,selectOptionClick:s,searchList:a,searchStatus:c,dropDownRef:i,loadMore:u,showLoading:f,showNoResultItemTemplate:y,latestSource:d,modelValue:p,hoverIndex:v}=o,{disabled:g,maxHeight:T,appendToBody:C,formatter:h,disabledKey:N,isSearching:k}=o.props,O=b=>{b[N]||s(b)};return()=>t.withDirectives(t.createVNode("div",{class:["devui-dropdown-menu",C&&"devui-dropdown-menu-cdk",g&&"disabled",d.value&&"devui-dropdown-latestSource"]},[t.createVNode("ul",{ref:i,class:"devui-list-unstyled scroll-height",style:{maxHeight:`${T}px`},onScroll:u},[k&&n.slots.searchingTemplate&&c.value&&t.createVNode("li",{class:"devui-is-searching-template"},[t.createVNode("div",{class:"devui-no-data-tip"},[n.slots.searchingTemplate()])]),d.value&&!p.value&&t.createVNode("li",{class:"devui-popup-tips"},[t.createTextVNode("\u6700\u8FD1\u8F93\u5165")]),!y.value&&!c.value&&a!=null&&a.value.length>0&&a.value.map((b,V)=>t.createVNode("li",{onClick:()=>O(b),class:["devui-dropdown-item",r.value==V&&"selected",{disabled:N&&b[N]},{"devui-dropdown-bg":v.value==V}],title:h(b),key:h(b)},[n.slots.itemTemplate?n.slots.itemTemplate(b,V):h(b)])),!c.value&&a.value.length==0&&n.slots.noResultItemTemplate&&y.value&&t.createVNode("li",{class:"devui-no-result-template"},[t.createVNode("div",{class:"devui-no-data-tip"},[n.slots.noResultItemTemplate()])])])]),[[t.resolveDirective("dLoading"),f.value],[t.vShow,l.value&&a.value.length>0||n.slots.noResultItemTemplate&&y.value||k&&n.slots.searchingTemplate&&c.value]])}});const ke=typeof window!="undefined";function W(e,n,o){document.addEventListener?e&&n&&o&&e.addEventListener(n,o,!1):e&&n&&o&&e.attachEvent("on"+n,o)}const B=Symbol("@@clickoutside"),L=new Map;let U,A=0,q=!0;function G(e,n,o){return ke&&q&&(q=!1,W(document,"mousedown",l=>{U=l}),W(document,"mouseup",l=>{for(const[r,s]of L)s[B].documentHandler(l,U)})),function(l,r){!o||!n.instance||!l.target||!r.target||e.contains(l.target)||e.contains(r.target)||e===l.target||e[B].bindingFn&&e[B].bindingFn()}}const Te={beforeMount:function(e,n,o){A++,L.set(A,e),e[B]={nid:A,documentHandler:G(e,n,o),bindingFn:n.value}},updated:function(e,n,o){e[B].documentHandler=G(e,n,o),e[B].bindingFn=n.value},unmounted:function(e){L.delete(e[B].nid),delete e[B]}};var et="";function Ve(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}const Se=t.defineComponent({setup(e,n){return()=>{let o;return t.createVNode(t.Teleport,{to:"#d-overlay-anchor"},{default:()=>[t.createVNode(t.Transition,{name:"devui-overlay-fade"},Ve(o=t.renderSlot(n.slots,"default"))?o:{default:()=>[o]})]})}}}),Be={visible:{type:Boolean},backgroundBlock:{type:Boolean,default:!1},backgroundClass:{type:String,default:""},backgroundStyle:{type:[String,Object]},onBackdropClick:{type:Function},backdropClose:{type:Boolean,default:!0},hasBackdrop:{type:Boolean,default:!0}},Ne=["update:visible","backdropClick"],Oe=D({origin:{type:Object,require:!0},position:{type:Object,default:()=>({originX:"left",originY:"top",overlayX:"left",overlayY:"top"})}},Be);function Re(e,n){const o=t.computed(()=>["devui-overlay-background",e.backgroundClass,e.hasBackdrop?"devui-overlay-background__color":"devui-overlay-background__disabled"]),l=t.computed(()=>"devui-overlay"),r=a=>{var c;a.preventDefault(),(c=e.onBackdropClick)==null||c.call(e),e.backdropClose&&n.emit("update:visible",!1)},s=a=>a.cancelBubble=!0;return t.onMounted(()=>{const a=document.body,c=a.style.overflow,i=a.style.position;t.watch([()=>e.visible,()=>e.backgroundBlock],([u,f])=>{if(f){const y=a.getBoundingClientRect().y;u?(a.style.overflowY="scroll",a.style.position=u?"fixed":"",a.style.top=`${y}px`):(a.style.overflowY=c,a.style.position=i,a.style.top="",window.scrollTo(0,-y))}}),t.onUnmounted(()=>{document.body.style.overflow=c})}),{backgroundClass:o,overlayClass:l,handleBackdropClick:r,handleOverlayBubbleCancel:s}}function De(e){return!!(e==null?void 0:e.$el)}function J(e){return e instanceof Element?e:e&&typeof e=="object"&&e.$el instanceof Element?e.$el:null}const Ie=t.defineComponent({name:"DFlexibleOverlay",props:Oe,emits:Ne,setup(e,n){const o=t.ref(null),l=t.reactive({position:"absolute"});t.onMounted(async()=>{const i=(d,p,v)=>{const g=Ee(d,p,v);l.left=`${g.x}px`,l.top=`${g.y}px`},u=t.computed(()=>{const d=o.value,p=Fe(e.origin);if(!(!d||!p))return{origin:p,overlay:d}}),f=t.toRef(e,"visible"),y=t.toRef(e,"position");t.watch([u,f,y],async([d,p,v],g,T)=>{if(!p||!d)return;const{origin:C,overlay:h}=d;i(v,h.getBoundingClientRect(),C);const N=[je(()=>i(v,h.getBoundingClientRect(),C)),Me(h,k=>i(v,k[0].contentRect,C)),Pe(C,()=>i(v,h.getBoundingClientRect(),C))];T(()=>{N.forEach(k=>k())})})});const{backgroundClass:r,overlayClass:s,handleBackdropClick:a,handleOverlayBubbleCancel:c}=Re(e,n);return()=>t.createVNode(Se,null,{default:()=>[t.withDirectives(t.createVNode("div",{style:e.backgroundStyle,class:r.value,onClick:a},[t.createVNode("div",{ref:o,class:s.value,style:l,onClick:c},[t.renderSlot(n.slots,"default")])]),[[t.vShow,e.visible]])]})}});function Fe(e){return e instanceof Element?e:t.isRef(e)?J(e.value):De(e)?J(e):e}function Ee(e,n,o){const l=Le(o),r=xe(l,e);return Ae(r,n,e)}function Le(e){if(e instanceof Element)return e.getBoundingClientRect();const n=e.width||0,o=e.height||0;return{top:e.y,bottom:e.y+o,left:e.x,right:e.x+n,height:o,width:n}}function Ae(e,n,o){let l;const{width:r,height:s}=n;o.overlayX=="center"?l=e.x-r/2:l=o.overlayX=="left"?e.x:e.x-r;let a;return o.overlayY=="center"?a=e.y-s/2:a=o.overlayY=="top"?e.y:e.y-s,{x:l,y:a}}function xe(e,n){let o;if(n.originX=="center")o=e.left+e.width/2;else{const r=e.left,s=e.right;o=n.originX=="left"?r:s}let l;return n.originY=="center"?l=e.top+e.height/2:l=n.originY=="top"?e.top:e.bottom,{x:o,y:l}}function je(e){return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),window.addEventListener("orientationchange",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e),window.removeEventListener("orientationchange",e)}}function Me(e,n){if(e instanceof Element){const o=new ResizeObserver(n);return o.observe(e),()=>o.disconnect()}return()=>{}}function Pe(e,n){if(e instanceof Element){const o=new MutationObserver(n);return o.observe(e,{attributeFilter:["style"]}),()=>o.disconnect()}return()=>{}}function Q(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}var F=t.defineComponent({name:"DAutoComplete",directives:{ClickOutside:Te},props:se,emits:["update:modelValue"],setup(e,n){const{disabled:o,modelValue:l,appendToBody:r,dAutoCompleteWidth:s,delay:a,allowEmptyValueSearch:c,formatter:i,transInputFocusEmit:u,selectValue:f,source:y,searchFn:d,appendToBodyDirections:p,latestSource:v,showAnimation:g}=t.toRefs(e),{handleSearch:T,searchList:C,showNoResultItemTemplate:h,recentlyFocus:N}=ue(n,c,y,d,i),{onInput:k,onFocus:O,inputRef:b,visible:V,searchStatus:Z,handleClose:x,toggleMenu:_e}=ce(n,C,h,l,o,a,T,u,N,v),{selectedIndex:ee,selectOptionClick:te}=de(n,C,f,T,i,x),{showLoading:He,dropDownRef:oe,loadMore:Ye}=fe(e,n,T),{customRenderSolts:ne}=ie(n,l),{hoverIndex:Xe,handlekeyDown:$e}=pe(oe,V,C,ee,Z,h,te,x);t.provide(M,{props:e,visible:V,term:"",searchList:C,selectedIndex:ee,searchStatus:Z,selectOptionClick:te,dropDownRef:oe,showLoading:He,loadMore:Ye,latestSource:v,modelValue:l,showNoResultItemTemplate:h,hoverIndex:Xe});const le=t.ref(),ae=t.reactive({appendToBodyDirections:{}});ae.appendToBodyDirections=p;const Ke=()=>{if(r.value){let R;return t.createVNode(Ie,{hasBackdrop:!1,origin:le,position:ae.appendToBodyDirections,visible:V.value,"onUpdate:visible":We=>V.value=We},{default:()=>[t.createVNode("div",{class:"devui-dropdown devui-auto-complete-menu",style:{width:s.value>0&&s.value+"px"}},[t.createVNode(K,null,Q(R=ne())?R:{default:()=>[R]})])]})}else{let R;return t.createVNode("div",{class:"devui-dropdown",style:{width:s.value>0&&s.value+"px"}},[t.createVNode(t.Transition,{name:g?"fade":""},{default:()=>[t.createVNode(K,null,Q(R=ne())?R:{default:()=>[R]})]})])}};return()=>t.withDirectives(t.createVNode("div",{class:["devui-auto-complete","devui-form-group","devui-has-feedback",V.value&&"devui-select-open"],ref:le,style:{width:s.value>0&&s.value+"px"}},[t.createVNode("input",{disabled:o.value,type:"text",onClick:_e,class:["devui-form-control","devui-dropdown-origin","devui-dropdown-origin-open",o.value&&"disabled"],placeholder:"Search",onInput:k,onFocus:O,value:l.value,ref:b,onKeydown:$e},null),Ke()]),[[t.resolveDirective("click-outside"),x]])}});F.install=function(e){e.component(F.name,F)};var ze={title:"AutoComplete \u81EA\u52A8\u8865\u5168",category:"\u6570\u636E\u5F55\u5165",status:"100%",install(e){e.use(F)}};m.AutoComplete=F,m.default=ze,Object.defineProperty(m,"__esModule",{value:!0}),m[Symbol.toStringTag]="Module"});
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "auto-complete",
3
+ "version": "0.0.0",
4
+ "main": "index.umd.js",
5
+ "module": "index.es.js",
6
+ "style": "style.css"
7
+ }
@@ -0,0 +1 @@
1
+ @charset "UTF-8";.devui-auto-complete .devui-dropdown-menu,.devui-auto-complete-menu .devui-dropdown-menu{left:0!important;top:0!important}.active{background:var(--devui-list-item-hover-bg, #f2f5fc)}.devui-dropdown-menu{width:100%;display:block}.devui-dropdown-menu-cdk{position:static}.devui-dropdown-item{cursor:pointer;display:block;width:100%;padding:8px 12px;clear:both;border:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:14px}.devui-dropdown-menu .devui-dropdown-item:not(.disabled).selected{color:var(--devui-list-item-active-text, #ffffff);background-color:var(--devui-list-item-active-bg, #5e7ce0)}.devui-no-result-template,.devui-is-searching-template{display:block;width:100%;padding:8px 12px;clear:both;border:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:not-allowed;background-color:var(--devui-disabled-bg, #f5f5f6);color:var(--devui-disabled-text, #adb0b8);line-height:14px}.devui-no-result-template:hover,.devui-no-result-template:active,.devui-no-result-template:hover:active,.devui-is-searching-template:hover,.devui-is-searching-template:active,.devui-is-searching-template:hover:active{background-color:var(--devui-unavailable, #f5f5f6)}.devui-dropdown-item.disabled,.devui-dropdown-item.disabled:hover{cursor:not-allowed;color:var(--devui-disabled-text, #adb0b8)}ul.devui-list-unstyled{margin:0;overflow-y:auto}.devui-dropdown-bg{background:var(--devui-list-item-hover-bg, #f2f5fc);color:var(--devui-list-item-hover-text, #526ecc)}.devui-popup-tips{color:var(--devui-text-weak, #575d6c);padding:4px 12px}.devui-dropdown-latestSource ul{line-height:initial!important}@keyframes devui-busy-spinner-anim{0%{transform:rotate(0) scale(1)}50%{transform:rotate(135deg) scale(1.5)}to{transform:rotate(270deg) scale(1)}}.devui-loading-mask{position:absolute;left:0;right:0;bottom:0;top:0;background-color:var(--devui-line, #adb0b8);opacity:.3}.devui-loading-wrapper{text-align:center}.devui-loading--full{position:fixed;left:0;right:0;bottom:0;top:0;z-index:9999}.devui-loading--hidden{overflow:hidden}.devui-loading-text{margin-left:10px}.devui-loading-area{position:absolute;transform:translate(-50%,-50%);padding:12px 14px;background:var(--devui-base-bg, #ffffff);border-radius:var(--devui-border-radius-card, 6px)}.devui-busy-default-spinner{position:relative;display:inline-block;width:15px;height:15px;animation:devui-busy-spinner-anim 1s linear infinite}.devui-busy-default-spinner div{position:absolute;left:44.5%;top:37%;width:6px;height:6px;border-radius:50%}.devui-busy-default-spinner .devui-loading-bar1{top:0;left:0;background:#5e7ce0;background:var(--devui-brand, #5e7ce0)}.devui-busy-default-spinner .devui-loading-bar2{top:0;left:9px;background:#859bff;background:var(--devui-brand-foil, #859bff)}.devui-busy-default-spinner .devui-loading-bar3{top:9px;left:0;background:#859bff;background:var(--devui-brand-foil, #859bff)}.devui-busy-default-spinner .devui-loading-bar4{top:9px;left:9px;background:#5e7ce0;background:var(--devui-brand, #5e7ce0)}.devui-overlay-background{position:fixed;top:0;left:0;height:100vh;width:100vw;display:flex}.devui-overlay-background__color{background:rgba(0,0,0,.4)}.devui-overlay-background .devui-overlay{position:relative;z-index:1000;pointer-events:auto}.devui-overlay-background__disabled{pointer-events:none}@keyframes d-overlay-fade{0%{opacity:0}to{opacity:1}}.devui-overlay-fade-enter{opacity:0}.devui-overlay-fade-enter-active{animation-name:d-overlay-fade;animation-duration:.3s}.devui-overlay-fade-leave{opacity:1}.devui-overlay-fade-leave-active{animation-name:d-overlay-fade;animation-duration:.3s;animation-direction:reverse}
package/form/index.es.js CHANGED
@@ -1804,6 +1804,9 @@ function uniqueId(prefix) {
1804
1804
  var formControl = "";
1805
1805
  var FormControl = defineComponent({
1806
1806
  name: "DFormControl",
1807
+ directives: {
1808
+ clickoutside: clickoutsideDirective
1809
+ },
1807
1810
  props: formControlProps,
1808
1811
  setup(props, ctx2) {
1809
1812
  const formControl2 = ref();
@@ -1812,6 +1815,7 @@ var FormControl = defineComponent({
1812
1815
  const isHorizontal = labelData.layout === "horizontal";
1813
1816
  const uid = uniqueId("dfc-");
1814
1817
  const showPopover = ref(false);
1818
+ const updateOn = ref("change");
1815
1819
  const tipMessage = ref("");
1816
1820
  const popPosition = ref("bottom");
1817
1821
  let rectInfo = {
@@ -1828,13 +1832,15 @@ var FormControl = defineComponent({
1828
1832
  const el = document.getElementById(uid);
1829
1833
  elOffset = getElOffset(el);
1830
1834
  EventBus.on("showPopoverErrorMessage", (data) => {
1835
+ var _a;
1831
1836
  if (uid === data.uid) {
1832
1837
  rectInfo = el.getBoundingClientRect();
1833
- popoverLeftPosition = popPosition.value === "top" || popPosition.value === "bottom" ? rectInfo.right - rectInfo.width / 2 : rectInfo.right;
1834
- popoverTopPosition = popPosition.value === "top" ? elOffset.top + rectInfo.height / 2 - rectInfo.height : elOffset.top + rectInfo.height / 2;
1835
1838
  showPopover.value = data.showPopover;
1836
1839
  tipMessage.value = data.message;
1837
1840
  popPosition.value = data.popPosition;
1841
+ popoverLeftPosition = popPosition.value === "top" || popPosition.value === "bottom" ? rectInfo.right - rectInfo.width / 2 : rectInfo.right;
1842
+ popoverTopPosition = popPosition.value === "top" ? elOffset.top + rectInfo.height / 2 - rectInfo.height : elOffset.top + rectInfo.height / 2;
1843
+ updateOn.value = (_a = data.updateOn) != null ? _a : "change";
1838
1844
  }
1839
1845
  });
1840
1846
  });
@@ -1862,17 +1868,22 @@ var FormControl = defineComponent({
1862
1868
  };
1863
1869
  }
1864
1870
  });
1871
+ const handleClickOutside = () => {
1872
+ if (updateOn.value !== "change") {
1873
+ showPopover.value = false;
1874
+ }
1875
+ };
1865
1876
  return () => {
1866
1877
  var _a, _b, _c, _d, _e, _f, _g, _h;
1867
1878
  const {
1868
1879
  feedbackStatus,
1869
1880
  extraInfo
1870
1881
  } = props;
1871
- return createVNode("div", {
1882
+ return withDirectives(createVNode("div", {
1872
1883
  "class": "form-control",
1873
1884
  "ref": formControl2,
1874
1885
  "data-uid": uid
1875
- }, [createVNode(Teleport, {
1886
+ }, [showPopover.value && createVNode(Teleport, {
1876
1887
  "to": "body"
1877
1888
  }, {
1878
1889
  default: () => [createVNode("div", {
@@ -1884,6 +1895,7 @@ var FormControl = defineComponent({
1884
1895
  height: rectInfo.height + "px"
1885
1896
  }
1886
1897
  }, [createVNode(Popover, {
1898
+ "controlled": updateOn.value !== "change",
1887
1899
  "visible": showPopover.value,
1888
1900
  "content": tipMessage.value,
1889
1901
  "popType": "error",
@@ -1901,7 +1913,7 @@ var FormControl = defineComponent({
1901
1913
  "color": iconData.value.color
1902
1914
  }, null)])]), extraInfo && createVNode("div", {
1903
1915
  "class": "devui-form-control-extra-info"
1904
- }, [extraInfo])]);
1916
+ }, [extraInfo])]), [[resolveDirective("clickoutside"), handleClickOutside]]);
1905
1917
  };
1906
1918
  }
1907
1919
  });
@@ -2070,13 +2082,25 @@ function handleErrorStrategyPass(el) {
2070
2082
  index2 !== -1 && classList.splice(index2, 1);
2071
2083
  el.setAttribute("class", classList.join(" "));
2072
2084
  }
2073
- function handleValidateError({ el, tipEl, message, isFormTag, messageShowType, dfcUID, popPosition = "right-bottom" }) {
2085
+ function getFormControlUID(el) {
2086
+ if (el.tagName.toLocaleLowerCase() === "body")
2087
+ return "";
2088
+ if (el.parentElement.id.startsWith("dfc-")) {
2089
+ return el.parentElement.id;
2090
+ } else {
2091
+ getFormControlUID(el.parentElement);
2092
+ }
2093
+ }
2094
+ function handleValidateError({ el, tipEl, message = "", isFormTag, messageShowType, dfcUID, popPosition = "right-bottom", updateOn }) {
2074
2095
  if (isFormTag && messageShowType === MessageShowTypeEnum.toast) {
2075
2096
  alert(message);
2076
2097
  return;
2077
2098
  }
2099
+ if (!dfcUID) {
2100
+ dfcUID = getFormControlUID(el);
2101
+ }
2078
2102
  if (MessageShowTypeEnum.popover === messageShowType) {
2079
- EventBus.emit("showPopoverErrorMessage", { showPopover: true, message, uid: dfcUID, popPosition });
2103
+ EventBus.emit("showPopoverErrorMessage", { showPopover: true, message, uid: dfcUID, popPosition, updateOn });
2080
2104
  return;
2081
2105
  }
2082
2106
  tipEl.innerText = "" + message;
@@ -2098,7 +2122,7 @@ function getFormName(binding) {
2098
2122
  const key = Object.keys(_refs)[0];
2099
2123
  return _refs[key]["name"];
2100
2124
  }
2101
- function validateFn({ validator, modelValue, el, tipEl, isFormTag, messageShowType, dfcUID, popPosition }) {
2125
+ function validateFn({ validator, modelValue, el, tipEl, isFormTag, messageShowType, dfcUID, popPosition, updateOn }) {
2102
2126
  validator.validate({ modelName: modelValue }).then(() => {
2103
2127
  handleValidatePass(el, tipEl);
2104
2128
  }).catch((err) => {
@@ -2111,7 +2135,7 @@ function validateFn({ validator, modelValue, el, tipEl, isFormTag, messageShowTy
2111
2135
  } else {
2112
2136
  msg = errors[0].message;
2113
2137
  }
2114
- handleValidateError({ el, tipEl, message: msg, isFormTag, messageShowType, dfcUID, popPosition });
2138
+ handleValidateError({ el, tipEl, message: msg, isFormTag, messageShowType, dfcUID, popPosition, updateOn });
2115
2139
  });
2116
2140
  }
2117
2141
  function checkValidPopsition(positionStr) {
@@ -2210,11 +2234,16 @@ var dValidateRules = {
2210
2234
  const htmlEventValidateHandler = (e) => {
2211
2235
  const modelValue = e.target.value;
2212
2236
  if (messageShowType === MessageShowTypeEnum.popover) {
2213
- EventBus.emit("showPopoverErrorMessage", { showPopover: false, message: "", uid: dfcUID, popPosition });
2237
+ EventBus.emit("showPopoverErrorMessage", { showPopover: false, message: "", uid: dfcUID, popPosition, updateOn });
2214
2238
  }
2215
- validateFn({ validator, modelValue, el, tipEl, isFormTag: false, messageShowType, dfcUID, popPosition });
2239
+ validateFn({ validator, modelValue, el, tipEl, isFormTag: false, messageShowType, dfcUID, popPosition, updateOn });
2216
2240
  };
2217
2241
  vnode.children[0].el.addEventListener(updateOn, htmlEventValidateHandler);
2242
+ if (messageShowType === MessageShowTypeEnum.popover && updateOn === UpdateOnEnum.change) {
2243
+ vnode.children[0].el.addEventListener("focus", () => {
2244
+ EventBus.emit("showPopoverErrorMessage", { showPopover: false, uid: dfcUID, updateOn });
2245
+ });
2246
+ }
2218
2247
  if (errorStrategy === ErrorStrategyEnum.pristine) {
2219
2248
  handleErrorStrategy(el);
2220
2249
  vnode.children[0].props.value = "" + vnode.children[0].props.value;
@@ -2222,7 +2251,7 @@ var dValidateRules = {
2222
2251
  const formName = getFormName(binding);
2223
2252
  formName && EventBus.on(`formSubmit:${formName}`, () => {
2224
2253
  const modelValue = isFormTag ? "" : vnode.children[0].el.value;
2225
- validateFn({ validator, modelValue, el, tipEl, isFormTag, messageShowType });
2254
+ validateFn({ validator, modelValue, el, tipEl, isFormTag, messageShowType, updateOn: "submit" });
2226
2255
  });
2227
2256
  }
2228
2257
  };
package/form/index.umd.js CHANGED
@@ -1 +1 @@
1
- var xr=Object.defineProperty;var ze=Object.getOwnPropertySymbols;var qr=Object.prototype.hasOwnProperty,Sr=Object.prototype.propertyIsEnumerable;var He=(E,f,V)=>f in E?xr(E,f,{enumerable:!0,configurable:!0,writable:!0,value:V}):E[f]=V,X=(E,f)=>{for(var V in f||(f={}))qr.call(f,V)&&He(E,V,f[V]);if(ze)for(var V of ze(f))Sr.call(f,V)&&He(E,V,f[V]);return E};(function(E,f){typeof exports=="object"&&typeof module!="undefined"?f(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],f):(E=typeof globalThis!="undefined"?globalThis:E||self,f(E.index={},E.Vue))})(this,function(E,f){"use strict";function V(t){return{all:t=t||new Map,on:function(e,r){var n=t.get(e);n?n.push(r):t.set(e,[r])},off:function(e,r){var n=t.get(e);n&&(r?n.splice(n.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var n=t.get(e);n&&n.slice().map(function(i){i(r)}),(n=t.get("*"))&&n.slice().map(function(i){i(e,r)})}}}const We={formData:{type:Object,default:{}},layout:{type:String,default:"horizontal"},labelSize:{type:String,default:""},labelAlign:{type:String,default:"start"},rules:{type:Object,default:{}},columnsClass:{type:String,default:""},name:{type:String,default:""},messageShowType:{type:String,default:"popover"}},Ke={dHasFeedback:{type:Boolean,default:!1},prop:{type:String,default:""}},Ge={required:{type:Boolean,default:!1},hasHelp:{type:Boolean,default:!1},helpTips:{type:String,default:""}},Ue={feedbackStatus:{type:String,default:""},extraInfo:{type:String,default:""}},Q={addField:"d.form.addField",removeField:"d.form.removeField"},ee=Symbol("dForm"),Je=Symbol("dFormItem"),ve={blur:"d.form.blur",change:"d.form.change",input:"d.form.input"};var Ye=V();const k=Ye;function ne(t){return Object.prototype.toString.call(t).slice(8,-1)==="Object"}function ie(t,e){return ne(t)?Object.prototype.hasOwnProperty.call(t,e):!1}function Ze(t){let e=0,r=0,n=t.offsetParent;for(e+=t.offsetLeft,r+=t.offsetTop;n;)navigator.userAgent.indexOf("MSIE 8.0")===-1&&(r+=n.clientTop,e+=n.clientLeft),r+=n.offsetTop,e+=n.offsetLeft,n=n.offsetParent;return{left:e,top:r}}var Er="",z=f.defineComponent({name:"DForm",props:We,emits:["submit"],setup(t,e){const r=V(),n=[],i=()=>{n.forEach(o=>{o.resetField()})};return r.on(Q.addField,o=>{o&&n.push(o)}),r.on(Q.removeField,o=>{o.prop&&n.splice(n.indexOf(o),1)}),f.provide(ee,{formData:t.formData,formMitt:r,labelData:{layout:t.layout,labelSize:t.labelSize,labelAlign:t.labelAlign},rules:t.rules,columnsClass:t.columnsClass,messageShowType:"popover"}),{fields:n,formMitt:r,onSubmit:o=>{o.preventDefault(),e.emit("submit",o),k.emit(`formSubmit:${t.name}`)},resetFormFields:i}},render(){var e,r;const{onSubmit:t}=this;return f.createVNode("form",{onSubmit:t,class:"d-form"},[(r=(e=this.$slots).default)==null?void 0:r.call(e)])}}),be=f.defineComponent({name:"DIcon",props:{name:{type:String,required:!0},size:{type:String,default:"inherit"},color:{type:String,default:"inherit"},classPrefix:{type:String,default:"icon"}},setup(t){return X({},t)},render(){const{name:t,size:e,color:r,classPrefix:n}=this;return/^((https?):)?\/\//.test(t)?f.createVNode("img",{src:t,alt:t.split("/")[t.split("/").length-1],style:{width:e,verticalAlign:"text-bottom"}},null):f.createVNode("i",{class:`${n} ${n}-${t}`,style:{fontSize:e,color:r}},null)}}),Fe=(t,e)=>{let r=null;return()=>{r&&clearTimeout(r),r=setTimeout(()=>{t==null||t()},e)}};const Xe=typeof window!="undefined";function we(t,e,r){document.addEventListener?t&&e&&r&&t.addEventListener(e,r,!1):t&&e&&r&&t.attachEvent("on"+e,r)}const M=Symbol("@@clickoutside"),oe=new Map;let Oe,ae=0,Ae=!0;function xe(t,e,r){return Xe&&Ae&&(Ae=!1,we(document,"mousedown",n=>{Oe=n}),we(document,"mouseup",n=>{for(const[i,a]of oe)a[M].documentHandler(n,Oe)})),function(n,i){!r||!e.instance||!n.target||!i.target||t.contains(n.target)||t.contains(i.target)||t===n.target||t[M].bindingFn&&t[M].bindingFn()}}const Qe={beforeMount:function(t,e,r){ae++,oe.set(ae,t),t[M]={nid:ae,documentHandler:xe(t,e,r),bindingFn:e.value}},updated:function(t,e,r){t[M].documentHandler=xe(t,e,r),t[M].bindingFn=e.value},unmounted:function(t){oe.delete(t[M].nid),delete t[M]}};var jr="";const et={success:{name:"right-o",color:"rgb(61, 204, 166)"},error:{name:"error-o",color:"rgb(249, 95, 91)"},info:{name:"info-o",color:"rgb(81, 112, 255)"},warning:{name:"warning-o",color:"rgb(254, 204, 85)"},default:{}};var qe=f.defineComponent({name:"DPopover",directives:{clickoutside:Qe},props:{visible:{type:Boolean,default:!1},position:{type:String,default:"bottom"},content:{type:String,default:"default"},trigger:{type:String,default:"click"},zIndex:{type:Number,default:1060},controlled:{type:Boolean,default:!1},popType:{type:String,default:"default"},showAnimation:{type:Boolean,default:!0},mouseEnterDelay:{type:Number,default:150},mouseLeaveDelay:{type:Number,default:100},popMaxWidth:{type:Number,default:void 0},popoverStyle:{type:Object,default:()=>({})}},setup(t,e){const{slots:r}=e,n=f.ref(t.visible),{position:i,content:a,zIndex:o,trigger:s,popType:c,popoverStyle:m,mouseEnterDelay:d,mouseLeaveDelay:F,showAnimation:O,popMaxWidth:q,controlled:v}=f.toRefs(t),l=X({zIndex:o.value},m.value),y=s.value==="click",u=f.reactive(et[c.value]),j=function(){if(n.value){n.value=!1;return}n.value=!0},b=y&&v.value?j:null,w=Fe(()=>{n.value=!0},d.value),g=Fe(()=>{n.value=!1},F.value),p=!y&&v.value?w:null,x=!y&&v.value?g:null,A=()=>{!v.value||(n.value=!1)};return q.value&&(l.maxWidth=`${q.value}px`),f.watch(()=>t.visible,S=>{v.value||(n.value=S)}),()=>{var S,N;return f.createVNode("div",{class:["devui-popover",i.value,{"devui-popover-animation":O.value,"devui-popover-isVisible":n.value}]},[f.withDirectives(f.createVNode("div",{class:"devui-popover-reference",onMouseenter:p,onMouseleave:x,onClick:b},[(S=r.reference)==null?void 0:S.call(r)]),[[f.resolveDirective("clickoutside"),A]]),f.createVNode("div",{class:["devui-popover-content",u.name?"is-icon":""],style:l},[u.name&&f.createVNode(f.resolveComponent("d-icon"),{name:u.name,color:u.color,class:"devui-popover-icon",size:"16px"},null),((N=r.content)==null?void 0:N.call(r))||f.createVNode("span",null,[a.value]),f.createVNode("span",{class:"after",style:l},null)])])}}}),Pr="",H=f.defineComponent({name:"DFormLabel",props:Ge,setup(t,e){const r=f.reactive(f.inject(ee,{})),n=f.reactive(r.labelData),i=f.computed(()=>n.layout==="horizontal").value,a=f.computed(()=>n.labelSize==="lg").value,o=f.computed(()=>n.labelSize==="sm").value,s=f.computed(()=>n.labelAlign==="center").value,c=f.computed(()=>n.labelAlign==="end").value,m=`form-label${i?o?" form-label_sm":a?" form-label_lg":" form-label_sd":""}${s?" form-label_center":c?" form-label_end":""}`,d=`${t.required?" devui-required":""}`,F={display:i?"inline":"inline-block"};return()=>{var O,q;return f.createVNode("span",{class:m,style:F},[f.createVNode("span",{class:d},[(q=(O=e.slots).default)==null?void 0:q.call(O),t.hasHelp&&t.helpTips&&f.createVNode(qe,{content:t.helpTips,showAnimation:!1,position:"top",trigger:"hover"},{reference:()=>f.createVNode("span",{class:"form-label-help"},[f.createVNode(be,{name:"helping",color:"#252b3a"},null)])})])])}}});function _(){return _=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},_.apply(this,arguments)}function tt(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,W(t,e)}function se(t){return se=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},se(t)}function W(t,e){return W=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},W(t,e)}function rt(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function te(t,e,r){return rt()?te=Reflect.construct:te=function(i,a,o){var s=[null];s.push.apply(s,a);var c=Function.bind.apply(i,s),m=new c;return o&&W(m,o.prototype),m},te.apply(null,arguments)}function nt(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function fe(t){var e=typeof Map=="function"?new Map:void 0;return fe=function(n){if(n===null||!nt(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e!="undefined"){if(e.has(n))return e.get(n);e.set(n,i)}function i(){return te(n,arguments,se(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),W(i,n)},fe(t)}var it=/%[sdj%]/g,ot=function(){};typeof process!="undefined"&&process.env;function ue(t){if(!t||!t.length)return null;var e={};return t.forEach(function(r){var n=r.field;e[n]=e[n]||[],e[n].push(r)}),e}function D(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];var i=0,a=r.length;if(typeof t=="function")return t.apply(null,r);if(typeof t=="string"){var o=t.replace(it,function(s){if(s==="%%")return"%";if(i>=a)return s;switch(s){case"%s":return String(r[i++]);case"%d":return Number(r[i++]);case"%j":try{return JSON.stringify(r[i++])}catch{return"[Circular]"}break;default:return s}});return o}return t}function at(t){return t==="string"||t==="url"||t==="hex"||t==="email"||t==="date"||t==="pattern"}function P(t,e){return!!(t==null||e==="array"&&Array.isArray(t)&&!t.length||at(e)&&typeof t=="string"&&!t)}function st(t,e,r){var n=[],i=0,a=t.length;function o(s){n.push.apply(n,s||[]),i++,i===a&&r(n)}t.forEach(function(s){e(s,o)})}function Se(t,e,r){var n=0,i=t.length;function a(o){if(o&&o.length){r(o);return}var s=n;n=n+1,s<i?e(t[s],a):r([])}a([])}function ft(t){var e=[];return Object.keys(t).forEach(function(r){e.push.apply(e,t[r]||[])}),e}var Ee=function(t){tt(e,t);function e(r,n){var i;return i=t.call(this,"Async Validation Error")||this,i.errors=r,i.fields=n,i}return e}(fe(Error));function ut(t,e,r,n,i){if(e.first){var a=new Promise(function(O,q){var v=function(u){return n(u),u.length?q(new Ee(u,ue(u))):O(i)},l=ft(t);Se(l,r,v)});return a.catch(function(O){return O}),a}var o=e.firstFields===!0?Object.keys(t):e.firstFields||[],s=Object.keys(t),c=s.length,m=0,d=[],F=new Promise(function(O,q){var v=function(y){if(d.push.apply(d,y),m++,m===c)return n(d),d.length?q(new Ee(d,ue(d))):O(i)};s.length||(n(d),O(i)),s.forEach(function(l){var y=t[l];o.indexOf(l)!==-1?Se(y,r,v):st(y,r,v)})});return F.catch(function(O){return O}),F}function lt(t){return!!(t&&t.message!==void 0)}function ct(t,e){for(var r=t,n=0;n<e.length;n++){if(r==null)return r;r=r[e[n]]}return r}function je(t,e){return function(r){var n;return t.fullFields?n=ct(e,t.fullFields):n=e[r.field||t.fullField],lt(r)?(r.field=r.field||t.fullField,r.fieldValue=n,r):{message:typeof r=="function"?r():r,fieldValue:n,field:r.field||t.fullField}}}function Pe(t,e){if(e){for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];typeof n=="object"&&typeof t[r]=="object"?t[r]=_({},t[r],n):t[r]=n}}return t}var Ne=function(e,r,n,i,a,o){e.required&&(!n.hasOwnProperty(e.field)||P(r,o||e.type))&&i.push(D(a.messages.required,e.fullField))},dt=function(e,r,n,i,a){(/^\s+$/.test(r)||r==="")&&i.push(D(a.messages.whitespace,e.fullField))},le={email:/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,url:new RegExp("^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$","i"),hex:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i},K={integer:function(e){return K.number(e)&&parseInt(e,10)===e},float:function(e){return K.number(e)&&!K.integer(e)},array:function(e){return Array.isArray(e)},regexp:function(e){if(e instanceof RegExp)return!0;try{return!!new RegExp(e)}catch{return!1}},date:function(e){return typeof e.getTime=="function"&&typeof e.getMonth=="function"&&typeof e.getYear=="function"&&!isNaN(e.getTime())},number:function(e){return isNaN(e)?!1:typeof e=="number"},object:function(e){return typeof e=="object"&&!K.array(e)},method:function(e){return typeof e=="function"},email:function(e){return typeof e=="string"&&e.length<=320&&!!e.match(le.email)},url:function(e){return typeof e=="string"&&e.length<=2048&&!!e.match(le.url)},hex:function(e){return typeof e=="string"&&!!e.match(le.hex)}},pt=function(e,r,n,i,a){if(e.required&&r===void 0){Ne(e,r,n,i,a);return}var o=["integer","float","array","regexp","object","method","email","number","date","url","hex"],s=e.type;o.indexOf(s)>-1?K[s](r)||i.push(D(a.messages.types[s],e.fullField,e.type)):s&&typeof r!==e.type&&i.push(D(a.messages.types[s],e.fullField,e.type))},mt=function(e,r,n,i,a){var o=typeof e.len=="number",s=typeof e.min=="number",c=typeof e.max=="number",m=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,d=r,F=null,O=typeof r=="number",q=typeof r=="string",v=Array.isArray(r);if(O?F="number":q?F="string":v&&(F="array"),!F)return!1;v&&(d=r.length),q&&(d=r.replace(m,"_").length),o?d!==e.len&&i.push(D(a.messages[F].len,e.fullField,e.len)):s&&!c&&d<e.min?i.push(D(a.messages[F].min,e.fullField,e.min)):c&&!s&&d>e.max?i.push(D(a.messages[F].max,e.fullField,e.max)):s&&c&&(d<e.min||d>e.max)&&i.push(D(a.messages[F].range,e.fullField,e.min,e.max))},L="enum",yt=function(e,r,n,i,a){e[L]=Array.isArray(e[L])?e[L]:[],e[L].indexOf(r)===-1&&i.push(D(a.messages[L],e.fullField,e[L].join(", ")))},gt=function(e,r,n,i,a){if(e.pattern){if(e.pattern instanceof RegExp)e.pattern.lastIndex=0,e.pattern.test(r)||i.push(D(a.messages.pattern.mismatch,e.fullField,r,e.pattern));else if(typeof e.pattern=="string"){var o=new RegExp(e.pattern);o.test(r)||i.push(D(a.messages.pattern.mismatch,e.fullField,r,e.pattern))}}},h={required:Ne,whitespace:dt,type:pt,range:mt,enum:yt,pattern:gt},ht=function(e,r,n,i,a){var o=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(P(r,"string")&&!e.required)return n();h.required(e,r,i,o,a,"string"),P(r,"string")||(h.type(e,r,i,o,a),h.range(e,r,i,o,a),h.pattern(e,r,i,o,a),e.whitespace===!0&&h.whitespace(e,r,i,o,a))}n(o)},vt=function(e,r,n,i,a){var o=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(P(r)&&!e.required)return n();h.required(e,r,i,o,a),r!==void 0&&h.type(e,r,i,o,a)}n(o)},bt=function(e,r,n,i,a){var o=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(r===""&&(r=void 0),P(r)&&!e.required)return n();h.required(e,r,i,o,a),r!==void 0&&(h.type(e,r,i,o,a),h.range(e,r,i,o,a))}n(o)},Ft=function(e,r,n,i,a){var o=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(P(r)&&!e.required)return n();h.required(e,r,i,o,a),r!==void 0&&h.type(e,r,i,o,a)}n(o)},wt=function(e,r,n,i,a){var o=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(P(r)&&!e.required)return n();h.required(e,r,i,o,a),P(r)||h.type(e,r,i,o,a)}n(o)},Ot=function(e,r,n,i,a){var o=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(P(r)&&!e.required)return n();h.required(e,r,i,o,a),r!==void 0&&(h.type(e,r,i,o,a),h.range(e,r,i,o,a))}n(o)},At=function(e,r,n,i,a){var o=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(P(r)&&!e.required)return n();h.required(e,r,i,o,a),r!==void 0&&(h.type(e,r,i,o,a),h.range(e,r,i,o,a))}n(o)},xt=function(e,r,n,i,a){var o=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(r==null&&!e.required)return n();h.required(e,r,i,o,a,"array"),r!=null&&(h.type(e,r,i,o,a),h.range(e,r,i,o,a))}n(o)},qt=function(e,r,n,i,a){var o=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(P(r)&&!e.required)return n();h.required(e,r,i,o,a),r!==void 0&&h.type(e,r,i,o,a)}n(o)},St="enum",Et=function(e,r,n,i,a){var o=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(P(r)&&!e.required)return n();h.required(e,r,i,o,a),r!==void 0&&h[St](e,r,i,o,a)}n(o)},jt=function(e,r,n,i,a){var o=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(P(r,"string")&&!e.required)return n();h.required(e,r,i,o,a),P(r,"string")||h.pattern(e,r,i,o,a)}n(o)},Pt=function(e,r,n,i,a){var o=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(P(r,"date")&&!e.required)return n();if(h.required(e,r,i,o,a),!P(r,"date")){var c;r instanceof Date?c=r:c=new Date(r),h.type(e,c,i,o,a),c&&h.range(e,c.getTime(),i,o,a)}}n(o)},Nt=function(e,r,n,i,a){var o=[],s=Array.isArray(r)?"array":typeof r;h.required(e,r,i,o,a,s),n(o)},ce=function(e,r,n,i,a){var o=e.type,s=[],c=e.required||!e.required&&i.hasOwnProperty(e.field);if(c){if(P(r,o)&&!e.required)return n();h.required(e,r,i,s,a,o),P(r,o)||h.type(e,r,i,s,a)}n(s)},Tt=function(e,r,n,i,a){var o=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(P(r)&&!e.required)return n();h.required(e,r,i,o,a)}n(o)},G={string:ht,method:vt,number:bt,boolean:Ft,regexp:wt,integer:Ot,float:At,array:xt,object:qt,enum:Et,pattern:jt,date:Pt,url:ce,hex:ce,email:ce,required:Nt,any:Tt};function de(){return{default:"Validation error on field %s",required:"%s is required",enum:"%s must be one of %s",whitespace:"%s cannot be empty",date:{format:"%s date %s is invalid for format %s",parse:"%s date could not be parsed, %s is invalid ",invalid:"%s date %s is invalid"},types:{string:"%s is not a %s",method:"%s is not a %s (function)",array:"%s is not an %s",object:"%s is not an %s",number:"%s is not a %s",date:"%s is not a %s",boolean:"%s is not a %s",integer:"%s is not an %s",float:"%s is not a %s",regexp:"%s is not a valid %s",email:"%s is not a valid %s",url:"%s is not a valid %s",hex:"%s is not a valid %s"},string:{len:"%s must be exactly %s characters",min:"%s must be at least %s characters",max:"%s cannot be longer than %s characters",range:"%s must be between %s and %s characters"},number:{len:"%s must equal %s",min:"%s cannot be less than %s",max:"%s cannot be greater than %s",range:"%s must be between %s and %s"},array:{len:"%s must be exactly %s in length",min:"%s cannot be less than %s in length",max:"%s cannot be greater than %s in length",range:"%s must be between %s and %s in length"},pattern:{mismatch:"%s value %s does not match pattern %s"},clone:function(){var e=JSON.parse(JSON.stringify(this));return e.clone=this.clone,e}}}var pe=de(),R=function(){function t(r){this.rules=null,this._messages=pe,this.define(r)}var e=t.prototype;return e.define=function(n){var i=this;if(!n)throw new Error("Cannot configure a schema with no rules");if(typeof n!="object"||Array.isArray(n))throw new Error("Rules must be an object");this.rules={},Object.keys(n).forEach(function(a){var o=n[a];i.rules[a]=Array.isArray(o)?o:[o]})},e.messages=function(n){return n&&(this._messages=Pe(de(),n)),this._messages},e.validate=function(n,i,a){var o=this;i===void 0&&(i={}),a===void 0&&(a=function(){});var s=n,c=i,m=a;if(typeof c=="function"&&(m=c,c={}),!this.rules||Object.keys(this.rules).length===0)return m&&m(null,s),Promise.resolve(s);function d(l){var y=[],u={};function j(w){if(Array.isArray(w)){var g;y=(g=y).concat.apply(g,w)}else y.push(w)}for(var b=0;b<l.length;b++)j(l[b]);y.length?(u=ue(y),m(y,u)):m(null,s)}if(c.messages){var F=this.messages();F===pe&&(F=de()),Pe(F,c.messages),c.messages=F}else c.messages=this.messages();var O={},q=c.keys||Object.keys(this.rules);q.forEach(function(l){var y=o.rules[l],u=s[l];y.forEach(function(j){var b=j;typeof b.transform=="function"&&(s===n&&(s=_({},s)),u=s[l]=b.transform(u)),typeof b=="function"?b={validator:b}:b=_({},b),b.validator=o.getValidationMethod(b),!!b.validator&&(b.field=l,b.fullField=b.fullField||l,b.type=o.getType(b),O[l]=O[l]||[],O[l].push({rule:b,value:u,source:s,field:l}))})});var v={};return ut(O,c,function(l,y){var u=l.rule,j=(u.type==="object"||u.type==="array")&&(typeof u.fields=="object"||typeof u.defaultField=="object");j=j&&(u.required||!u.required&&l.value),u.field=l.field;function b(p,x){return _({},x,{fullField:u.fullField+"."+p,fullFields:u.fullFields?[].concat(u.fullFields,[p]):[p]})}function w(p){p===void 0&&(p=[]);var x=Array.isArray(p)?p:[p];!c.suppressWarning&&x.length&&t.warning("async-validator:",x),x.length&&u.message!==void 0&&(x=[].concat(u.message));var A=x.map(je(u,s));if(c.first&&A.length)return v[u.field]=1,y(A);if(!j)y(A);else{if(u.required&&!l.value)return u.message!==void 0?A=[].concat(u.message).map(je(u,s)):c.error&&(A=[c.error(u,D(c.messages.required,u.field))]),y(A);var S={};u.defaultField&&Object.keys(l.value).map(function(T){S[T]=u.defaultField}),S=_({},S,l.rule.fields);var N={};Object.keys(S).forEach(function(T){var C=S[T],he=Array.isArray(C)?C:[C];N[T]=he.map(b.bind(null,T))});var I=new t(N);I.messages(c.messages),l.rule.options&&(l.rule.options.messages=c.messages,l.rule.options.error=c.error),I.validate(l.value,l.rule.options||c,function(T){var C=[];A&&A.length&&C.push.apply(C,A),T&&T.length&&C.push.apply(C,T),y(C.length?C:null)})}}var g;u.asyncValidator?g=u.asyncValidator(u,l.value,w,l.source,c):u.validator&&(g=u.validator(u,l.value,w,l.source,c),g===!0?w():g===!1?w(typeof u.message=="function"?u.message(u.fullField||u.field):u.message||(u.fullField||u.field)+" fails"):g instanceof Array?w(g):g instanceof Error&&w(g.message)),g&&g.then&&g.then(function(){return w()},function(p){return w(p)})},function(l){d(l)},s)},e.getType=function(n){if(n.type===void 0&&n.pattern instanceof RegExp&&(n.type="pattern"),typeof n.validator!="function"&&n.type&&!G.hasOwnProperty(n.type))throw new Error(D("Unknown rule type %s",n.type));return n.type||"string"},e.getValidationMethod=function(n){if(typeof n.validator=="function")return n.validator;var i=Object.keys(n),a=i.indexOf("message");return a!==-1&&i.splice(a,1),i.length===1&&i[0]==="required"?G.required:G[this.getType(n)]||void 0},t}();R.register=function(e,r){if(typeof r!="function")throw new Error("Cannot register a validator by type, validator is not a function");G[e]=r},R.warning=ot,R.messages=pe,R.validators=G;var Nr="",U=f.defineComponent({name:"DFormItem",props:Ke,setup(t,e){const r=V(),n=f.reactive(f.inject(ee,{})),i=f.reactive(n.formData),a=f.ref(n.columnsClass),o=i[t.prop],s=f.reactive(n.labelData),c=f.reactive(n.rules),m=()=>{Array.isArray(o)?i[t.prop]=[...o]:i[t.prop]=o},d=f.reactive({dHasFeedback:t.dHasFeedback,prop:t.prop,formItemMitt:r,resetField:m});f.provide(Je,d);const F=s.layout==="horizontal",O=s.layout==="vertical",q=s.layout==="columns",v=f.ref(!1),l=f.ref(""),y=w=>{const g=t.prop,p=c[g],x={};x[g]=p,new R(x).validate({[g]:i[g]}).then(()=>{v.value=!1,l.value=""}).catch(({errors:S})=>{v.value=!0,l.value=S[0].message})},u=[],j=()=>{if(c&&c[t.prop]){const w=c[t.prop];let g=w.trigger;if(Array.isArray(w))w.forEach(p=>{g=p.trigger;const x=()=>y();u.push({eventName:x}),d.formItemMitt.on(ve[g],x)});else{const p=()=>y();u.push({eventName:p}),w&&d.formItemMitt.on(ve[g],p)}}},b=()=>{c&&c[t.prop]&&u.length>0&&u.forEach(w=>{d.formItemMitt.off(w.eventName,w.cb)})};return f.onMounted(()=>{n.formMitt.emit(Q.addField,d),j()}),f.onBeforeUnmount(()=>{n.formMitt.emit(Q.removeField,d),b()}),()=>{var w,g;return f.createVNode("div",{class:`form-item${F?"":O?" form-item-vertical":" form-item-columns"}${q?" column-item "+a.value:""}`},[(g=(w=e.slots).default)==null?void 0:g.call(w),f.createVNode("div",{class:`d-validate-tip${F?" d-validate-tip-horizontal":""}`},[v.value&&l.value])])}}}),Vt=typeof global=="object"&&global&&global.Object===Object&&global,Ct=Vt,Dt=typeof self=="object"&&self&&self.Object===Object&&self,It=Ct||Dt||Function("return this")(),Te=It,Mt=Te.Symbol,B=Mt,Ve=Object.prototype,$t=Ve.hasOwnProperty,_t=Ve.toString,J=B?B.toStringTag:void 0;function Lt(t){var e=$t.call(t,J),r=t[J];try{t[J]=void 0;var n=!0}catch{}var i=_t.call(t);return n&&(e?t[J]=r:delete t[J]),i}var Rt=Object.prototype,Bt=Rt.toString;function kt(t){return Bt.call(t)}var zt="[object Null]",Ht="[object Undefined]",Ce=B?B.toStringTag:void 0;function Wt(t){return t==null?t===void 0?Ht:zt:Ce&&Ce in Object(t)?Lt(t):kt(t)}function Kt(t){return t!=null&&typeof t=="object"}var Gt="[object Symbol]";function De(t){return typeof t=="symbol"||Kt(t)&&Wt(t)==Gt}function Ut(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var Jt=Array.isArray,Yt=Jt,Zt=1/0,Ie=B?B.prototype:void 0,Me=Ie?Ie.toString:void 0;function $e(t){if(typeof t=="string")return t;if(Yt(t))return Ut(t,$e)+"";if(De(t))return Me?Me.call(t):"";var e=t+"";return e=="0"&&1/t==-Zt?"-0":e}var Xt=/\s/;function Qt(t){for(var e=t.length;e--&&Xt.test(t.charAt(e)););return e}var er=/^\s+/;function tr(t){return t&&t.slice(0,Qt(t)+1).replace(er,"")}function me(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var _e=0/0,rr=/^[-+]0x[0-9a-f]+$/i,nr=/^0b[01]+$/i,ir=/^0o[0-7]+$/i,or=parseInt;function Le(t){if(typeof t=="number")return t;if(De(t))return _e;if(me(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=me(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=tr(t);var r=nr.test(t);return r||ir.test(t)?or(t.slice(2),r?2:8):rr.test(t)?_e:+t}function ar(t){return t==null?"":$e(t)}var sr=function(){return Te.Date.now()},ye=sr,fr="Expected a function",ur=Math.max,lr=Math.min;function cr(t,e,r){var n,i,a,o,s,c,m=0,d=!1,F=!1,O=!0;if(typeof t!="function")throw new TypeError(fr);e=Le(e)||0,me(r)&&(d=!!r.leading,F="maxWait"in r,a=F?ur(Le(r.maxWait)||0,e):a,O="trailing"in r?!!r.trailing:O);function q(p){var x=n,A=i;return n=i=void 0,m=p,o=t.apply(A,x),o}function v(p){return m=p,s=setTimeout(u,e),d?q(p):o}function l(p){var x=p-c,A=p-m,S=e-x;return F?lr(S,a-A):S}function y(p){var x=p-c,A=p-m;return c===void 0||x>=e||x<0||F&&A>=a}function u(){var p=ye();if(y(p))return j(p);s=setTimeout(u,l(p))}function j(p){return s=void 0,O&&n?q(p):(n=i=void 0,o)}function b(){s!==void 0&&clearTimeout(s),m=0,n=c=i=s=void 0}function w(){return s===void 0?o:j(ye())}function g(){var p=ye(),x=y(p);if(n=arguments,i=this,c=p,x){if(s===void 0)return v(c);if(F)return clearTimeout(s),s=setTimeout(u,e),q(c)}return s===void 0&&(s=setTimeout(u,e)),o}return g.cancel=b,g.flush=w,g}var dr=0;function pr(t){var e=++dr;return ar(t)+e}var Tr="",Y=f.defineComponent({name:"DFormControl",props:Ue,setup(t,e){const r=f.ref(),n=f.reactive(f.inject(ee,{})),a=f.reactive(n.labelData).layout==="horizontal",o=pr("dfc-"),s=f.ref(!1),c=f.ref(""),m=f.ref("bottom");let d={width:0,height:0},F={left:0,top:0},O=0,q=0;f.onMounted(()=>{const l=document.getElementById(o);F=Ze(l),k.on("showPopoverErrorMessage",y=>{o===y.uid&&(d=l.getBoundingClientRect(),O=m.value==="top"||m.value==="bottom"?d.right-d.width/2:d.right,q=m.value==="top"?F.top+d.height/2-d.height:F.top+d.height/2,s.value=y.showPopover,c.value=y.message,m.value=y.popPosition)})});const v=f.computed(()=>{switch(t.feedbackStatus){case"pending":return{name:"priority",color:"#e9edfa"};case"success":return{name:"right-o",color:"rgb(61, 204, 166)"};case"error":return{name:"error-o",color:"rgb(249, 95, 91)"};default:return{name:"",color:""}}});return()=>{var u,j,b,w,g,p,x,A;const{feedbackStatus:l,extraInfo:y}=t;return f.createVNode("div",{class:"form-control",ref:r,"data-uid":o},[f.createVNode(f.Teleport,{to:"body"},{default:()=>[f.createVNode("div",{style:{position:"absolute",left:O+"px",top:q+"px",width:d.width+"px",height:d.height+"px"}},[f.createVNode(qe,{visible:s.value,content:c.value,popType:"error",position:m.value},null)])]}),f.createVNode("div",{class:`devui-form-control-container${a?" devui-form-control-container-horizontal":""}${l?" has-feedback":""}${l==="error"?" feedback-error":""}`},[f.createVNode("div",{class:"devui-control-content-wrapper",id:o},[(j=(u=e.slots).default)==null?void 0:j.call(u)]),(l||((w=(b=e.slots).suffixTemplate)==null?void 0:w.call(b)))&&f.createVNode("span",{class:"feedback-status"},[((p=(g=e.slots).suffixTemplate)==null?void 0:p.call(g))?(A=(x=e.slots).suffixTemplate)==null?void 0:A.call(x):f.createVNode(be,{name:v.value.name,color:v.value.color},null)])]),y&&f.createVNode("div",{class:"devui-form-control-extra-info"},[y])])}}}),Vr="",Z=f.defineComponent({name:"DFormOperation",props:{},setup(t,e){return()=>{var r,n;return f.createVNode("div",{class:"form-operation"},[(n=(r=e.slots).default)==null?void 0:n.call(r)])}}}),Cr="",re;(function(t){t.dirty="dirty",t.pristine="pristine"})(re||(re={}));var ge;(function(t){t.input="input",t.focus="focus",t.change="change",t.blur="blur",t.submit="submit"})(ge||(ge={}));var $;(function(t){t.popover="popover",t.text="text",t.none="none",t.toast="toast"})($||($={}));function mr(t,e){if(!t)return console.error("[v-d-validate] validator's key is invalid"),null;switch(t){case"maxlength":return{type:"string",max:e,asyncValidator:(r,n)=>new Promise((i,a)=>{n.length>e?a("\u6700\u5927\u957F\u5EA6\u4E3A"+e):i("\u6821\u9A8C\u901A\u8FC7")})};case"minlength":return{type:"string",min:e,asyncValidator:(r,n)=>new Promise((i,a)=>{n.length<e?a("\u6700\u5C0F\u957F\u5EA6\u4E3A"+e):i("\u6821\u9A8C\u901A\u8FC7")})};case"min":return{type:"number",asyncValidator:(r,n)=>new Promise((i,a)=>{n<e?a("\u6700\u5C0F\u503C\u4E3A"+e):i("\u6821\u9A8C\u901A\u8FC7")})};case"max":return{type:"number",asyncValidator:(r,n)=>new Promise((i,a)=>{n>e?a("\u6700\u5927\u503C\u4E3A"+e):i("\u6821\u9A8C\u901A\u8FC7")})};case"required":return{reqiured:!0,asyncValidator:(r,n)=>new Promise((i,a)=>{n?i("\u6821\u9A8C\u901A\u8FC7"):a("\u5FC5\u586B\u9879")})};case"requiredTrue":return{asyncValidator:(r,n)=>new Promise((i,a)=>{n?i("\u6821\u9A8C\u901A\u8FC7"):a("\u5FC5\u987B\u4E3Atrue\u503C")})};case"email":return{type:"email",message:"\u90AE\u7BB1\u683C\u5F0F\u4E0D\u6B63\u786E"};case"pattern":return{type:"regexp",pattern:e,message:"\u53EA\u80FD\u5305\u542B\u6570\u5B57\u4E0E\u5927\u5C0F\u5199\u5B57\u7B26",validator:(r,n)=>e.test(n)};case"whitespace":return{message:"\u8F93\u5165\u4E0D\u80FD\u5168\u90E8\u4E3A\u7A7A\u683C\u6216\u7A7A\u5B57\u7B26",validator:(r,n)=>!!n.trim()};default:return{[t]:e}}}function yr(t){const e=[];for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push({key:r,value:t[r]});return e}function Re(t){const e=[...t.classList];e.push("d-validate-rules-error-pristine"),t.setAttribute("class",e.join(" "))}function gr(t){const e=[...t.classList],r=e.indexOf("d-validate-rules-error-pristine");r!==-1&&e.splice(r,1),t.setAttribute("class",e.join(" "))}function hr({el:t,tipEl:e,message:r,isFormTag:n,messageShowType:i,dfcUID:a,popPosition:o="right-bottom"}){if(n&&i===$.toast){alert(r);return}if($.popover===i){k.emit("showPopoverErrorMessage",{showPopover:!0,message:r,uid:a,popPosition:o});return}e.innerText=""+r,e.style.display="inline-flex",e.setAttribute("class","d-validate-tip"),Re(t)}function vr(t,e){e.style.display="none",gr(t)}function br(t){const e=t.instance.$refs;return Object.keys(e)[0]}function Fr(t){const e=t.instance.$refs,r=Object.keys(e)[0];return e[r].name}function Be({validator:t,modelValue:e,el:r,tipEl:n,isFormTag:i,messageShowType:a,dfcUID:o,popPosition:s}){t.validate({modelName:e}).then(()=>{vr(r,n)}).catch(c=>{const{errors:m}=c;if(!m||m.length===0)return;let d="";typeof m[0].message=="object"?d=m[0].message.default:d=m[0].message,hr({el:r,tipEl:n,message:d,isFormTag:i,messageShowType:a,dfcUID:o,popPosition:s})})}function ke(t){const r=["left","right","top","bottom","left-top","left-bottom","top-left","top-right","right-top","right-bottom","bottom-left","bottom-right"].includes(t);return!r&&console.warn(`invalid popPosition value '${t}'.`),r}var wr={mounted(t,e,r){var x;const n=t.tagName==="FORM",i=t.parentNode.parentNode.parentElement.dataset.uid,a=br(e),o=ne(e.value)&&ie(e.value,"options");let{rules:s,options:c={},messageShowType:m=$.popover}=e.value,{errorStrategy:d}=e.value;a&&(m=(x=e.instance[a].messageShowType)!=null?x:"popover");let{updateOn:F=ge.change,errorStrategy:O=re.dirty,asyncDebounceTime:q=300,popPosition:v=["right","bottom"]}=c;m===$.popover&&(Array.isArray(v)&&(v=v.length>1?v.join("-"):v[0]),ke(v)||(v="right-bottom")),d||(d=O);let l={};o?l=s!=null?s:e.value:l=e.value;const y=l&&ne(l)&&(ie(l,"validators")||ie(l,"asyncValidators")),u=Array.isArray(l)?l:[l],j=document.createElement("span");m!==$.none&&t.parentNode.append(j);const b={modelName:[]};if(u.forEach(A=>{const S=!Array.isArray(A)&&yr(A);let N={},I={};S.forEach(T=>{I=mr(T.key,T.value),N=X(X({},N),I)}),b.modelName.push(N)}),y){const{validators:A,asyncValidators:S}=l;A&&A.forEach(N=>{const I={message:(N==null?void 0:N.message)||"",validator:(T,C)=>N.validator(T,C)};b.modelName.push(I)}),S&&S.forEach(N=>{const I={message:(N==null?void 0:N.message)||"",asyncValidator:(T,C)=>new Promise(cr((he,Ar)=>{N.asyncValidator(T,C)?he(""):Ar(T.message)},q))};b.modelName.push(I)})}const w=new R(b),g=A=>{const S=A.target.value;m===$.popover&&k.emit("showPopoverErrorMessage",{showPopover:!1,message:"",uid:i,popPosition:v}),Be({validator:w,modelValue:S,el:t,tipEl:j,isFormTag:!1,messageShowType:m,dfcUID:i,popPosition:v})};r.children[0].el.addEventListener(F,g),d===re.pristine&&(Re(t),r.children[0].props.value=""+r.children[0].props.value);const p=Fr(e);p&&k.on(`formSubmit:${p}`,()=>{const A=n?"":r.children[0].el.value;Be({validator:w,modelValue:A,el:t,tipEl:j,isFormTag:n,messageShowType:m})})}};z.install=function(t){t.component(z.name,z),t.directive("d-validate-rules",wr)},H.install=function(t){t.component(H.name,H)},U.install=function(t){t.component(U.name,U)},Y.install=function(t){t.component(Y.name,Y)},Z.install=function(t){t.component(Z.name,Z)};var Or={title:"Form \u8868\u5355",category:"\u6570\u636E\u5F55\u5165",status:"75%",install(t){t.use(z),t.use(H),t.use(U),t.use(Y),t.use(Z)}};E.Form=z,E.FormControl=Y,E.FormItem=U,E.FormLabel=H,E.FormOperation=Z,E.default=Or,Object.defineProperty(E,"__esModule",{value:!0}),E[Symbol.toStringTag]="Module"});
1
+ var Er=Object.defineProperty;var We=Object.getOwnPropertySymbols;var qr=Object.prototype.hasOwnProperty,Sr=Object.prototype.propertyIsEnumerable;var Ke=(j,f,V)=>f in j?Er(j,f,{enumerable:!0,configurable:!0,writable:!0,value:V}):j[f]=V,X=(j,f)=>{for(var V in f||(f={}))qr.call(f,V)&&Ke(j,V,f[V]);if(We)for(var V of We(f))Sr.call(f,V)&&Ke(j,V,f[V]);return j};(function(j,f){typeof exports=="object"&&typeof module!="undefined"?f(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],f):(j=typeof globalThis!="undefined"?globalThis:j||self,f(j.index={},j.Vue))})(this,function(j,f){"use strict";function V(t){return{all:t=t||new Map,on:function(e,r){var n=t.get(e);n?n.push(r):t.set(e,[r])},off:function(e,r){var n=t.get(e);n&&(r?n.splice(n.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var n=t.get(e);n&&n.slice().map(function(i){i(r)}),(n=t.get("*"))&&n.slice().map(function(i){i(e,r)})}}}const Ge={formData:{type:Object,default:{}},layout:{type:String,default:"horizontal"},labelSize:{type:String,default:""},labelAlign:{type:String,default:"start"},rules:{type:Object,default:{}},columnsClass:{type:String,default:""},name:{type:String,default:""},messageShowType:{type:String,default:"popover"}},Je={dHasFeedback:{type:Boolean,default:!1},prop:{type:String,default:""}},Ue={required:{type:Boolean,default:!1},hasHelp:{type:Boolean,default:!1},helpTips:{type:String,default:""}},Ye={feedbackStatus:{type:String,default:""},extraInfo:{type:String,default:""}},Q={addField:"d.form.addField",removeField:"d.form.removeField"},ee=Symbol("dForm"),Ze=Symbol("dFormItem"),ve={blur:"d.form.blur",change:"d.form.change",input:"d.form.input"};var Xe=V();const _=Xe;function ie(t){return Object.prototype.toString.call(t).slice(8,-1)==="Object"}function oe(t,e){return ie(t)?Object.prototype.hasOwnProperty.call(t,e):!1}function Qe(t){let e=0,r=0,n=t.offsetParent;for(e+=t.offsetLeft,r+=t.offsetTop;n;)navigator.userAgent.indexOf("MSIE 8.0")===-1&&(r+=n.clientTop,e+=n.clientLeft),r+=n.offsetTop,e+=n.offsetLeft,n=n.offsetParent;return{left:e,top:r}}var Pr="",z=f.defineComponent({name:"DForm",props:Ge,emits:["submit"],setup(t,e){const r=V(),n=[],i=()=>{n.forEach(o=>{o.resetField()})};return r.on(Q.addField,o=>{o&&n.push(o)}),r.on(Q.removeField,o=>{o.prop&&n.splice(n.indexOf(o),1)}),f.provide(ee,{formData:t.formData,formMitt:r,labelData:{layout:t.layout,labelSize:t.labelSize,labelAlign:t.labelAlign},rules:t.rules,columnsClass:t.columnsClass,messageShowType:"popover"}),{fields:n,formMitt:r,onSubmit:o=>{o.preventDefault(),e.emit("submit",o),_.emit(`formSubmit:${t.name}`)},resetFormFields:i}},render(){var e,r;const{onSubmit:t}=this;return f.createVNode("form",{onSubmit:t,class:"d-form"},[(r=(e=this.$slots).default)==null?void 0:r.call(e)])}}),be=f.defineComponent({name:"DIcon",props:{name:{type:String,required:!0},size:{type:String,default:"inherit"},color:{type:String,default:"inherit"},classPrefix:{type:String,default:"icon"}},setup(t){return X({},t)},render(){const{name:t,size:e,color:r,classPrefix:n}=this;return/^((https?):)?\/\//.test(t)?f.createVNode("img",{src:t,alt:t.split("/")[t.split("/").length-1],style:{width:e,verticalAlign:"text-bottom"}},null):f.createVNode("i",{class:`${n} ${n}-${t}`,style:{fontSize:e,color:r}},null)}}),Fe=(t,e)=>{let r=null;return()=>{r&&clearTimeout(r),r=setTimeout(()=>{t==null||t()},e)}};const et=typeof window!="undefined";function we(t,e,r){document.addEventListener?t&&e&&r&&t.addEventListener(e,r,!1):t&&e&&r&&t.attachEvent("on"+e,r)}const $=Symbol("@@clickoutside"),ae=new Map;let Oe,se=0,Ae=!0;function xe(t,e,r){return et&&Ae&&(Ae=!1,we(document,"mousedown",n=>{Oe=n}),we(document,"mouseup",n=>{for(const[i,a]of ae)a[$].documentHandler(n,Oe)})),function(n,i){!r||!e.instance||!n.target||!i.target||t.contains(n.target)||t.contains(i.target)||t===n.target||t[$].bindingFn&&t[$].bindingFn()}}const Ee={beforeMount:function(t,e,r){se++,ae.set(se,t),t[$]={nid:se,documentHandler:xe(t,e,r),bindingFn:e.value}},updated:function(t,e,r){t[$].documentHandler=xe(t,e,r),t[$].bindingFn=e.value},unmounted:function(t){ae.delete(t[$].nid),delete t[$]}};var jr="";const tt={success:{name:"right-o",color:"rgb(61, 204, 166)"},error:{name:"error-o",color:"rgb(249, 95, 91)"},info:{name:"info-o",color:"rgb(81, 112, 255)"},warning:{name:"warning-o",color:"rgb(254, 204, 85)"},default:{}};var qe=f.defineComponent({name:"DPopover",directives:{clickoutside:Ee},props:{visible:{type:Boolean,default:!1},position:{type:String,default:"bottom"},content:{type:String,default:"default"},trigger:{type:String,default:"click"},zIndex:{type:Number,default:1060},controlled:{type:Boolean,default:!1},popType:{type:String,default:"default"},showAnimation:{type:Boolean,default:!0},mouseEnterDelay:{type:Number,default:150},mouseLeaveDelay:{type:Number,default:100},popMaxWidth:{type:Number,default:void 0},popoverStyle:{type:Object,default:()=>({})}},setup(t,e){const{slots:r}=e,n=f.ref(t.visible),{position:i,content:a,zIndex:o,trigger:s,popType:l,popoverStyle:g,mouseEnterDelay:p,mouseLeaveDelay:d,showAnimation:O,popMaxWidth:q,controlled:b}=f.toRefs(t),c=X({zIndex:o.value},g.value),w=s.value==="click",u=f.reactive(tt[l.value]),E=function(){if(n.value){n.value=!1;return}n.value=!0},y=w&&b.value?E:null,F=Fe(()=>{n.value=!0},p.value),h=Fe(()=>{n.value=!1},d.value),m=!w&&b.value?F:null,x=!w&&b.value?h:null,A=()=>{!b.value||(n.value=!1)};return q.value&&(c.maxWidth=`${q.value}px`),f.watch(()=>t.visible,S=>{b.value||(n.value=S)}),()=>{var S,P;return f.createVNode("div",{class:["devui-popover",i.value,{"devui-popover-animation":O.value,"devui-popover-isVisible":n.value}]},[f.withDirectives(f.createVNode("div",{class:"devui-popover-reference",onMouseenter:m,onMouseleave:x,onClick:y},[(S=r.reference)==null?void 0:S.call(r)]),[[f.resolveDirective("clickoutside"),A]]),f.createVNode("div",{class:["devui-popover-content",u.name?"is-icon":""],style:c},[u.name&&f.createVNode(f.resolveComponent("d-icon"),{name:u.name,color:u.color,class:"devui-popover-icon",size:"16px"},null),((P=r.content)==null?void 0:P.call(r))||f.createVNode("span",null,[a.value]),f.createVNode("span",{class:"after",style:c},null)])])}}}),Nr="",H=f.defineComponent({name:"DFormLabel",props:Ue,setup(t,e){const r=f.reactive(f.inject(ee,{})),n=f.reactive(r.labelData),i=f.computed(()=>n.layout==="horizontal").value,a=f.computed(()=>n.labelSize==="lg").value,o=f.computed(()=>n.labelSize==="sm").value,s=f.computed(()=>n.labelAlign==="center").value,l=f.computed(()=>n.labelAlign==="end").value,g=`form-label${i?o?" form-label_sm":a?" form-label_lg":" form-label_sd":""}${s?" form-label_center":l?" form-label_end":""}`,p=`${t.required?" devui-required":""}`,d={display:i?"inline":"inline-block"};return()=>{var O,q;return f.createVNode("span",{class:g,style:d},[f.createVNode("span",{class:p},[(q=(O=e.slots).default)==null?void 0:q.call(O),t.hasHelp&&t.helpTips&&f.createVNode(qe,{content:t.helpTips,showAnimation:!1,position:"top",trigger:"hover"},{reference:()=>f.createVNode("span",{class:"form-label-help"},[f.createVNode(be,{name:"helping",color:"#252b3a"},null)])})])])}}});function L(){return L=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},L.apply(this,arguments)}function rt(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,W(t,e)}function fe(t){return fe=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},fe(t)}function W(t,e){return W=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},W(t,e)}function nt(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function te(t,e,r){return nt()?te=Reflect.construct:te=function(i,a,o){var s=[null];s.push.apply(s,a);var l=Function.bind.apply(i,s),g=new l;return o&&W(g,o.prototype),g},te.apply(null,arguments)}function it(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function ue(t){var e=typeof Map=="function"?new Map:void 0;return ue=function(n){if(n===null||!it(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e!="undefined"){if(e.has(n))return e.get(n);e.set(n,i)}function i(){return te(n,arguments,fe(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),W(i,n)},ue(t)}var ot=/%[sdj%]/g,at=function(){};typeof process!="undefined"&&process.env;function le(t){if(!t||!t.length)return null;var e={};return t.forEach(function(r){var n=r.field;e[n]=e[n]||[],e[n].push(r)}),e}function D(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];var i=0,a=r.length;if(typeof t=="function")return t.apply(null,r);if(typeof t=="string"){var o=t.replace(ot,function(s){if(s==="%%")return"%";if(i>=a)return s;switch(s){case"%s":return String(r[i++]);case"%d":return Number(r[i++]);case"%j":try{return JSON.stringify(r[i++])}catch{return"[Circular]"}break;default:return s}});return o}return t}function st(t){return t==="string"||t==="url"||t==="hex"||t==="email"||t==="date"||t==="pattern"}function N(t,e){return!!(t==null||e==="array"&&Array.isArray(t)&&!t.length||st(e)&&typeof t=="string"&&!t)}function ft(t,e,r){var n=[],i=0,a=t.length;function o(s){n.push.apply(n,s||[]),i++,i===a&&r(n)}t.forEach(function(s){e(s,o)})}function Se(t,e,r){var n=0,i=t.length;function a(o){if(o&&o.length){r(o);return}var s=n;n=n+1,s<i?e(t[s],a):r([])}a([])}function ut(t){var e=[];return Object.keys(t).forEach(function(r){e.push.apply(e,t[r]||[])}),e}var Pe=function(t){rt(e,t);function e(r,n){var i;return i=t.call(this,"Async Validation Error")||this,i.errors=r,i.fields=n,i}return e}(ue(Error));function lt(t,e,r,n,i){if(e.first){var a=new Promise(function(O,q){var b=function(u){return n(u),u.length?q(new Pe(u,le(u))):O(i)},c=ut(t);Se(c,r,b)});return a.catch(function(O){return O}),a}var o=e.firstFields===!0?Object.keys(t):e.firstFields||[],s=Object.keys(t),l=s.length,g=0,p=[],d=new Promise(function(O,q){var b=function(w){if(p.push.apply(p,w),g++,g===l)return n(p),p.length?q(new Pe(p,le(p))):O(i)};s.length||(n(p),O(i)),s.forEach(function(c){var w=t[c];o.indexOf(c)!==-1?Se(w,r,b):ft(w,r,b)})});return d.catch(function(O){return O}),d}function ct(t){return!!(t&&t.message!==void 0)}function dt(t,e){for(var r=t,n=0;n<e.length;n++){if(r==null)return r;r=r[e[n]]}return r}function je(t,e){return function(r){var n;return t.fullFields?n=dt(e,t.fullFields):n=e[r.field||t.fullField],ct(r)?(r.field=r.field||t.fullField,r.fieldValue=n,r):{message:typeof r=="function"?r():r,fieldValue:n,field:r.field||t.fullField}}}function Ne(t,e){if(e){for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];typeof n=="object"&&typeof t[r]=="object"?t[r]=L({},t[r],n):t[r]=n}}return t}var Te=function(e,r,n,i,a,o){e.required&&(!n.hasOwnProperty(e.field)||N(r,o||e.type))&&i.push(D(a.messages.required,e.fullField))},pt=function(e,r,n,i,a){(/^\s+$/.test(r)||r==="")&&i.push(D(a.messages.whitespace,e.fullField))},ce={email:/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,url:new RegExp("^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$","i"),hex:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i},K={integer:function(e){return K.number(e)&&parseInt(e,10)===e},float:function(e){return K.number(e)&&!K.integer(e)},array:function(e){return Array.isArray(e)},regexp:function(e){if(e instanceof RegExp)return!0;try{return!!new RegExp(e)}catch{return!1}},date:function(e){return typeof e.getTime=="function"&&typeof e.getMonth=="function"&&typeof e.getYear=="function"&&!isNaN(e.getTime())},number:function(e){return isNaN(e)?!1:typeof e=="number"},object:function(e){return typeof e=="object"&&!K.array(e)},method:function(e){return typeof e=="function"},email:function(e){return typeof e=="string"&&e.length<=320&&!!e.match(ce.email)},url:function(e){return typeof e=="string"&&e.length<=2048&&!!e.match(ce.url)},hex:function(e){return typeof e=="string"&&!!e.match(ce.hex)}},mt=function(e,r,n,i,a){if(e.required&&r===void 0){Te(e,r,n,i,a);return}var o=["integer","float","array","regexp","object","method","email","number","date","url","hex"],s=e.type;o.indexOf(s)>-1?K[s](r)||i.push(D(a.messages.types[s],e.fullField,e.type)):s&&typeof r!==e.type&&i.push(D(a.messages.types[s],e.fullField,e.type))},yt=function(e,r,n,i,a){var o=typeof e.len=="number",s=typeof e.min=="number",l=typeof e.max=="number",g=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,p=r,d=null,O=typeof r=="number",q=typeof r=="string",b=Array.isArray(r);if(O?d="number":q?d="string":b&&(d="array"),!d)return!1;b&&(p=r.length),q&&(p=r.replace(g,"_").length),o?p!==e.len&&i.push(D(a.messages[d].len,e.fullField,e.len)):s&&!l&&p<e.min?i.push(D(a.messages[d].min,e.fullField,e.min)):l&&!s&&p>e.max?i.push(D(a.messages[d].max,e.fullField,e.max)):s&&l&&(p<e.min||p>e.max)&&i.push(D(a.messages[d].range,e.fullField,e.min,e.max))},R="enum",gt=function(e,r,n,i,a){e[R]=Array.isArray(e[R])?e[R]:[],e[R].indexOf(r)===-1&&i.push(D(a.messages[R],e.fullField,e[R].join(", ")))},ht=function(e,r,n,i,a){if(e.pattern){if(e.pattern instanceof RegExp)e.pattern.lastIndex=0,e.pattern.test(r)||i.push(D(a.messages.pattern.mismatch,e.fullField,r,e.pattern));else if(typeof e.pattern=="string"){var o=new RegExp(e.pattern);o.test(r)||i.push(D(a.messages.pattern.mismatch,e.fullField,r,e.pattern))}}},v={required:Te,whitespace:pt,type:mt,range:yt,enum:gt,pattern:ht},vt=function(e,r,n,i,a){var o=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(N(r,"string")&&!e.required)return n();v.required(e,r,i,o,a,"string"),N(r,"string")||(v.type(e,r,i,o,a),v.range(e,r,i,o,a),v.pattern(e,r,i,o,a),e.whitespace===!0&&v.whitespace(e,r,i,o,a))}n(o)},bt=function(e,r,n,i,a){var o=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(N(r)&&!e.required)return n();v.required(e,r,i,o,a),r!==void 0&&v.type(e,r,i,o,a)}n(o)},Ft=function(e,r,n,i,a){var o=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(r===""&&(r=void 0),N(r)&&!e.required)return n();v.required(e,r,i,o,a),r!==void 0&&(v.type(e,r,i,o,a),v.range(e,r,i,o,a))}n(o)},wt=function(e,r,n,i,a){var o=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(N(r)&&!e.required)return n();v.required(e,r,i,o,a),r!==void 0&&v.type(e,r,i,o,a)}n(o)},Ot=function(e,r,n,i,a){var o=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(N(r)&&!e.required)return n();v.required(e,r,i,o,a),N(r)||v.type(e,r,i,o,a)}n(o)},At=function(e,r,n,i,a){var o=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(N(r)&&!e.required)return n();v.required(e,r,i,o,a),r!==void 0&&(v.type(e,r,i,o,a),v.range(e,r,i,o,a))}n(o)},xt=function(e,r,n,i,a){var o=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(N(r)&&!e.required)return n();v.required(e,r,i,o,a),r!==void 0&&(v.type(e,r,i,o,a),v.range(e,r,i,o,a))}n(o)},Et=function(e,r,n,i,a){var o=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(r==null&&!e.required)return n();v.required(e,r,i,o,a,"array"),r!=null&&(v.type(e,r,i,o,a),v.range(e,r,i,o,a))}n(o)},qt=function(e,r,n,i,a){var o=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(N(r)&&!e.required)return n();v.required(e,r,i,o,a),r!==void 0&&v.type(e,r,i,o,a)}n(o)},St="enum",Pt=function(e,r,n,i,a){var o=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(N(r)&&!e.required)return n();v.required(e,r,i,o,a),r!==void 0&&v[St](e,r,i,o,a)}n(o)},jt=function(e,r,n,i,a){var o=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(N(r,"string")&&!e.required)return n();v.required(e,r,i,o,a),N(r,"string")||v.pattern(e,r,i,o,a)}n(o)},Nt=function(e,r,n,i,a){var o=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(N(r,"date")&&!e.required)return n();if(v.required(e,r,i,o,a),!N(r,"date")){var l;r instanceof Date?l=r:l=new Date(r),v.type(e,l,i,o,a),l&&v.range(e,l.getTime(),i,o,a)}}n(o)},Tt=function(e,r,n,i,a){var o=[],s=Array.isArray(r)?"array":typeof r;v.required(e,r,i,o,a,s),n(o)},de=function(e,r,n,i,a){var o=e.type,s=[],l=e.required||!e.required&&i.hasOwnProperty(e.field);if(l){if(N(r,o)&&!e.required)return n();v.required(e,r,i,s,a,o),N(r,o)||v.type(e,r,i,s,a)}n(s)},Vt=function(e,r,n,i,a){var o=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(N(r)&&!e.required)return n();v.required(e,r,i,o,a)}n(o)},G={string:vt,method:bt,number:Ft,boolean:wt,regexp:Ot,integer:At,float:xt,array:Et,object:qt,enum:Pt,pattern:jt,date:Nt,url:de,hex:de,email:de,required:Tt,any:Vt};function pe(){return{default:"Validation error on field %s",required:"%s is required",enum:"%s must be one of %s",whitespace:"%s cannot be empty",date:{format:"%s date %s is invalid for format %s",parse:"%s date could not be parsed, %s is invalid ",invalid:"%s date %s is invalid"},types:{string:"%s is not a %s",method:"%s is not a %s (function)",array:"%s is not an %s",object:"%s is not an %s",number:"%s is not a %s",date:"%s is not a %s",boolean:"%s is not a %s",integer:"%s is not an %s",float:"%s is not a %s",regexp:"%s is not a valid %s",email:"%s is not a valid %s",url:"%s is not a valid %s",hex:"%s is not a valid %s"},string:{len:"%s must be exactly %s characters",min:"%s must be at least %s characters",max:"%s cannot be longer than %s characters",range:"%s must be between %s and %s characters"},number:{len:"%s must equal %s",min:"%s cannot be less than %s",max:"%s cannot be greater than %s",range:"%s must be between %s and %s"},array:{len:"%s must be exactly %s in length",min:"%s cannot be less than %s in length",max:"%s cannot be greater than %s in length",range:"%s must be between %s and %s in length"},pattern:{mismatch:"%s value %s does not match pattern %s"},clone:function(){var e=JSON.parse(JSON.stringify(this));return e.clone=this.clone,e}}}var me=pe(),k=function(){function t(r){this.rules=null,this._messages=me,this.define(r)}var e=t.prototype;return e.define=function(n){var i=this;if(!n)throw new Error("Cannot configure a schema with no rules");if(typeof n!="object"||Array.isArray(n))throw new Error("Rules must be an object");this.rules={},Object.keys(n).forEach(function(a){var o=n[a];i.rules[a]=Array.isArray(o)?o:[o]})},e.messages=function(n){return n&&(this._messages=Ne(pe(),n)),this._messages},e.validate=function(n,i,a){var o=this;i===void 0&&(i={}),a===void 0&&(a=function(){});var s=n,l=i,g=a;if(typeof l=="function"&&(g=l,l={}),!this.rules||Object.keys(this.rules).length===0)return g&&g(null,s),Promise.resolve(s);function p(c){var w=[],u={};function E(F){if(Array.isArray(F)){var h;w=(h=w).concat.apply(h,F)}else w.push(F)}for(var y=0;y<c.length;y++)E(c[y]);w.length?(u=le(w),g(w,u)):g(null,s)}if(l.messages){var d=this.messages();d===me&&(d=pe()),Ne(d,l.messages),l.messages=d}else l.messages=this.messages();var O={},q=l.keys||Object.keys(this.rules);q.forEach(function(c){var w=o.rules[c],u=s[c];w.forEach(function(E){var y=E;typeof y.transform=="function"&&(s===n&&(s=L({},s)),u=s[c]=y.transform(u)),typeof y=="function"?y={validator:y}:y=L({},y),y.validator=o.getValidationMethod(y),!!y.validator&&(y.field=c,y.fullField=y.fullField||c,y.type=o.getType(y),O[c]=O[c]||[],O[c].push({rule:y,value:u,source:s,field:c}))})});var b={};return lt(O,l,function(c,w){var u=c.rule,E=(u.type==="object"||u.type==="array")&&(typeof u.fields=="object"||typeof u.defaultField=="object");E=E&&(u.required||!u.required&&c.value),u.field=c.field;function y(m,x){return L({},x,{fullField:u.fullField+"."+m,fullFields:u.fullFields?[].concat(u.fullFields,[m]):[m]})}function F(m){m===void 0&&(m=[]);var x=Array.isArray(m)?m:[m];!l.suppressWarning&&x.length&&t.warning("async-validator:",x),x.length&&u.message!==void 0&&(x=[].concat(u.message));var A=x.map(je(u,s));if(l.first&&A.length)return b[u.field]=1,w(A);if(!E)w(A);else{if(u.required&&!c.value)return u.message!==void 0?A=[].concat(u.message).map(je(u,s)):l.error&&(A=[l.error(u,D(l.messages.required,u.field))]),w(A);var S={};u.defaultField&&Object.keys(c.value).map(function(T){S[T]=u.defaultField}),S=L({},S,c.rule.fields);var P={};Object.keys(S).forEach(function(T){var C=S[T],he=Array.isArray(C)?C:[C];P[T]=he.map(y.bind(null,T))});var M=new t(P);M.messages(l.messages),c.rule.options&&(c.rule.options.messages=l.messages,c.rule.options.error=l.error),M.validate(c.value,c.rule.options||l,function(T){var C=[];A&&A.length&&C.push.apply(C,A),T&&T.length&&C.push.apply(C,T),w(C.length?C:null)})}}var h;u.asyncValidator?h=u.asyncValidator(u,c.value,F,c.source,l):u.validator&&(h=u.validator(u,c.value,F,c.source,l),h===!0?F():h===!1?F(typeof u.message=="function"?u.message(u.fullField||u.field):u.message||(u.fullField||u.field)+" fails"):h instanceof Array?F(h):h instanceof Error&&F(h.message)),h&&h.then&&h.then(function(){return F()},function(m){return F(m)})},function(c){p(c)},s)},e.getType=function(n){if(n.type===void 0&&n.pattern instanceof RegExp&&(n.type="pattern"),typeof n.validator!="function"&&n.type&&!G.hasOwnProperty(n.type))throw new Error(D("Unknown rule type %s",n.type));return n.type||"string"},e.getValidationMethod=function(n){if(typeof n.validator=="function")return n.validator;var i=Object.keys(n),a=i.indexOf("message");return a!==-1&&i.splice(a,1),i.length===1&&i[0]==="required"?G.required:G[this.getType(n)]||void 0},t}();k.register=function(e,r){if(typeof r!="function")throw new Error("Cannot register a validator by type, validator is not a function");G[e]=r},k.warning=at,k.messages=me,k.validators=G;var Tr="",J=f.defineComponent({name:"DFormItem",props:Je,setup(t,e){const r=V(),n=f.reactive(f.inject(ee,{})),i=f.reactive(n.formData),a=f.ref(n.columnsClass),o=i[t.prop],s=f.reactive(n.labelData),l=f.reactive(n.rules),g=()=>{Array.isArray(o)?i[t.prop]=[...o]:i[t.prop]=o},p=f.reactive({dHasFeedback:t.dHasFeedback,prop:t.prop,formItemMitt:r,resetField:g});f.provide(Ze,p);const d=s.layout==="horizontal",O=s.layout==="vertical",q=s.layout==="columns",b=f.ref(!1),c=f.ref(""),w=F=>{const h=t.prop,m=l[h],x={};x[h]=m,new k(x).validate({[h]:i[h]}).then(()=>{b.value=!1,c.value=""}).catch(({errors:S})=>{b.value=!0,c.value=S[0].message})},u=[],E=()=>{if(l&&l[t.prop]){const F=l[t.prop];let h=F.trigger;if(Array.isArray(F))F.forEach(m=>{h=m.trigger;const x=()=>w();u.push({eventName:x}),p.formItemMitt.on(ve[h],x)});else{const m=()=>w();u.push({eventName:m}),F&&p.formItemMitt.on(ve[h],m)}}},y=()=>{l&&l[t.prop]&&u.length>0&&u.forEach(F=>{p.formItemMitt.off(F.eventName,F.cb)})};return f.onMounted(()=>{n.formMitt.emit(Q.addField,p),E()}),f.onBeforeUnmount(()=>{n.formMitt.emit(Q.removeField,p),y()}),()=>{var F,h;return f.createVNode("div",{class:`form-item${d?"":O?" form-item-vertical":" form-item-columns"}${q?" column-item "+a.value:""}`},[(h=(F=e.slots).default)==null?void 0:h.call(F),f.createVNode("div",{class:`d-validate-tip${d?" d-validate-tip-horizontal":""}`},[b.value&&c.value])])}}}),Ct=typeof global=="object"&&global&&global.Object===Object&&global,Dt=Ct,It=typeof self=="object"&&self&&self.Object===Object&&self,Mt=Dt||It||Function("return this")(),Ve=Mt,$t=Ve.Symbol,B=$t,Ce=Object.prototype,Lt=Ce.hasOwnProperty,_t=Ce.toString,U=B?B.toStringTag:void 0;function Rt(t){var e=Lt.call(t,U),r=t[U];try{t[U]=void 0;var n=!0}catch{}var i=_t.call(t);return n&&(e?t[U]=r:delete t[U]),i}var kt=Object.prototype,Bt=kt.toString;function zt(t){return Bt.call(t)}var Ht="[object Null]",Wt="[object Undefined]",De=B?B.toStringTag:void 0;function Kt(t){return t==null?t===void 0?Wt:Ht:De&&De in Object(t)?Rt(t):zt(t)}function Gt(t){return t!=null&&typeof t=="object"}var Jt="[object Symbol]";function Ie(t){return typeof t=="symbol"||Gt(t)&&Kt(t)==Jt}function Ut(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var Yt=Array.isArray,Zt=Yt,Xt=1/0,Me=B?B.prototype:void 0,$e=Me?Me.toString:void 0;function Le(t){if(typeof t=="string")return t;if(Zt(t))return Ut(t,Le)+"";if(Ie(t))return $e?$e.call(t):"";var e=t+"";return e=="0"&&1/t==-Xt?"-0":e}var Qt=/\s/;function er(t){for(var e=t.length;e--&&Qt.test(t.charAt(e)););return e}var tr=/^\s+/;function rr(t){return t&&t.slice(0,er(t)+1).replace(tr,"")}function ye(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var _e=0/0,nr=/^[-+]0x[0-9a-f]+$/i,ir=/^0b[01]+$/i,or=/^0o[0-7]+$/i,ar=parseInt;function Re(t){if(typeof t=="number")return t;if(Ie(t))return _e;if(ye(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=ye(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=rr(t);var r=ir.test(t);return r||or.test(t)?ar(t.slice(2),r?2:8):nr.test(t)?_e:+t}function sr(t){return t==null?"":Le(t)}var fr=function(){return Ve.Date.now()},ge=fr,ur="Expected a function",lr=Math.max,cr=Math.min;function dr(t,e,r){var n,i,a,o,s,l,g=0,p=!1,d=!1,O=!0;if(typeof t!="function")throw new TypeError(ur);e=Re(e)||0,ye(r)&&(p=!!r.leading,d="maxWait"in r,a=d?lr(Re(r.maxWait)||0,e):a,O="trailing"in r?!!r.trailing:O);function q(m){var x=n,A=i;return n=i=void 0,g=m,o=t.apply(A,x),o}function b(m){return g=m,s=setTimeout(u,e),p?q(m):o}function c(m){var x=m-l,A=m-g,S=e-x;return d?cr(S,a-A):S}function w(m){var x=m-l,A=m-g;return l===void 0||x>=e||x<0||d&&A>=a}function u(){var m=ge();if(w(m))return E(m);s=setTimeout(u,c(m))}function E(m){return s=void 0,O&&n?q(m):(n=i=void 0,o)}function y(){s!==void 0&&clearTimeout(s),g=0,n=l=i=s=void 0}function F(){return s===void 0?o:E(ge())}function h(){var m=ge(),x=w(m);if(n=arguments,i=this,l=m,x){if(s===void 0)return b(l);if(d)return clearTimeout(s),s=setTimeout(u,e),q(l)}return s===void 0&&(s=setTimeout(u,e)),o}return h.cancel=y,h.flush=F,h}var pr=0;function mr(t){var e=++pr;return sr(t)+e}var Vr="",Y=f.defineComponent({name:"DFormControl",directives:{clickoutside:Ee},props:Ye,setup(t,e){const r=f.ref(),n=f.reactive(f.inject(ee,{})),a=f.reactive(n.labelData).layout==="horizontal",o=mr("dfc-"),s=f.ref(!1),l=f.ref("change"),g=f.ref(""),p=f.ref("bottom");let d={width:0,height:0},O={left:0,top:0},q=0,b=0;f.onMounted(()=>{const u=document.getElementById(o);O=Qe(u),_.on("showPopoverErrorMessage",E=>{var y;o===E.uid&&(d=u.getBoundingClientRect(),s.value=E.showPopover,g.value=E.message,p.value=E.popPosition,q=p.value==="top"||p.value==="bottom"?d.right-d.width/2:d.right,b=p.value==="top"?O.top+d.height/2-d.height:O.top+d.height/2,l.value=(y=E.updateOn)!=null?y:"change")})});const c=f.computed(()=>{switch(t.feedbackStatus){case"pending":return{name:"priority",color:"#e9edfa"};case"success":return{name:"right-o",color:"rgb(61, 204, 166)"};case"error":return{name:"error-o",color:"rgb(249, 95, 91)"};default:return{name:"",color:""}}}),w=()=>{l.value!=="change"&&(s.value=!1)};return()=>{var y,F,h,m,x,A,S,P;const{feedbackStatus:u,extraInfo:E}=t;return f.withDirectives(f.createVNode("div",{class:"form-control",ref:r,"data-uid":o},[s.value&&f.createVNode(f.Teleport,{to:"body"},{default:()=>[f.createVNode("div",{style:{position:"absolute",left:q+"px",top:b+"px",width:d.width+"px",height:d.height+"px"}},[f.createVNode(qe,{controlled:l.value!=="change",visible:s.value,content:g.value,popType:"error",position:p.value},null)])]}),f.createVNode("div",{class:`devui-form-control-container${a?" devui-form-control-container-horizontal":""}${u?" has-feedback":""}${u==="error"?" feedback-error":""}`},[f.createVNode("div",{class:"devui-control-content-wrapper",id:o},[(F=(y=e.slots).default)==null?void 0:F.call(y)]),(u||((m=(h=e.slots).suffixTemplate)==null?void 0:m.call(h)))&&f.createVNode("span",{class:"feedback-status"},[((A=(x=e.slots).suffixTemplate)==null?void 0:A.call(x))?(P=(S=e.slots).suffixTemplate)==null?void 0:P.call(S):f.createVNode(be,{name:c.value.name,color:c.value.color},null)])]),E&&f.createVNode("div",{class:"devui-form-control-extra-info"},[E])]),[[f.resolveDirective("clickoutside"),w]])}}}),Cr="",Z=f.defineComponent({name:"DFormOperation",props:{},setup(t,e){return()=>{var r,n;return f.createVNode("div",{class:"form-operation"},[(n=(r=e.slots).default)==null?void 0:n.call(r)])}}}),Dr="",re;(function(t){t.dirty="dirty",t.pristine="pristine"})(re||(re={}));var ne;(function(t){t.input="input",t.focus="focus",t.change="change",t.blur="blur",t.submit="submit"})(ne||(ne={}));var I;(function(t){t.popover="popover",t.text="text",t.none="none",t.toast="toast"})(I||(I={}));function yr(t,e){if(!t)return console.error("[v-d-validate] validator's key is invalid"),null;switch(t){case"maxlength":return{type:"string",max:e,asyncValidator:(r,n)=>new Promise((i,a)=>{n.length>e?a("\u6700\u5927\u957F\u5EA6\u4E3A"+e):i("\u6821\u9A8C\u901A\u8FC7")})};case"minlength":return{type:"string",min:e,asyncValidator:(r,n)=>new Promise((i,a)=>{n.length<e?a("\u6700\u5C0F\u957F\u5EA6\u4E3A"+e):i("\u6821\u9A8C\u901A\u8FC7")})};case"min":return{type:"number",asyncValidator:(r,n)=>new Promise((i,a)=>{n<e?a("\u6700\u5C0F\u503C\u4E3A"+e):i("\u6821\u9A8C\u901A\u8FC7")})};case"max":return{type:"number",asyncValidator:(r,n)=>new Promise((i,a)=>{n>e?a("\u6700\u5927\u503C\u4E3A"+e):i("\u6821\u9A8C\u901A\u8FC7")})};case"required":return{reqiured:!0,asyncValidator:(r,n)=>new Promise((i,a)=>{n?i("\u6821\u9A8C\u901A\u8FC7"):a("\u5FC5\u586B\u9879")})};case"requiredTrue":return{asyncValidator:(r,n)=>new Promise((i,a)=>{n?i("\u6821\u9A8C\u901A\u8FC7"):a("\u5FC5\u987B\u4E3Atrue\u503C")})};case"email":return{type:"email",message:"\u90AE\u7BB1\u683C\u5F0F\u4E0D\u6B63\u786E"};case"pattern":return{type:"regexp",pattern:e,message:"\u53EA\u80FD\u5305\u542B\u6570\u5B57\u4E0E\u5927\u5C0F\u5199\u5B57\u7B26",validator:(r,n)=>e.test(n)};case"whitespace":return{message:"\u8F93\u5165\u4E0D\u80FD\u5168\u90E8\u4E3A\u7A7A\u683C\u6216\u7A7A\u5B57\u7B26",validator:(r,n)=>!!n.trim()};default:return{[t]:e}}}function gr(t){const e=[];for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push({key:r,value:t[r]});return e}function ke(t){const e=[...t.classList];e.push("d-validate-rules-error-pristine"),t.setAttribute("class",e.join(" "))}function hr(t){const e=[...t.classList],r=e.indexOf("d-validate-rules-error-pristine");r!==-1&&e.splice(r,1),t.setAttribute("class",e.join(" "))}function Be(t){if(t.tagName.toLocaleLowerCase()==="body")return"";if(t.parentElement.id.startsWith("dfc-"))return t.parentElement.id;Be(t.parentElement)}function vr({el:t,tipEl:e,message:r="",isFormTag:n,messageShowType:i,dfcUID:a,popPosition:o="right-bottom",updateOn:s}){if(n&&i===I.toast){alert(r);return}if(a||(a=Be(t)),I.popover===i){_.emit("showPopoverErrorMessage",{showPopover:!0,message:r,uid:a,popPosition:o,updateOn:s});return}e.innerText=""+r,e.style.display="inline-flex",e.setAttribute("class","d-validate-tip"),ke(t)}function br(t,e){e.style.display="none",hr(t)}function Fr(t){const e=t.instance.$refs;return Object.keys(e)[0]}function wr(t){const e=t.instance.$refs,r=Object.keys(e)[0];return e[r].name}function ze({validator:t,modelValue:e,el:r,tipEl:n,isFormTag:i,messageShowType:a,dfcUID:o,popPosition:s,updateOn:l}){t.validate({modelName:e}).then(()=>{br(r,n)}).catch(g=>{const{errors:p}=g;if(!p||p.length===0)return;let d="";typeof p[0].message=="object"?d=p[0].message.default:d=p[0].message,vr({el:r,tipEl:n,message:d,isFormTag:i,messageShowType:a,dfcUID:o,popPosition:s,updateOn:l})})}function He(t){const r=["left","right","top","bottom","left-top","left-bottom","top-left","top-right","right-top","right-bottom","bottom-left","bottom-right"].includes(t);return!r&&console.warn(`invalid popPosition value '${t}'.`),r}var Or={mounted(t,e,r){var x;const n=t.tagName==="FORM",i=t.parentNode.parentNode.parentElement.dataset.uid,a=Fr(e),o=ie(e.value)&&oe(e.value,"options");let{rules:s,options:l={},messageShowType:g=I.popover}=e.value,{errorStrategy:p}=e.value;a&&(g=(x=e.instance[a].messageShowType)!=null?x:"popover");let{updateOn:d=ne.change,errorStrategy:O=re.dirty,asyncDebounceTime:q=300,popPosition:b=["right","bottom"]}=l;g===I.popover&&(Array.isArray(b)&&(b=b.length>1?b.join("-"):b[0]),He(b)||(b="right-bottom")),p||(p=O);let c={};o?c=s!=null?s:e.value:c=e.value;const w=c&&ie(c)&&(oe(c,"validators")||oe(c,"asyncValidators")),u=Array.isArray(c)?c:[c],E=document.createElement("span");g!==I.none&&t.parentNode.append(E);const y={modelName:[]};if(u.forEach(A=>{const S=!Array.isArray(A)&&gr(A);let P={},M={};S.forEach(T=>{M=yr(T.key,T.value),P=X(X({},P),M)}),y.modelName.push(P)}),w){const{validators:A,asyncValidators:S}=c;A&&A.forEach(P=>{const M={message:(P==null?void 0:P.message)||"",validator:(T,C)=>P.validator(T,C)};y.modelName.push(M)}),S&&S.forEach(P=>{const M={message:(P==null?void 0:P.message)||"",asyncValidator:(T,C)=>new Promise(dr((he,xr)=>{P.asyncValidator(T,C)?he(""):xr(T.message)},q))};y.modelName.push(M)})}const F=new k(y),h=A=>{const S=A.target.value;g===I.popover&&_.emit("showPopoverErrorMessage",{showPopover:!1,message:"",uid:i,popPosition:b,updateOn:d}),ze({validator:F,modelValue:S,el:t,tipEl:E,isFormTag:!1,messageShowType:g,dfcUID:i,popPosition:b,updateOn:d})};r.children[0].el.addEventListener(d,h),g===I.popover&&d===ne.change&&r.children[0].el.addEventListener("focus",()=>{_.emit("showPopoverErrorMessage",{showPopover:!1,uid:i,updateOn:d})}),p===re.pristine&&(ke(t),r.children[0].props.value=""+r.children[0].props.value);const m=wr(e);m&&_.on(`formSubmit:${m}`,()=>{const A=n?"":r.children[0].el.value;ze({validator:F,modelValue:A,el:t,tipEl:E,isFormTag:n,messageShowType:g,updateOn:"submit"})})}};z.install=function(t){t.component(z.name,z),t.directive("d-validate-rules",Or)},H.install=function(t){t.component(H.name,H)},J.install=function(t){t.component(J.name,J)},Y.install=function(t){t.component(Y.name,Y)},Z.install=function(t){t.component(Z.name,Z)};var Ar={title:"Form \u8868\u5355",category:"\u6570\u636E\u5F55\u5165",status:"75%",install(t){t.use(z),t.use(H),t.use(J),t.use(Y),t.use(Z)}};j.Form=z,j.FormControl=Y,j.FormItem=J,j.FormLabel=H,j.FormOperation=Z,j.default=Ar,Object.defineProperty(j,"__esModule",{value:!0}),j[Symbol.toStringTag]="Module"});
@@ -0,0 +1,3 @@
1
+ import '../../auto-complete/style.css'
2
+
3
+ export { AutoComplete as default } from '../../auto-complete/index.es.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-devui",
3
- "version": "1.0.0-beta.13",
3
+ "version": "1.0.0-beta.14",
4
4
  "license": "MIT",
5
5
  "description": "DevUI components based on Vite and Vue3",
6
6
  "keywords": [
@@ -24,11 +24,11 @@ const statisticProps = {
24
24
  },
25
25
  groupSeparator: {
26
26
  type: String,
27
- default: ","
27
+ default: ""
28
28
  },
29
29
  showGroupSeparator: {
30
30
  type: Boolean,
31
- default: false
31
+ default: true
32
32
  },
33
33
  titleStyle: {
34
34
  type: Object
@@ -1 +1 @@
1
- var q=Object.defineProperty;var B=(a,e,f)=>e in a?q(a,e,{enumerable:!0,configurable:!0,writable:!0,value:f}):a[e]=f;var s=(a,e,f)=>(B(a,typeof e!="symbol"?e+"":e,f),f);(function(a,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(a=typeof globalThis!="undefined"?globalThis:a||self,e(a.index={},a.Vue))})(this,function(a,e){"use strict";const f={title:{type:String,default:""},value:{type:[Number,String]},prefix:{type:String},suffix:{type:String},precision:{type:Number},groupSeparator:{type:String,default:","},showGroupSeparator:{type:Boolean,default:!1},titleStyle:{type:Object},contentStyle:{type:Object},animationDuration:{type:Number,default:2e3},valueFrom:{type:Number},animation:{type:Boolean,default:!1},start:{type:Boolean,default:!1},extra:{type:String,default:""},easing:{type:String,default:"easeOutCubic"},delay:{type:Number,default:0}},g=(t,i,n)=>t.replace(/\d+/,function(u){return u.replace(/(\d)(?=(\d{3})+$)/g,function(h){return h+`${n?i:""}`})}),w=t=>{if(!isNaN(t))return(t+"").indexOf(".")!==-1},C=(t,i,n,r,u)=>{const h=i.toString().indexOf(".")!==-1?i.toString().length-i.toString().indexOf(".")-1:0;return typeof t=="number"?w(t)?g(r?t.toFixed(r).toString():t.toFixed(h).toString(),n,u):g(r?t.toFixed(r).toString():t.toString(),n,u):t},c=Math.pow,v=Math.sqrt,D=function(t){return 1-c(1-t,3)},E=t=>t,V=function(t){return t===1?1:1-c(2,-10*t)},A=function(t){return t===0?0:t===1?1:t<.5?c(2,20*t-10)/2:(2-c(2,-20*t+10))/2},I=function(t){return t===0?0:c(2,10*t-10)},M=function(t){return t<.5?(1-v(1-c(2*t,2)))/2:(v(1-c(-2*t+2,2))+1)/2};var _=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",easeOutCubic:D,linear:E,easeOutExpo:V,easeInOutExpo:A,easeInExpo:I,easeInOutCirc:M});class j{constructor(i){s(this,"from");s(this,"to");s(this,"duration");s(this,"delay");s(this,"easing");s(this,"onStart");s(this,"onUpdate");s(this,"onFinish");s(this,"startTime");s(this,"started");s(this,"finished");s(this,"timer");s(this,"time");s(this,"elapsed");s(this,"keys");const{from:n,to:r,duration:u,delay:h,easing:S,onStart:l,onUpdate:d,onFinish:m}=i;for(const o in n)r[o]===void 0&&(r[o]=n[o]);for(const o in r)n[o]===void 0&&(n[o]=r[o]);this.from=n,this.to=r,this.duration=u,this.delay=h,this.easing=S,this.onStart=l,this.onUpdate=d,this.onFinish=m,this.startTime=Date.now()+this.delay,this.started=!1,this.finished=!1,this.timer=null,this.keys={}}update(){if(this.time=Date.now(),!(this.time<this.startTime)&&!this.finished){if(this.elapsed===this.duration){this.finished||(this.finished=!0,this.onFinish&&this.onFinish(this.keys));return}this.elapsed=this.time-this.startTime,this.elapsed=this.elapsed>this.duration?this.duration:this.elapsed;for(const i in this.to)this.keys[i]=this.from[i]+(this.to[i]-this.from[i])*_[this.easing](this.elapsed/this.duration);this.started||(this.onStart&&this.onStart(this.keys),this.started=!0),this.onUpdate(this.keys)}}start(){this.startTime=Date.now()+this.delay;const i=()=>{this.update(),this.timer=requestAnimationFrame(i),this.finished&&(cancelAnimationFrame(this.timer),this.timer=null)};i()}stop(){cancelAnimationFrame(this.timer),this.timer=null}}var $="",y=e.defineComponent({name:"DStatistic",inheritAttrs:!1,props:f,setup(t,i){var S;const n=e.ref((S=t.valueFrom)!=null?S:t.value),r=e.ref(null),u=(l=(m=>(m=t.valueFrom)!=null?m:0)(),d=typeof t.value=="number"?t.value:Number(t.value))=>{l!==d&&(r.value=new j({from:{value:l},to:{value:d},delay:t.delay,duration:t.animationDuration,easing:t.easing,onUpdate:o=>{n.value=o.value},onFinish:()=>{n.value=d}}),r.value.start())},h=e.computed(()=>C(n.value,t.value,t.groupSeparator,t.precision,t.showGroupSeparator));return e.onMounted(()=>{t.animation&&t.start&&u()}),e.watch(()=>t.start,l=>{l&&!r.value&&u()}),()=>{var l,d,m,o,x,F,O,b,p,N,T,k;return e.createVNode("div",e.mergeProps({class:"devui-statistic"},i.attrs),[e.createVNode("div",{class:"devui-statistic-title",style:t.titleStyle},[((d=(l=i.slots).title)==null?void 0:d.call(l))||t.title]),e.createVNode("div",{class:"devui-statistic-content",style:t.contentStyle},[t.prefix||((o=(m=i.slots).prefix)==null?void 0:o.call(m))?e.createVNode("span",{class:"devui-statistic-prefix"},[((F=(x=i.slots).prefix)==null?void 0:F.call(x))||t.prefix]):null,e.createVNode("span",{class:"devui-statistic--value"},[h.value]),t.suffix||((b=(O=i.slots).suffix)==null?void 0:b.call(O))?e.createVNode("span",{class:"devui-statistic-suffix"},[((N=(p=i.slots).suffix)==null?void 0:N.call(p))||t.suffix]):null]),((k=(T=i.slots).extra)==null?void 0:k.call(T))||t.extra])}}});y.install=function(t){t.component(y.name,y)};var U={title:"Statistic \u7EDF\u8BA1\u6570\u503C",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(t){t.use(y)}};a.Statistic=y,a.default=U,Object.defineProperty(a,"__esModule",{value:!0}),a[Symbol.toStringTag]="Module"});
1
+ var q=Object.defineProperty;var B=(a,e,f)=>e in a?q(a,e,{enumerable:!0,configurable:!0,writable:!0,value:f}):a[e]=f;var s=(a,e,f)=>(B(a,typeof e!="symbol"?e+"":e,f),f);(function(a,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(a=typeof globalThis!="undefined"?globalThis:a||self,e(a.index={},a.Vue))})(this,function(a,e){"use strict";const f={title:{type:String,default:""},value:{type:[Number,String]},prefix:{type:String},suffix:{type:String},precision:{type:Number},groupSeparator:{type:String,default:""},showGroupSeparator:{type:Boolean,default:!0},titleStyle:{type:Object},contentStyle:{type:Object},animationDuration:{type:Number,default:2e3},valueFrom:{type:Number},animation:{type:Boolean,default:!1},start:{type:Boolean,default:!1},extra:{type:String,default:""},easing:{type:String,default:"easeOutCubic"},delay:{type:Number,default:0}},g=(t,i,n)=>t.replace(/\d+/,function(u){return u.replace(/(\d)(?=(\d{3})+$)/g,function(h){return h+`${n?i:""}`})}),w=t=>{if(!isNaN(t))return(t+"").indexOf(".")!==-1},C=(t,i,n,r,u)=>{const h=i.toString().indexOf(".")!==-1?i.toString().length-i.toString().indexOf(".")-1:0;return typeof t=="number"?w(t)?g(r?t.toFixed(r).toString():t.toFixed(h).toString(),n,u):g(r?t.toFixed(r).toString():t.toString(),n,u):t},c=Math.pow,v=Math.sqrt,D=function(t){return 1-c(1-t,3)},E=t=>t,V=function(t){return t===1?1:1-c(2,-10*t)},A=function(t){return t===0?0:t===1?1:t<.5?c(2,20*t-10)/2:(2-c(2,-20*t+10))/2},I=function(t){return t===0?0:c(2,10*t-10)},M=function(t){return t<.5?(1-v(1-c(2*t,2)))/2:(v(1-c(-2*t+2,2))+1)/2};var _=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",easeOutCubic:D,linear:E,easeOutExpo:V,easeInOutExpo:A,easeInExpo:I,easeInOutCirc:M});class j{constructor(i){s(this,"from");s(this,"to");s(this,"duration");s(this,"delay");s(this,"easing");s(this,"onStart");s(this,"onUpdate");s(this,"onFinish");s(this,"startTime");s(this,"started");s(this,"finished");s(this,"timer");s(this,"time");s(this,"elapsed");s(this,"keys");const{from:n,to:r,duration:u,delay:h,easing:S,onStart:l,onUpdate:d,onFinish:m}=i;for(const o in n)r[o]===void 0&&(r[o]=n[o]);for(const o in r)n[o]===void 0&&(n[o]=r[o]);this.from=n,this.to=r,this.duration=u,this.delay=h,this.easing=S,this.onStart=l,this.onUpdate=d,this.onFinish=m,this.startTime=Date.now()+this.delay,this.started=!1,this.finished=!1,this.timer=null,this.keys={}}update(){if(this.time=Date.now(),!(this.time<this.startTime)&&!this.finished){if(this.elapsed===this.duration){this.finished||(this.finished=!0,this.onFinish&&this.onFinish(this.keys));return}this.elapsed=this.time-this.startTime,this.elapsed=this.elapsed>this.duration?this.duration:this.elapsed;for(const i in this.to)this.keys[i]=this.from[i]+(this.to[i]-this.from[i])*_[this.easing](this.elapsed/this.duration);this.started||(this.onStart&&this.onStart(this.keys),this.started=!0),this.onUpdate(this.keys)}}start(){this.startTime=Date.now()+this.delay;const i=()=>{this.update(),this.timer=requestAnimationFrame(i),this.finished&&(cancelAnimationFrame(this.timer),this.timer=null)};i()}stop(){cancelAnimationFrame(this.timer),this.timer=null}}var $="",y=e.defineComponent({name:"DStatistic",inheritAttrs:!1,props:f,setup(t,i){var S;const n=e.ref((S=t.valueFrom)!=null?S:t.value),r=e.ref(null),u=(l=(m=>(m=t.valueFrom)!=null?m:0)(),d=typeof t.value=="number"?t.value:Number(t.value))=>{l!==d&&(r.value=new j({from:{value:l},to:{value:d},delay:t.delay,duration:t.animationDuration,easing:t.easing,onUpdate:o=>{n.value=o.value},onFinish:()=>{n.value=d}}),r.value.start())},h=e.computed(()=>C(n.value,t.value,t.groupSeparator,t.precision,t.showGroupSeparator));return e.onMounted(()=>{t.animation&&t.start&&u()}),e.watch(()=>t.start,l=>{l&&!r.value&&u()}),()=>{var l,d,m,o,x,F,O,b,p,N,T,k;return e.createVNode("div",e.mergeProps({class:"devui-statistic"},i.attrs),[e.createVNode("div",{class:"devui-statistic-title",style:t.titleStyle},[((d=(l=i.slots).title)==null?void 0:d.call(l))||t.title]),e.createVNode("div",{class:"devui-statistic-content",style:t.contentStyle},[t.prefix||((o=(m=i.slots).prefix)==null?void 0:o.call(m))?e.createVNode("span",{class:"devui-statistic-prefix"},[((F=(x=i.slots).prefix)==null?void 0:F.call(x))||t.prefix]):null,e.createVNode("span",{class:"devui-statistic--value"},[h.value]),t.suffix||((b=(O=i.slots).suffix)==null?void 0:b.call(O))?e.createVNode("span",{class:"devui-statistic-suffix"},[((N=(p=i.slots).suffix)==null?void 0:N.call(p))||t.suffix]):null]),((k=(T=i.slots).extra)==null?void 0:k.call(T))||t.extra])}}});y.install=function(t){t.component(y.name,y)};var U={title:"Statistic \u7EDF\u8BA1\u6570\u503C",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(t){t.use(y)}};a.Statistic=y,a.default=U,Object.defineProperty(a,"__esModule",{value:!0}),a[Symbol.toStringTag]="Module"});
@@ -1 +1 @@
1
- .devui-statistic{box-sizing:border-box;margin:0;padding:0;font-size:14px;line-height:1.5715;list-style:none}.devui-statistic-title{margin-bottom:4px;opacity:.7;font-size:14px}.devui-statistic-content{font-size:24px;display:flex;align-items:center}.devui-statistic-prefix{margin-right:6px;display:flex}.devui-statistic-suffix{margin-left:6px;display:flex}.devui-statistic--value{display:inline-block}
1
+ .devui-statistic{box-sizing:border-box;margin:0;padding:0;font-size:14px;line-height:1.5715;list-style:none}.devui-statistic-title{margin-bottom:4px;opacity:.7;font-size:14px}.devui-statistic-content{font-size:24px;display:flex;align-items:center}.devui-statistic-prefix{margin-right:6px;display:flex;align-items:center}.devui-statistic-suffix{margin-left:6px;display:flex;align-items:center}.devui-statistic--value{display:inline-block}