@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
2 lines (1 loc) • 8.9 kB
JavaScript
(function(a,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("../dynamic-resolver/index.umd.js"),require("../designer-canvas/index.umd.js")):typeof define=="function"&&define.amd?define(["exports","vue","../dynamic-resolver/index.umd.js","../designer-canvas/index.umd.js"],e):(a=typeof globalThis<"u"?globalThis:a||self,e(a["verify-detail"]={},a.Vue,a.dynamicResolver,a.designerCanvas))})(this,function(a,e,h,A){"use strict";var G=Object.defineProperty;var J=(a,e,h)=>e in a?G(a,e,{enumerable:!0,configurable:!0,writable:!0,value:h}):a[e]=h;var q=(a,e,h)=>J(a,typeof e!="symbol"?e+"":e,h);const O=new Map([["appearance",h.resolveAppearance]]);function R(n,s,o){return s}const B={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/verify-detail.schema.json",title:"verify-detail",description:"A Farris Component",type:"object",properties:{id:{description:"The unique identifier for verify-detail",type:"string"},type:{description:"The type string of verify-detail",type:"string",default:"verify-detail"},appearance:{description:"",type:"object",properties:{class:{type:"string"},style:{type:"string"}},default:{}},binding:{description:"",type:"object",default:{}},disable:{type:"string",default:!1},editable:{description:"",type:"boolean",default:!0},placeholder:{description:"",type:"string",default:""},readonly:{description:"",type:"boolean",default:!1},require:{description:"",type:"boolean",default:!1},tabindex:{description:"",type:"number",default:-1},visible:{description:"",type:"boolean",default:!0}},required:["id","type"]},E={title:"verify-detail",description:"A Farris Component",type:"object",categories:{basic:{description:"Basic Infomation",title:"基本信息",properties:{id:{description:"组件标识",title:"标识",type:"string",readonly:!0},type:{description:"组件类型",title:"控件类型",type:"select",editor:{type:"waiting for modification",enum:[]}}}}}},C={showType:{type:String,default:""},showList:{type:Boolean,default:!1},verifyList:{type:Array,default:[]},verifyType:{type:Array,default:[]},customClass:{type:String,default:""},maxHeight:{type:Number,default:200},onValidatorClick:{type:Function}},T=h.createPropsResolver(C,B,O,R,E),g=e.defineComponent({name:"FVerifyDetail",props:C,emits:["validatorClick","listshow"],setup(n,s){let o=[];const r=e.ref(n.showList);e.watch(()=>n.showList,()=>{r.value=n.showList});const f=e.ref(n.verifyType);e.watch(()=>n.verifyType,()=>{f.value=n.verifyType});function m(){r.value=!r.value,s.emit("listshow",r.value)}function V(t){var l;!t&&f.value&&f.value.length>0&&(t=f.value[0].type),(l=f.value)==null||l.forEach(d=>{d.active=d.type===t})}function y(t){t=t||o[0].type,o.forEach(l=>{l.show=l.type===t})}function N(t){t.length<=0||(V(t.type),y(t.type))}function D(){r.value=!1,s.emit("listshow",!1)}function b(t){var l;(l=n.onValidatorClick)==null||l.call(n,t)}function k(t){return e.createVNode("li",{class:"f-verify-list",onClick:()=>b(t)},[e.createVNode("span",{class:["f-icon f-icon-close-outline list-icon list-error",{"list-warning":t.type==="warn"}]},null),e.createVNode("div",{class:"list-con"},[e.createVNode("div",{class:"list-title",title:t.title},[t.title]),e.createVNode("div",{class:"list-msg",title:t.msg},[t.msg])])])}function L(){return o.map(t=>e.createVNode("ul",{class:["f-verify-list-content",{active:t.show}]},[t.list&&t.list.map(l=>k(l))]))}const w=e.computed(()=>{var t;return((t=n.verifyList)==null?void 0:t.length)>0});function x(t){return{btn:!0,"verify-title-btn":!0,"f-state-selected":t.active,disabled:t.length<=0}}const H=e.computed(()=>{var t;return(t=f.value)==null?void 0:t.map(l=>e.createVNode("button",{class:x(l),onClick:()=>N(l)},[l.title,e.createVNode("span",null,[l.length])]))}),$=e.computed(()=>{var t;return e.createVNode("div",{class:"f-verify-nums",onClick:m},[e.createVNode("span",{class:"nums-icon f-icon f-icon-warning"},null),e.createVNode("span",{class:"nums-count"},[(t=n.verifyList)==null?void 0:t.length])])});function S(){var l;const t=[];f.value&&((l=f.value)!=null&&l.length)&&(f.value.map(d=>{const p={list:d.type==="all"?n.verifyList:[],show:!1,type:d.type};t.push(p)}),t.map((d,p)=>{const M=n.verifyList.filter(F=>F.type===d.type);t[p].list=p!==0?M:t[p].list}),f.value.map((d,p)=>{d.length=t[p].list.length})),o=t}return e.onBeforeMount(()=>{S(),y(n.showType),V(n.showType)}),()=>e.createVNode("div",{class:w.value?`f-verify-detail ${n.customClass}`:""},[w.value?e.createVNode("div",{class:"f-verify-detail-content"},[$.value,e.createVNode("div",{class:"f-verify-form-main",hidden:!r.value},[e.createVNode("div",{class:"f-verify-form-content"},[e.createVNode("div",{class:"f-verify-form-content-arrow"},null),e.createVNode("div",{class:"f-verify-form-content-list"},[e.createVNode("div",{class:"f-verify-forms-title"},[e.createVNode("div",{class:"btn-group"},[H.value]),e.createVNode("div",{class:"f-verify-close",onClick:D},[e.createVNode("span",{class:"f-icon f-icon-close"},null)])]),e.createVNode("div",{class:"f-verify-forms-list",style:{maxHeight:n.maxHeight+"px"}},[L()])])])])]):null])}});function P(n,s,o){e.createApp({setup(){return e.onUnmounted(()=>{s&&s()}),()=>e.createVNode(g,n,null)}}).mount(o)}class j{static show(s,o){this.clear();let r=0;this.verifyContainer=document.createElement("div"),o&&o.offsetHeight>0?(r=o.offsetHeight-120,o.appendChild(this.verifyContainer)):(r=document.documentElement.clientHeight-120,document.body.appendChild(this.verifyContainer)),s.maxHeight=s.maxHeight?s.maxHeight:r,P(s,this.clear,this.verifyContainer)}static clear(){let s=this.verifyContainer;s&&(s.parentNode&&s.parentNode.removeChild(s),s=null)}}q(j,"verifyContainer",null);const _=e.defineComponent({name:"FVerifyDetailDesign",props:C,emits:["validatorClick","listshow"],setup(n,s){let o=[];const r=e.ref(n.showList),f=e.ref(n.maxHeight),m=e.ref(n.verifyList),V=e.ref(n.showType),y=e.ref(n.verifyType),N=e.ref(),D=e.inject("design-item-context"),b=A.useDesignerComponent(N,D);e.onMounted(()=>{N.value.componentInstance=b}),s.expose(b.value);function k(){r.value=!r.value,s.emit("listshow",r.value)}function L(i){var c;(c=y.value)==null||c.forEach(u=>{u.active=u.type===i})}function w(i){o.forEach(c=>{c.show=c.type===i})}function x(i){i.length<=0||(L(i.type),w(i.type))}function H(){r.value=!1,s.emit("listshow",!1)}function $(i){s.emit("validatorClick",i)}function S(i){return e.createVNode("li",{class:"f-verify-list",onClick:()=>$(i)},[e.createVNode("span",{class:["f-icon f-icon-close-outline list-icon list-error",{"list-warning":i.type==="warn"}]},null),e.createVNode("div",{class:"list-con"},[e.createVNode("p",{class:"list-title",title:i.title},[i.title]),e.createVNode("p",{class:"list-msg",title:i.msg},[i.msg])])])}function t(){return o.map(i=>e.createVNode("ul",{class:["f-verify-list-content",{active:i.show}]},[i.list&&i.list.map(c=>S(c))]))}const l=e.computed(()=>{var i;return((i=m.value)==null?void 0:i.length)>0});function d(i){return{"btn btn-secondary":!0,active:i.active,disabled:i.length<=0}}const p=e.computed(()=>{var i;return(i=y.value)==null?void 0:i.map(c=>e.createVNode("button",{class:d(c),onClick:()=>x(c)},[c.title,e.createVNode("span",null,[c.length])]))}),M=e.computed(()=>{var i;return e.createVNode("div",{class:"f-verify-nums",onClick:k},[e.createVNode("span",{class:"nums-icon f-icon f-icon-warning"},null),e.createVNode("span",{class:"nums-count"},[(i=m.value)==null?void 0:i.length])])});function F(){var c;const i=[];y.value&&((c=y.value)!=null&&c.length)&&(y.value.map(u=>{const v={list:u.type==="all"?m.value:[],show:!1,type:u.type};i.push(v)}),i.map((u,v)=>{const U=m.value.filter(z=>z.type===u.type);i[v].list=v!==0?U:i[v].list}),y.value.map((u,v)=>{u.length=i[v].list.length})),o=i}return e.onBeforeMount(()=>{F(),w(V.value),L(V.value)}),()=>e.createVNode("div",{ref:N},[l.value?e.createVNode("div",{class:"f-verify-detail"},[e.createVNode("div",{class:"f-verify-detail-content"},[M.value,e.createVNode("div",{class:"f-verify-form-main",hidden:!r.value},[e.createVNode("div",{class:"f-verify-form-content"},[e.createVNode("div",{class:"f-verify-form-content-arrow"},null),e.createVNode("div",{class:"f-verify-form-content-list"},[e.createVNode("div",{class:"f-verify-forms-title"},[e.createVNode("div",{class:"btn-group"},[p.value]),e.createVNode("div",{class:"f-verify-close",onClick:H},[e.createVNode("span",{class:"f-icon f-icon-close"},null)])]),e.createVNode("div",{class:"f-verify-forms-list",style:{maxHeight:f.value+"px"}},[t()])])])])])]):null])}}),I={install(n){n.component(g.name,g),n.provide("FVerifyDetailService",j)},register(n,s,o,r){n["verify-detail"]=g,s["verify-detail"]=T},registerDesigner(n,s,o){n["verify-detail"]=_,s["verify-detail"]=T}};a.FVerifyDetail=g,a.FVerifyDetailService=j,a.default=I,a.propsResolver=T,a.verifyDetailProps=C,Object.defineProperties(a,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});