@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
39 lines (36 loc) • 45.5 kB
JavaScript
(function(k,$){typeof exports=="object"&&typeof module<"u"?$(exports,require("../../components/common/index.umd.js"),require("../../components/list-view/index.umd.js"),require("../../components/dynamic-resolver/index.umd.js"),require("vue"),require("../../components/designer-canvas/index.umd.js"),require("../../components/data-view/index.umd.js"),require("../../components/locale/index.umd.js"),require("../../components/checkbox/index.umd.js"),require("lodash-es")):typeof define=="function"&&define.amd?define(["exports","../../components/common/index.umd.js","../../components/list-view/index.umd.js","../../components/dynamic-resolver/index.umd.js","vue","../../components/designer-canvas/index.umd.js","../../components/data-view/index.umd.js","../../components/locale/index.umd.js","../../components/checkbox/index.umd.js","lodash-es"],$):(k=typeof globalThis<"u"?globalThis:k||self,$(k["list-view"]={},k.common,k.FListView,k.dynamicResolver,k.Vue,k.designerCanvas,k.dataView,k.locale,k.checkbox,k.LodashES))})(this,function(k,$,O,H,t,A,j,ce,J,de){"use strict";var Re=Object.defineProperty;var $e=(k,$,O)=>$ in k?Re(k,$,{enumerable:!0,configurable:!0,writable:!0,value:O}):k[$]=O;var R=(k,$,O)=>$e(k,typeof $!="symbol"?$+"":$,O);function ue(r,e){function n(o){const i=[];let d=o.nextNode();for(;d;)i.push(d),d=o.nextNode();return i}function s(o,i){const d=document.createTreeWalker(o,NodeFilter.SHOW_TEXT);return n(d).map(u=>({textNode:u,text:(u.textContent||"").toLocaleLowerCase()})).map(({textNode:u,text:h})=>{const v=[];let y=0;for(;y<h.length;){const V=h.indexOf(i,y);if(V===-1)break;v.push(V),y=V+i.length}return v.map(V=>{const C=new Range;return C.setStart(u,V),C.setEnd(u,V+i.length),C})}).flat()}function a(o){if(!CSS.highlights||(CSS.highlights.clear(),!o||!e))return;const i=s(e.value,o.toLocaleLowerCase()),d=new Highlight(...i);CSS.highlights.set("search-result",d)}return{search:a}}function te(r,e,n,s,a,o,i,d,l,m){const c=t.ref(r.size),u=t.ref(r.textField),h=t.ref(r.titleField),v=t.ref(r.disableField),y=t.computed(()=>{var w,M;return((w=r.selection)==null?void 0:w.multiSelect)&&((M=r.selection)==null?void 0:M.showCheckbox)}),{onMouseenterItem:V,onMouseoverItem:C,onMouseoutItem:b}=o,{getKey:I,listViewItemClass:E,listViewItemStyle:T,onCheckItem:B,onClickItem:x}=i,D=t.computed(()=>{const w={"text-overflow":"ellipsis",overflow:"hidden","white-space":"nowrap"};return r.itemClass?w:{margin:c.value==="small"?"0.25rem 0":"8px 0",...w}});function N(w,M,P){return w.checked=d.findIndexInSelectedItems(w)>-1,t.createVNode("li",{class:E(w,M),id:I(w,M),key:I(w,M),style:T(w,M),onClick:F=>x(w,M,F),onMouseenter:F=>V(F,w,M),onMouseover:F=>C(F,w,M),onMouseout:F=>b(F,w,M)},[y.value&&t.createVNode("div",{class:"f-list-select",onClick:F=>F.stopPropagation()},[t.createVNode(J.FCheckbox,{id:"list-"+I(w,M),customClass:"listview-checkbox float-left",disabled:w[v.value],checked:w.checked,"onUpdate:checked":F=>w.checked=F,onChange:F=>{B(w,M,!F.checked)}},null)]),t.createVNode("div",{class:"f-list-content"},[t.createVNode("div",{class:r.itemContentClass,style:D.value,title:w.raw[h.value]||w.raw[u.value]},[w.raw[u.value]])])])}return{renderItem:N}}function pe(r,e,n,s,a,o,i,d,l,m){const c=t.ref(r.multiSelect),u=t.ref(r.disableField),h=t.ref(r.textField),{onMouseenterItem:v,onMouseoverItem:y,onMouseoutItem:V}=o,{getKey:C,listViewItemClass:b,listViewItemStyle:I,onCheckItem:E,onClickItem:T,updateSelectedItems:B}=i;function x(N,w,M){return r.contentTemplate?t.createVNode(t.Fragment,null,[r.contentTemplate({item:N.raw,index:w,selectedItem:M})]):e.slots.content?t.createVNode(t.Fragment,null,[e.slots.content&&e.slots.content({item:N.raw,index:w,selectedItem:M})]):t.createVNode("div",{style:"margin: 10px 0;"},[N.raw[h.value||"name"]])}function D(N,w,M){return t.createVNode("li",{class:b(N,w),id:C(N,w),key:C(N,w),style:I(N,w),onClick:P=>T(N,w,P),onMouseenter:P=>v(P,N,w),onMouseover:P=>y(P,N,w),onMouseout:P=>V(P,N,w)},[c.value&&t.createVNode("div",{class:"f-list-select",onClick:P=>P.stopPropagation()},[t.createVNode(J.FCheckbox,{id:"list-"+C(N,w),customClass:"listview-checkbox",disabled:N[u.value],checked:N.checked,"onUpdate:checked":P=>N.checked=P,onChange:P=>{E(N,w,!P.checked),B()}},null)]),t.createVNode("div",{class:"f-list-content"},[x(N,w,M)])])}return{renderItem:D}}function me(r,e,n,s,a,o,i,d,l,m){const c=t.ref(r.multiSelect),u=t.ref(r.disableField),h=t.ref(r.textField),{onMouseenterItem:v,onMouseoverItem:y,onMouseoutItem:V}=o,{getKey:C,listViewItemClass:b,onCheckItem:I,onClickItem:E}=i,{dragstart:T,dragenter:B,dragover:x,dragend:D}=s,{removeItem:N}=l,w=t.computed(()=>({margin:c.value?"10px 0":"10px 0px 10px 14px"}));function M(g,f=""){const S=g.target;S.title=S.scrollWidth>S.clientWidth?f:""}function P(g){return t.createVNode("div",{style:w.value,onMouseenter:f=>M(f,g.raw[h.value||"name"])},[g.raw[h.value||"name"]])}function F(){return e.slots.itemContent?e.slots.itemContent:P}const L=F();function q(g,f,S){return t.createVNode("li",{class:b(g,f),id:C(g,f),key:C(g,f),onClick:p=>E(g,f,p),onMouseenter:p=>v(p,g,f),onMouseover:p=>y(p,g,f),onMouseout:p=>V(p,g,f),draggable:"true",onDragstart:p=>T(p,g,f),onDragenter:p=>B(p,f),onDragend:p=>D(p,g),onDragover:p=>x(p)},[c.value&&t.createVNode("div",{class:"f-list-select",onClick:p=>p.stopPropagation()},[t.createVNode(J.FCheckbox,{id:"list-"+C(g,f),customClass:"listview-checkbox",disabled:g[u.value],checked:g.checked,"onUpdate:checked":p=>g.checked=p,onChange:p=>I(g,f,!p.checked)},null)]),t.createVNode("div",{class:"f-list-content"},[L(g)]),r.allowDelete&&t.createVNode("div",{class:"f-list-remove",onClick:p=>{p.stopPropagation(),N(f)}},[t.createVNode("div",{class:"f-list-remove-icon"},[t.createVNode("i",{class:"f-icon f-icon-remove_face"},null)])]),t.createVNode("div",{class:"f-list-handle"},[t.createVNode("div",null,[t.createVNode("i",{class:"f-icon f-icon-drag-vertical"},null)])])])}return{renderItem:q}}function fe(r,e,n,s,a,o,i,d,l,m){var C;const c=t.ref(((C=r.group)==null?void 0:C.groupFields)||[]),{collpaseGroupIconClass:u}=a,{toggleGroupRow:h}=m;function v(b,I){b.stopPropagation(),I.collapse=!I.collapse,n.value=h(I.collapse?"collapse":"expand",I,n.value)}function y(b,I,E){return e.slots.group?t.createVNode(t.Fragment,null,[e.slots.content&&e.slots.group({item:b.raw,index:I,selectedItem:E})]):t.createVNode("div",{class:"f-navlookup-recentHeader",onClick:T=>v(T,b)},[t.createVNode("div",{class:"fv-grid-group-row-icon"},[t.createVNode("span",{class:u(b)},null)]),t.createVNode("div",{class:"f-navlookup-recommandLabel"},[b.raw[c.value[b.layer]]])])}function V(b,I,E){return b.layer>-1&&y(b,I,E)}return{renderItem:V}}function ge(r,e,n,s){const{dataView:a}=n,{updateSelectedItems:o}=s;function i(d){if(d>-1&&d<a.value.length){if(r!=null&&r.checkBeforeRemoveItem&&!r.checkBeforeRemoveItem(a.value[d]))return;const l=a.value.splice(d,1);o(),e.emit("removeItem",l[0])}}return{removeItem:i}}function he(r,e,n,s,a,o,i,d,l,m){const c=t.ref(r.view),u=t.ref(r.view==="CardView"),h=t.ref({}),v=ge(r,e,s,l),y=t.computed(()=>({"f-list-view-group":!0,"f-list-view-group-multiselect":r.multiSelect,"d-flex":u.value,"flex-wrap":u.value})),V=t.computed(()=>!!n.value&&n.value.length>0),C=t.computed(()=>n.value.length===0);t.computed(()=>C.value&&!e.slots.empty);function b(){return c.value==="SingleView"?te:c.value==="DraggableView"?me:(c.value==="ContentView"||c.value==="CardView")&&(r.contentTemplate||e.slots.content)?pe:te}const I=b(),{renderItem:E}=I(r,e,n,m,a,o,l,i,v,d),{renderItem:T}=fe(r,e,n,m,a,o,l,i,v,d),B=[E,T];function x(){return n.value.filter(w=>w.visible!==!1).map((w,M)=>B[w.type](w,M,h))}function D(){return t.createVNode("div",{class:"f-list-view-emptydata",style:"margin: 0 auto;"},[t.createVNode("p",{class:"f-empty-title"},[r.emptyTemplate?r.emptyTemplate():e.slots.empty?e.slots.empty():ce.LocaleService.getLocaleValue("listView.emptyMessage")])])}function N(){return t.createVNode("ul",{class:y.value,style:"list-style: none;"},[V.value&&x(),C.value&&D()])}return{renderListArea:N}}function we(r,e,n){function s(){return e.slots.header&&t.createVNode("div",{class:"f-list-view-header"},[e.slots.header()])}return{renderHeader:s}}function ne(r,e,n){const s=t.ref(r.headerClass),a=t.ref(r.placeholder),o=t.ref(""),i=t.computed(()=>!o.value),d=t.computed(()=>!!o.value);function l(h){o.value=""}t.watch(o,h=>{r.enableHighlightSearch&&n.search(h),e.emit("afterSearch",h)});const m=t.computed(()=>{const h={"form-group":!0,"farris-form-group":!0};return s.value&&s.value.split(" ").reduce((y,V)=>(y[V]=!0,y),h),h});function c(h){}function u(){return t.createVNode("div",{class:"f-list-view-header",onClick:t.withModifiers(()=>c,["prevent","stop"])},[t.createVNode("div",{class:m.value},[t.createVNode("div",{class:"farris-input-wrap"},[t.createVNode("div",{class:"f-cmp-inputgroup"},[t.createVNode("div",{class:"input-group f-state-editable"},[t.withDirectives(t.createVNode("input",{class:"form-control f-utils-fill text-left","onUpdate:modelValue":h=>o.value=h,name:"input-group-value",type:"text",placeholder:a.value,autocomplete:"off"},null),[[t.vModelText,o.value]]),t.createVNode("div",{class:"input-group-append"},[d.value&&t.createVNode("span",{class:"input-group-text input-group-clear",onClick:h=>l()},[t.createVNode("i",{class:"f-icon f-icon-close-circle"},null)]),i.value&&t.createVNode("span",{class:"input-group-text"},[t.createVNode("span",{class:"f-icon f-icon-search"},null)])])])])])])])}return{renderHeader:u}}function ve(){const r=t.ref(""),e=t.ref(-1),n=t.ref(""),s=t.ref(-1),a=t.ref(!1);function o(u,h,v){s.value=v}function i(u,h,v){a.value||(s.value=v)}function d(u,h,v){s.value=-1}function l(){a.value=!0}function m(){a.value=!1}function c(){e.value=-1,r.value=""}return{activeIndex:e,focusedItemId:n,hoverIndex:s,clearActiveItem:c,onMouseenterItem:o,onMouseoverItem:i,onMouseoutItem:d,resumeHover:m,suspendHover:l}}function ye(r,e,n,s,a){const o=t.ref(r.idField),{dataView:i}=n,d=t.ref(-1),l=t.ref(!1),{activeIndex:m,focusedItemId:c,hoverIndex:u,resumeHover:h,suspendHover:v}=s;let y,V=0,C=0,b=null,I=null;const E=10,T=50;function B(g){if(!g)return null;const{overflowY:f}=getComputedStyle(g);return f==="auto"||f==="scroll"?g:B(g.parentElement)}function x(g,f){I&&clearInterval(I),I=window.setInterval(()=>{f==="up"?g.scrollTop-=E:g.scrollTop+=E},16)}function D(){I&&(clearInterval(I),I=null)}function N(g){const f=g.target;if(b||(b=B(f)),!b){D();return}const S=b.getBoundingClientRect(),p=g.clientY,_=p-S.top,U=S.bottom-p;_<T&&b.scrollTop>0?x(b,"up"):U<T&&b.scrollTop<b.scrollHeight-b.clientHeight?x(b,"down"):D()}function w(g,f){const S=g-V,p=f-C;y.style.left=parseInt(y.style.left)+S+"px",y.style.top=parseInt(y.style.top)+p+"px",V=g,C=f}function M(g){const{left:f,top:S}=g.getBoundingClientRect(),p=g.cloneNode(!0);return p.className=p.className+" f-listview-drag-moving",p.style.cssText=`
position:absolute;
left:${f}px;
top:${document.documentElement.scrollTop?S+document.documentElement.scrollTop:S}px;
z-index: 999999;
pointer-events: none;
border-radius: 10px;
margin: 4px 2px;
display: flex;
align-items: center;
float: none;
text-align: initial;
width:${getComputedStyle(g).width};
height:${getComputedStyle(g).height};
`,p.children[0].style.cssText="padding: 0 0 0 14px",p.children[0].children[0].style.cssText=`
margin: 10px 0px 10px 14px;
overflow: hidden;text-overflow: ellipsis;white-space: nowrap;
`,p.children[1].style.cssText="flex:1 1 auto; width:100%",p.children[2].style.cssText="padding: 0 14px 0 0",p.children[2].children[0].style.cssText="display: initial",document.body.appendChild(p),p}function P(g,f,S){if(g.stopPropagation(),v(),f){if(y=M(g.target),g.dataTransfer){const p=new Image;p.src="",g.dataTransfer.setDragImage(p,0,0)}V=g.pageX,C=g.pageY,setTimeout(()=>{d.value=S,l.value=!0,f.moving=!0})}}function F(g,f){if(g.preventDefault(),d.value!==f&&d.value!==-1){const S=i.value[d.value],p=a.value[d.value];S&&p&&(i.value.splice(d.value,1),i.value.splice(f,0,S),a.value.splice(d.value,1),a.value.splice(f,0,p),a.value.forEach((_,U)=>{_.index=U,_.raw.__fv_index__=U}),d.value=f,w(g.pageX,g.pageY))}}function L(g){g.preventDefault(),g.dataTransfer&&(g.dataTransfer.dropEffect="move"),w(g.pageX,g.pageY),N(g)}function q(g,f){var p,_;D(),b=null,f&&(f.moving=!1,y&&(document.body.removeChild(y),y=null)),i.value.forEach((U,G)=>{U.__fv_index__=G}),a.value.forEach((U,G)=>{U.index=G,U.raw&&(U.raw.__fv_index__=G)}),l.value=!1,h();const S=((p=f.raw)==null?void 0:p.__fv_index__)??0;u.value=S,m.value=S,c.value=(_=f.raw)==null?void 0:_[o.value],e.emit("change",i.value),e.emit("activeChange",[f.raw])}return{dragstart:P,dragenter:F,dragover:L,dragend:q,isDragging:l}}function Ce(r,e,n,s,a,o){var q,g;const i=t.ref(r.idField),d=t.ref(r.disableField),l=t.ref(r.draggable);t.ref(r.itemClass);const m=t.ref(((q=r.selection)==null?void 0:q.multiSelect)??!1),c=t.ref(((g=r.selection)==null?void 0:g.multiSelectMode)||"DependOnCheck"),{isDragging:u}=s,{activeIndex:h,focusedItemId:v,hoverIndex:y}=a,{clearSelection:V,getSelectedItems:C,toggleSelectItem:b,currentSelectedDataId:I,multiSelectOnlyOnCheck:E}=o,T=t.ref(C()),B=f=>T.value.length===0?!1:T.value.some(S=>{let p="";return S.data?p=S.data[i.value]:p=S[i.value],p===f});function x(){T.value=C()}function D(f,S){return f.raw[i.value]!=null?f.raw[i.value]+"_"+S:""}function N(f,S){const p={"f-list-view-group-item":!0,"f-list-view-draggable-item":l.value,"f-un-click":!f.checked,"f-un-select":!!f.raw[d.value],"f-listview-active":m.value&&B(D(f,S))&&r.showActiveWhenMultiSelect||!m.value&&f.raw[i.value]===I.value||m.value&&!r.showActiveWhenMultiSelect&&f.raw[i.value]===I.value,"f-listview-hover":!u.value&&S===y.value,moving:!!f.moving};if(typeof r.itemClass=="string")return $.getCustomClass(p,r.itemClass);if(typeof r.itemClass=="function"){const _=r.itemClass(f);return $.getCustomClass(p,_)}return p}function w(f,S){const p={};if(typeof r.itemStyle=="string")return $.getCustomStyle(p,r.itemStyle);if(typeof r.itemStyle=="function"){const _=r.itemStyle(f);return $.getCustomStyle(p,_)}return p}const M=t.computed(()=>!m.value);function P(f,S,p){f.checked=p,!f.raw[d.value]&&(M.value&&(v.value=f.raw[i.value]),b(f))}const F=t.computed(()=>!m.value||m.value&&c.value==="OnCheckAndClick");function L(f,S,p){if(f.raw[d.value]){p==null||p.preventDefault(),p==null||p.stopPropagation();return}I.value=f.raw[i.value],v.value=f.raw[i.value],h.value=S,F.value&&(b(f),x()),e.emit("clickItem",{data:T.value,index:S,dataItem:f.raw}),e.emit("activeChange",T.value)}return{getKey:D,selectedItems:T,listViewItemClass:N,listViewItemStyle:w,updateSelectedItems:x,onCheckItem:P,onClickItem:L}}const Y=new Map([["appearance",H.resolveAppearance]]),be="root-viewmodel";function Ve(r,e){const{formSchemaUtils:n,designViewModelUtils:s}=e;function a(c){return{id:`${c.componentId}-component-viewmodel`,code:`${c.componentId}-component-viewmodel`,name:c.componentName,bindTo:c.bindTo,parent:be,fields:[],commands:[],states:[],enableValidation:!0}}function o(c){const u=r.getSchemaByType("component-ref");return Object.assign(u,{id:`${c.componentId}-component-ref`,component:`${c.componentId}-component`}),u}function i(c,u,h){var C,b,I,E;const v=(b=(C=u==null?void 0:u.parentComponentInstance)==null?void 0:C.schema)==null?void 0:b.type,y=(E=(I=n.getFormSchema())==null?void 0:I.module)==null?void 0:E.templateId;if(["double-list-template","tree-list-template","list-template"].includes(y))return c;const V=[A.DgControl["content-container"].type,A.DgControl["response-layout-item"].type,A.DgControl["splitter-pane"].type,A.DgControl.drawer.type];if(v&&V.includes(v)){const T=r.getSchemaByType("section",{parentComponentInstance:u.parentComponentInstance,mainTitle:u.componentName},e);if(T&&T.contents&&T.contents.length){const B=T.contents[0];return B.contents=[c],T}}return c}function d(c){var y,V,C;const u=r.getSchemaByType("list-view");let h=!1;const v=(C=(V=(y=c.parentComponentInstance)==null?void 0:y.schema)==null?void 0:V.appearance)==null?void 0:C.class;return v&&v.includes("f-page-main")&&(h=!0),Object.assign(u,{id:c.componentId+"-listView",appearance:{class:h?"":"f-grid-is-sub"},type:"list-view",dataSource:c.dataSource||"",columns:[{field:"name",title:"",dataType:"string"}],pagination:{enable:!1}}),[u]}function l(c){var V,C,b;const u=r.getSchemaByType("component"),h=d(c);let v=!1;const y=(b=(C=(V=c.parentComponentInstance)==null?void 0:V.schema)==null?void 0:C.appearance)==null?void 0:b.class;return y&&y.includes("f-page-main")&&(v=!0),Object.assign(u,{id:`${c.componentId}-component`,viewModel:`${c.componentId}-component-viewmodel`,componentType:c.componentType,contents:h,appearance:{class:v?"f-struct-wrapper f-utils-fill-flex-column":""}}),u}function m(c){const u=o(c),h=l(c),v=a(c),y=n.getFormSchema();return y.module.viewmodels.push(v),y.module.components.push(h),s.assembleDesignViewModel(),i(u,c)}return{createComponent:m}}function K(r,e,n,s){var o,i,d,l,m,c;const a=n.parentComponentInstance;if(a&&s){const u=Math.random().toString(36).slice(2,6),h={componentId:`list-view-${u}`,componentName:((o=n.bindingSourceContext)==null?void 0:o.entityTitle)||((d=(i=n.bindingSourceContext)==null?void 0:i.bindingEntity)==null?void 0:d.name)||`列表-${u}`,componentType:"list-view",parentContainerId:a.schema.id,parentComponentInstance:a,bindTo:((l=n.bindingSourceContext)==null?void 0:l.bindTo)||"",dataSource:(c=(m=n.bindingSourceContext)==null?void 0:m.bindingEntity)==null?void 0:c.label},{createComponent:v}=Ve(r,s);return v(h)}else return e}const se={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/list-view.schema.json",title:"list-view",description:"A Farris Component",type:"object",properties:{id:{description:"The unique identifier for list-view",type:"string"},type:{description:"The type string of list-view",type:"string",default:"list-view"},dataSource:{description:"",type:"string",default:""},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},itemClass:{description:"",type:"string",default:""},itemStyle:{description:"",type:"string",default:""},contentTemplate:{description:"",type:"string",default:""},footerTemplate:{description:"",type:"string",default:""},emptyTemplate:{description:"",type:"string",default:""},pagination:{type:"object",properties:{enable:{description:"",type:"boolean",default:!1},disablePagination:{description:"",type:"string",default:""},contentTemplate:{description:"",type:"string",default:""},index:{description:"",type:"number",default:1},mode:{description:"",type:"enum",default:"server",enum:["server","client"]},showGoto:{description:"",type:"boolean",default:!1},showIndex:{description:"",type:"boolean",default:!0},showLimits:{description:"",type:"boolean",default:!1},showPageInfo:{description:"",type:"boolean",default:!0},size:{description:"",type:"number",default:20},sizeLimits:{description:"",type:"array",default:[10,20,30,50,100]},onPageChange:{description:"",type:"string",default:""},onPageSizeChange:{description:"",type:"string",default:""}}}},required:["id","type"],events:{onClickItem:"行点击事件"}},X=$.excludeProperties(O.listViewProps,"headerTemplate"),Ie=H.createPropsResolver(X,se,Y,K),Q=H.getPropsResolverGenerator(X,se,Y,K),Z={"tab-page":{type:"tab-page"},section:{type:"section"},"list-view":{name:"列表"}};function Se(r){const{formSchemaUtils:e,formStateMachineUtils:n}=r;function s(l,m=""){return{path:m+l.code,field:l.id,fullPath:l.code}}function a(l,m=""){const c=e.getViewModelById(l);return c?c.states.map(u=>s(u,m)):[]}function o(l){const m=e.getRootViewModelId(),c=a(l);if(l===m)return c;const u=a(m,"root-component.");return[...c,...u]}function i(l){return l.binding&&l.binding.path||l.id||""}function d(){return n&&n.getRenderStates()||[]}return{getVariables:o,getControlName:i,getStateMachines:d}}class Ne{constructor(e){R(this,"sessionVariables",[{key:"CurrentSysOrgName",name:"当前组织Name",description:"当前组织Name"},{key:"CurrentSysOrgId",name:"当前组织Id",description:"当前组织Id"},{key:"CurrentUserName",name:"当前用户Name",description:"当前用户Name"},{key:"CurrentUserCode",name:"当前用户Code",description:"当前用户Code"},{key:"CurrentUserId",name:"当前用户Id",description:"当前用户Id"},{key:"CurrentLanguage",name:"当前语言编号",description:"当前登录的语言编号,例如简体中文返回'zh-CHS',英文返回'en',繁体中文'zh-CHT'"}]);R(this,"expressionNames",{compute:"计算表达式",dependency:"依赖表达式",validate:"验证表达式",dataPicking:"帮助前表达式",visible:"可见表达式",readonly:"只读表达式",required:"必填表达式"});R(this,"getExpressionConverter",(e,n)=>({convertFrom:(s,a,o,i)=>{const d=o.getExpressionRuleValue(e,n||a);return d&&d.value||""},convertTo:(s,a,o,i,d)=>{var l;if(a==="dataPicking"&&(o!=null&&o.target)){const m=`${o.target}_dataPicking`;((l=o.rules)==null?void 0:l.some(u=>u.id===m&&u.value))?s.dictPickingExpressionId=m:delete s.dictPickingExpressionId}i.updateExpression(o)}}));this.formSchemaService=e}getExpressionRule(e,n){const s=this.getExpressionData();if(!s)return"";const a=s.find(i=>i.target===e);if(!a)return"";const o=a.rules.find(i=>i.type===n);return o||""}getContextFormVariables(){const{module:e}=this.formSchemaService.getFormSchema();if(!e.viewmodels||e.viewmodels.length===0)return[];const n=this.formSchemaService.getRootViewModelId(),s=this.formSchemaService.getViewModelById(n);if(!s||!s.states||s.states.length===0)return[];const a=[];return s.states.filter(o=>o.category==="remote").forEach(o=>{a.push({key:o.code,name:o.name,description:o.name,category:o.category})}),a}createTreeNode(e,n,s="label"){return{id:e.id,name:e.name,bindingPath:e[s],parents:n,type:"field"}}buildEntityFieldsTreeData(e=null,n){const s=[];return e==null||e.forEach(a=>{var d;const o=this.createTreeNode(a,n);let i=[];(d=a.type)!=null&&d.fields&&(i=this.buildEntityFieldsTreeData(a.type.fields,[...n,a.label])),s.push({data:o,children:i,expanded:!0})}),s}buildChildEntityTreeData(e=null,n){const s=[];return e==null||e.forEach(a=>{var l,m;const o=this.createTreeNode(a,n);o.type="entity";const i=this.buildEntityFieldsTreeData((l=a.type)==null?void 0:l.fields,[...n,a.label]),d=this.buildChildEntityTreeData((m=a.type)==null?void 0:m.entities,[...n,a.label]);d!=null&&d.length&&(i==null||i.push(...d)),s.push({data:o,children:i||[],expanded:!0})}),s}getEntitiesTreeData(){const e=this.formSchemaService.getSchemaEntities();if(!(e!=null&&e.length))return[];const n=e[0];if(!(n!=null&&n.type))return[];const s=this.buildEntityFieldsTreeData(n.type.fields,[n.code]),a=this.buildChildEntityTreeData(n.type.entities,[n.code]);return a!=null&&a.length&&(s==null||s.push(...a)),{entityCode:n.code,fields:[{data:this.createTreeNode(n,[],"code"),children:s||[]}]}}getEntitiesAndVariables(){return{entities:this.getEntitiesTreeData(),variables:{session:{name:"系统变量",items:this.sessionVariables,visible:!1},forms:{name:"表单变量",items:this.getContextFormVariables(),visible:!0}}}}onBeforeOpenExpression(e,n,s){const a=s==="Field"?e.binding.field:e.id,o=this.getExpressionRule(a,n),i=this.getEntitiesAndVariables(),d={message:["validate","required","dataPicking"].includes(n)&&o?o.message:"",...i};return o.messageType!=null&&(d.messageType=o.messageType),d}buildRule(e,n,s,a){const{expression:o,message:i,messageType:d}=n,l={id:`${e}_${s}`,type:s,value:o};return(s==="validate"||s==="dataPicking"||s==="required")&&(l.message=i),s==="dataPicking"&&(l.messageType=d),s==="validate"&&a&&(l.elementId=a),l}getExpressionData(){const{expressions:e}=this.formSchemaService.getFormSchema().module;return e||[]}updateExpression(e,n,s,a){const o=n==="Field"?e.binding.field:e.id,i=this.buildRule(o,s,a,e.type==="form-group"?e.id:"");let l=this.getExpressionData().find(c=>c.targetType===n&&c.target===o);const m=c=>c.value.trim()==="";if(l){const c=l.rules.find(u=>u.id===i.id);if(c)m(i)?l.rules=l.rules.filter(u=>u.id!==i.id):(Object.assign(c,i),a==="validate"&&e.type==="form-group"&&(c.elementId=e.id));else{if(m(i))return null;l.rules=l.rules||[],l.rules.push(i)}}else{if(m(i))return null;l={target:`${o}`,rules:[i],targetType:n}}return l}getExpressionEditorOptions(e,n,s,a){return s.reduce((o,i)=>{var l,m;const d=n==="Field"?(l=e==null?void 0:e.binding)==null?void 0:l.field:e.id;return o[i]={hide:n==="Field"?!!((m=e==null?void 0:e.binding)!=null&&m.field):!1,description:"",title:this.expressionNames[i],type:"string",$converter:this.getExpressionConverter(d),refreshPanelAfterChanged:!0,editor:{type:"expression-editor",singleExpand:!1,dialogTitle:`${this.expressionNames[i]}编辑器`,showMessage:i==="validate"||i==="dataPicking"||i==="required",showMessageType:i==="dataPicking",beforeOpen:()=>this.onBeforeOpenExpression(e,i,n),onSubmitModal:c=>{const u=this.updateExpression(e,n,c,i);if(a){const h=this.buildRule(d,c,i);a(h)}return u}}},o},{})}getExpressionInfo(e,n,s){const a=n==="Field"?e.binding.field:e.id,o=this.getExpressionRule(a,s),i={value:o&&o.value,targetId:a,targetType:n,expressionType:s};return o&&o.message&&(i.message=o.message),i}getExpressionConfig(e,n,s=["compute","dependency","validate"],a){var o;return{description:"表达式",title:"表达式",hide:!(e.binding&&((o=e.binding)==null?void 0:o.type)==="Form"),properties:{...this.getExpressionEditorOptions(e,n,s,a)}}}getExpressionOptions(e,n,s){const a=this.getExpressionInfo(e,n,s);return{dialogTitle:`${this.expressionNames[s]||"表达式"}编辑器`,singleExpand:!1,showMessage:s==="required",beforeOpen:()=>this.onBeforeOpenExpression(e,s,n),expressionInfo:a}}}class xe{constructor(e,n){R(this,"componentId");R(this,"viewModelId");R(this,"eventsEditorUtils");R(this,"formSchemaUtils");R(this,"formMetadataConverter");R(this,"designViewModelUtils");R(this,"designViewModelField");R(this,"controlCreatorUtils");R(this,"designerHostService");R(this,"designerContext");R(this,"modalService",null);R(this,"formRule",null);R(this,"schemaService",null);R(this,"metadataService",null);R(this,"propertyConfig",{type:"object",categories:{}});R(this,"expressionProperty");var s;this.componentId=e,this.designerHostService=n,this.eventsEditorUtils=n.eventsEditorUtils,this.formSchemaUtils=n.formSchemaUtils,this.formMetadataConverter=n.formMetadataConverter,this.viewModelId=((s=this.formSchemaUtils)==null?void 0:s.getViewModelIdByComponentId(e))||"",this.designViewModelUtils=n.designViewModelUtils,this.controlCreatorUtils=n.controlCreatorUtils,this.metadataService=n.metadataService,this.schemaService=n.schemaService,this.designerContext=n.designerContext,this.modalService=n.modalService,this.expressionProperty=new Ne(this.formSchemaUtils)}inResponsiveForm(){var e;return!!((e=this.designerContext)!=null&&e.responsiveForm)}getFormDesignerInstance(){var e,n;return(n=(e=this.designerContext)==null?void 0:e.instances)==null?void 0:n.formDesigner.value}getTableInfo(){var e;return(e=this.schemaService)==null?void 0:e.getTableInfoByViewModelId(this.viewModelId)}setDesignViewModelField(e){var s;const n=e.binding&&e.binding.type==="Form"&&e.binding.field;if(n){if(!this.designViewModelField){const a=this.designViewModelUtils.getDgViewModel(this.viewModelId);this.designViewModelField=a.fields.find(o=>o.id===n)}e.updateOn=(s=this.designViewModelField)==null?void 0:s.updateOn}}getBasicPropConfig(e){return{description:"Basic Information",title:"基本信息",properties:{id:{description:"组件标识",title:"标识",type:"string",readonly:!0},type:{description:"组件类型",title:"控件类型",type:"select",editor:{type:"combo-list",textField:"name",valueField:"value",idField:"value",editable:!1,data:[{value:e.type,name:A.DgControl[e.type]&&A.DgControl[e.type].name}]}}}}}getAppearanceConfig(e=null,n={},s){const a={title:"外观",description:"Appearance"},o={class:{title:"class样式",type:"string",description:"组件的CSS样式",$converter:"/converter/appearance.converter",parentPropertyID:"appearance"},style:{title:"style样式",type:"string",description:"组件的样式",$converter:"/converter/appearance.converter",parentPropertyID:"appearance"}};for(const i in n)o[i]=Object.assign(o[i]||{},n[i]);return{...a,properties:{...o},setPropertyRelates(i,d){if(i){switch(i&&i.propertyID){case"class":case"style":{A.canvasChanged.value++;break}}s&&s(i,e,d)}}}}getPropertyEditorParams(e,n=[],s="visible",a={},o={},i=""){const{getVariables:d,getControlName:l,getStateMachines:m}=Se(this.designerHostService),c=this.getRealTargetType(e),u=n&&n.length>0?n:["Const","Variable","StateMachine","Expression"],h={type:"property-editor",propertyTypes:u};return u.map(v=>{switch(v){case"Const":Object.assign(h,{constType:"enum",constEnums:[{id:!0,name:"是"},{id:!1,name:"否"}]},a);break;case"Expression":h.expressionConfig=this.getExpressionOptions(e,c,i||s);break;case"StateMachine":h.stateMachines=m();break;case"Variable":Object.assign(h,{controlName:l(e),newVariablePrefix:"is",newVariableType:"Boolean",variables:d(this.viewModelId),parentComponentId:this.componentId==="root-component"?"":"root-component",onBeforeOpenVariables:y=>{y.value=d(this.viewModelId)}},o),this.designerContext.designerMode==="PC_RTC"&&(h.newVariablePrefix="ext_"+h.newVariablePrefix);break}}),h}getVisibleProperty(e,n=""){var o;let s=["Const","Variable","StateMachine","Expression"];return n==="gridFieldEditor"?s=["Const","Expression"]:n==="form-group"&&!((o=e.binding)!=null&&o.field)?s=["Const","Variable","StateMachine","Custom"]:n==="dataGrid"||n==="treeGrid"||n==="wizard"?s=["Const","Variable","Expression"]:(e.type.indexOf("toolbar-item")>-1||n==="form-group")&&(s=["Const","Variable","StateMachine","Custom","Expression"]),{visible:{title:"是否可见",type:"boolean",description:"运行时组件是否可见",editor:this.getPropertyEditorParams(e,s,"visible")}}}getBehaviorConfig(e,n="",s={},a){const o={title:"行为",description:""},i=this.getVisibleProperty(e,n);for(const l in s)i[l]=Object.assign(i[l]||{},s[l]);const d=this;return{...o,properties:{...i},setPropertyRelates(l,m){if(l){switch(l.propertyID){case"disabled":case"readonly":case"visible":d.afterMutilEditorChanged(e,l);break}a&&a(l,m)}}}}afterMutilEditorChanged(e,n){this.addNewVariableToViewModel(n,this.viewModelId),this.updateExpressionValue(n,e),this.clearExpression(n,e)}updateElementByParentContainer(e,n){const s=n&&n.parent&&n.parent.schema;if(!s)return;const a=s.contents.findIndex(i=>i.id===e),o=de.cloneDeep(s.contents[a]);s.contents.splice(a,1),s.contents.splice(a,0,o),A.refreshCanvas()}addNewVariableToViewModel(e,n){const s=e.propertyValue;if(!(s&&typeof s=="object")||!(s.type==="Variable"&&s.isNewVariable))return;const i={id:s.field,category:"locale",code:s.fullPath,name:s.fullPath,type:s.newVariableType||"String",isRtcVariable:this.designerContext.designerMode==="PC_RTC"?!0:void 0};delete s.newVariableType,delete s.isNewVariable,this.formSchemaUtils.getVariableByCode(i.code)||this.formSchemaUtils.getViewModelById("root-viewmodel").states.push(i)}getExpressions(){let e=[];return this.formRule?(this.formRule.expressions=this.formRule.expressions||[],e=this.formRule.expressions||[]):e=this.formSchemaUtils.getExpressions(),e}updateExpressionValue(e,n){const s=e.propertyValue;if(!((s&&s.type)==="Expression"&&s.expressionInfo))return;const{expressionId:i,expressionInfo:d}=s,{targetId:l,targetType:m,expressionType:c,value:u,message:h}=d,v=this.getExpressions();let y=v.find(C=>C.target===l);y||(y={target:l,rules:[],targetType:m},v.push(y));const V=y.rules.find(C=>C.type===c);if(V)V.id=i,V.value=u,V.message=h,(c==="minDate"||c==="maxDate"||c==="defaultTime")&&(V.elementId=n.id);else{const C={id:i,type:c,value:u,message:h,elementId:n.id};y.rules.push(C)}delete s.expressionInfo}clearExpression(e,n){const s=e.propertyValue;if(s&&s.type==="Expression")return;const o=e.propertyID,i=this.getExpressions(),d=n.binding?n.binding.field:n.id,l=i.find(m=>m.target===d);!l||!l.rules||(l.rules=l.rules.filter(m=>m.type!==o))}getExpressionOptions(e,n,s){return this.expressionProperty.getExpressionOptions(e,n,s)}getRealTargetType(e){return["response-toolbar-item","tab-toolbar-item","section-toolbar-item","drawer-toolbar-item"].indexOf(e.type)>-1?"Button":e.binding&&e.binding.field?"Field":"Container"}createBaseEventProperty(e){const n={};return n[this.viewModelId]={type:"events-editor",editor:{initialData:e,viewSourceHandle:s=>{var a;((a=s.controller)==null?void 0:a.label.indexOf(this.formSchemaUtils.getModule().code))>-1&&this.eventsEditorUtils.jumpToMethod(s)}}},n}}class Me extends xe{constructor(e,n){super(e,n)}getPropertyConfig(e){return this.getBasicPropConfig(e),this.getAppearanceProperties(e),this.getEventPropConfig(e),this.propertyConfig}getBasicPropConfig(e){var i,d,l;const n=(l=(d=(i=this.formSchemaUtils.getFormSchema())==null?void 0:i.module)==null?void 0:d.entity[0])==null?void 0:l.entities[0],s=this.assembleSchemaEntityToTree(n,0),a=this,o=super.getBasicPropConfig(e);this.propertyConfig.categories.basic={description:"Basic Information",title:"基本信息",properties:{...o.properties,dataSource:{description:"绑定数据源",title:"绑定数据源",editor:{type:"combo-tree",textField:"name",valueField:"label",data:s,editable:!1},readonly:!0}},setPropertyRelates(m,c){switch(m&&m.propertyID){case"dataSource":{const u=a.formSchemaUtils.getViewModelById(a.viewModelId);if(u){const h=s.find(v=>v.label===m.propertyValue);u.bindTo=h.bindTo}a.designViewModelUtils.assembleDesignViewModel();break}}}}}assembleSchemaEntityToTree(e,n,s,a="",o=[]){if(!e)return o;const i=a?`${a}/${e.label}`:"/";return o.push({id:e.id,name:e.name,label:e.label,layer:n,parent:s&&s.id,bindTo:i.replace("//","/")}),e.type.entities&&e.type.entities.length&&e.type.entities.map(d=>this.assembleSchemaEntityToTree(d,n+1,e,i,o)),o}getAppearanceProperties(e){this.propertyConfig.categories.appearance={title:"外观",properties:{class:{title:"列表class样式",type:"string",description:"组件的CSS样式"},itemClass:{title:"行样式class",type:"string",description:"行样式class",editor:{type:"code-editor",language:"javascript",leftTemplate:()=>t.createVNode(t.Fragment,null,[t.createVNode("h5",null,[t.createTextVNode("示例代码")]),t.createVNode("pre",null,[`
(dataItem) => {
if(dataItem.code === '0001') {
return 'bg-danger text-center';
}
return '';
}
注:dataItem 行数据
函数返回值是一个字符串,
是由空格分隔的class组成 `])])}},itemStyle:{title:"行样式style",type:"string",description:"行样式style",editor:{type:"code-editor",language:"javascript",leftTemplate:()=>t.createVNode(t.Fragment,null,[t.createVNode("h5",null,[t.createTextVNode("示例代码")]),t.createVNode("pre",null,[`
(dataItem) => {
if(dataItem.code === '0001') {
return 'textAlign:center;color:green';
}
return '';
}
注:dataItem 行数据
函数返回值是一个字符串,
由分号分隔的css样式组成 `])])}},contentTemplate:{description:"内容模板",title:"内容模板",type:"string",refreshPanelAfterChanged:!0,editor:{type:"code-editor",language:"html"}},footerTemplate:{description:"底部模板",title:"底部模板",type:"string",refreshPanelAfterChanged:!0,editor:{type:"code-editor",language:"html"}},emptyTemplate:{description:"空数据模板",title:"空数据模板",type:"string",refreshPanelAfterChanged:!0,editor:{type:"code-editor",language:"html"}}},setPropertyRelates(n,s){switch(n&&n.propertyID){case"useBlankWhenDataIsEmpty":e.emptyDataHeight=e.useBlankWhenDataIsEmpty?36:240;break;case"columns":e.columns=n.propertyValue||[];break}}}}getEventPropConfig(e){var i;const n=[{label:"onClickItem",name:"行点击事件"}];(i=e.pagination)==null||i.enable;const s=this,a=s.eventsEditorUtils.formProperties(e,s.viewModelId,n),o=s.createBaseEventProperty(a);this.propertyConfig.categories.eventsEditor={title:"事件",hideTitle:!0,properties:o,refreshPanelAfterChanged:!0,tabId:$.EVENT_PROPERTY_TAB_IDS,tabName:"交互",setPropertyRelates(d,l){const m=d.propertyValue;delete e[s.viewModelId],m&&(m.setPropertyRelates=this.setPropertyRelates,s.eventsEditorUtils.saveRelatedParameters(e,s.viewModelId,m.events,m)),e.remoteSort=!!e.columnSorted,e.command&&(e.command.onClickEditCommand=e.onClickEditCommand,e.command.onClickDeleteCommand=e.onClickDeleteCommand)}}}isSubGrid(){const e=this.formSchemaUtils.getViewModelById(this.viewModelId);return e&&e.bindTo?e.bindTo.trim()!=="/":!1}}function Te(r,e){const n=r.schema,s=t.ref(!0),a=t.ref(!0);function o(u){return!1}function i(){return!1}function d(){return!1}function l(){return!0}function m(u){return new Me(u,e).getPropertyConfig(n)}function c(){var u,h,v,y;if(r&&e){const V=(u=r==null?void 0:r.componentInstance)==null?void 0:u.value.belongedComponentId;let C="",b="";const{formSchemaUtils:I}=e;if(V){const T=I.getRootViewModelId(),B=I.getComponentByViewModelId(T),x=I.selectNode(B,D=>D.contents&&D.contents.find(N=>N.component===V));(x==null?void 0:x.type)===((h=Z["tab-page"])==null?void 0:h.type)&&((v=x==null?void 0:x.contents)!=null&&v.length)&&(C=x.title||""),(x==null?void 0:x.type)===((y=Z.section)==null?void 0:y.type)&&(x==null?void 0:x.showHeader)!==!1&&(C=x.mainTitle||""),C=C?`${C} > `:"",b=C?x.id:""}const E=Z["list-view"].name;e==null||e.formSchemaUtils.getControlBasicInfoMap().set(r.schema.id,{componentTitle:E,parentPathName:`${C}${E}`,reliedComponentId:b})}}return{canAccepts:o,checkCanDeleteComponent:i,checkCanMoveComponent:d,hideNestedPaddingInDesginerView:l,triggerBelongedComponentToMoveWhenMoved:s,triggerBelongedComponentToDeleteWhenDeleted:a,getPropsConfig:m,setComponentBasicInfoMap:c}}const ie={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/list-view-table.schema.json",title:"list-view-table",description:"A Farris Component",type:"object",properties:{id:{description:"The unique identifier for list-view-table",type:"string"},type:{description:"The type string of list-view-table",type:"string",default:"list-view-table"},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"]},ke={title:"list-view-table",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:[]}}}}}},ee={data:{type:Array,default:[]}};H.createPropsResolver(ee,ie,Y,K,ke);const oe=H.getPropsResolverGenerator(ee,ie,Y,K),re=t.defineComponent({name:"FListViewTableDesign",props:ee,emits:["outputValue","currentEvent","selectionChanged"],setup(r,e){const n=[{name:"任芳",code:"1.山东大学",date:"2024-02-19",desc:"山东济南",amount:63.85,avatar:"./assets/avatar1.png"},{name:"戴秀兰",code:"2.山东建筑大学",date:"2024-03-17",desc:"山东济南",amount:60.13,avatar:"./assets/avatar2.png"},{name:"尹磊",code:"3.山东财经大学",date:"2024-04-09",desc:"山东济南",amount:36.54,avatar:"./assets/avatar3.png"},{name:"赵明",code:"4.北京大学",date:"2024-03-27",desc:"北京市",amount:52.76,avatar:"./assets/avatar4.png"},{name:"吕洋",code:"5.南京大学",date:"2024-11-17",desc:"江苏南京",amount:84.13,avatar:"./assets/avatar5.png"},{name:"吕娥",code:"6.清华大学",date:"2024-03-17",desc:"北京市",amount:52.76,avatar:"./assets/avatar6.png"},{name:"赵强",code:"7.浙江大学",date:"2024-08-01",desc:"浙江杭州",amount:84.13,avatar:"./assets/avatar7.png"}];t.computed(()=>r.data.length>0?r.data:n);const s=t.ref(),a=t.inject("design-item-context"),o=A.useDesignerComponent(s,a);return t.onMounted(()=>{s.value.componentInstance=o}),e.expose(o.value),()=>t.createVNode("div",{ref:s},[t.createVNode("div",{class:"ide-list-view h-100"},[t.createVNode("div",{class:"f-list-view"},[t.createVNode("div",{class:"f-list-view-content"},[t.createVNode("ul",{class:"f-list-view-group"},[t.createVNode("li",{class:"ide-list-view-group-item"},[t.createVNode("div",{class:"ide-list-content"},[t.createVNode("div",{class:"f-template-common-row d-flex"},[t.createVNode("div",{class:"item-action-primary"},[t.createVNode("img",{class:"ap-img",src:"./assets/avatar1.png",title:"img1"},null)]),t.createVNode("div",{class:"listview-item-content d-flex k-align-items-center"},[t.createVNode("div",{class:"listview-item-main"},[t.createVNode("h4",{class:"listview-item-title"},null),t.createVNode("h5",{class:"listview-item-subtitle"},null)]),t.createVNode("div",{class:"listview-item-btns"},[t.createVNode("button",{class:"btn btn-link"},[t.createTextVNode(" "),"编辑"]),t.createVNode("button",{class:"btn btn-link"},[t.createTextVNode(" "),"删除"])])])])])]),t.createVNode("li",{class:"ide-list-view-group-item"},[t.createVNode("div",{class:"ide-list-content"},[t.createVNode("div",{class:"f-template-common-row d-flex"},[t.createVNode("div",{class:"item-action-primary"},[t.createVNode("img",{class:"ap-img",src:"./assets/avatar2.png",title:"img2"},null)]),t.createVNode("div",{class:"listview-item-content d-flex k-align-items-center"},[t.createVNode("div",{class:"listview-item-main"},[t.createVNode("h4",{class:"listview-item-title"},null),t.createVNode("h5",{class:"listview-item-subtitle"},null)]),t.createVNode("div",{class:"listview-item-btns"},[t.createVNode("button",{class:"btn btn-link"},[t.createTextVNode(" "),"编辑"]),t.createVNode("button",{class:"btn btn-link"},["删除"])])])])])]),t.createVNode("li",{class:"ide-list-view-group-item"},[t.createVNode("div",{class:"ide-list-content"},[t.createVNode("div",{class:"f-template-common-row d-flex"},[t.createVNode("div",{class:"item-action-primary"},[t.createVNode("img",{class:"ap-img",src:"./assets/avatar3.png",title:"img3"},null)]),t.createVNode("div",{class:"listview-item-content d-flex k-align-items-center"},[t.createVNode("div",{class:"listview-item-main"},[t.createVNode("h4",{class:"listview-item-title"},null),t.createVNode("h5",{class:"listview-item-subtitle"},null)]),t.createVNode("div",{class:"listview-item-btns"},[t.createVNode("button",{class:"btn btn-link"},[t.createTextVNode(" "),"编辑"]),t.createVNode("button",{class:"btn btn-link"},["删除"])])])])])])])])])])])}}),W=t.defineComponent({name:"FListViewDesign",props:X,emits:["checkValuesChange","clickItem","selectionChange","removeItem","change"],setup(r,e){var le;const n=t.ref(((le=r.rowOption)==null?void 0:le.rowHeight)||28),s=t.ref(),a=t.ref(!0),o=t.ref(!1),i=t.ref([]),d=0,l=t.ref(r.columns),m=j.useFilter(r,e),c=j.useIdentify(r),u=j.useHierarchy(r),h=j.useGroupData(r,c),v=j.useDataView(r,new Map,m,u,c),y=j.useSelection(r,v,c,i,e),V=ue(r,s),C=t.ref(),b=t.inject("designer-host-service"),I=t.inject("design-item-context"),E=Te(I,b),T=A.useDesignerComponent(C,I,E),B=t.computed(()=>v.dataView.value.length),x=j.useRow(r,e,y,c),D=j.useEdit(r,e,c,x,i),N=j.useVisualDataBound(r,v,n),w=j.useVisualDataCell(r,{},N),M=j.useVisualDataRow(r,v,D,u,c,N,w,n),P=j.useVisualGroupRow(r,c,w,M),F=j.useVisualSummaryRow(r,c,w,M),L=j.useVisualData(r,l,v,B,d,M,P,F),{getVisualData:q}=L;i.value=q(0,B.value+d-1),t.onMounted(()=>{C.value.componentInstance=T}),e.expose(T.value);const g=t.computed(()=>{const z={"f-list-view":!0,"f-list-view-multiple":r.multiSelect,"w-100":!0,"h-100":!0};return r.size!=="default"&&(z[`${r.size}-item`]=!0),z}),f=t.computed(()=>!!e.slots.footer||a.value);function S(){return r.header==="SearchBar"?ne:r.header==="ContentHeader"?we:ne}const p=S(),{renderHeader:_}=p(r,e,V),U=ve(),G=ye(r,e,v,U,i),Pe=Ce(r,e,i,G,U,y);he(r,e,i,v,h,U,y,L,Pe,G);function Fe(z){r.multiSelect&&(z.preventDefault(),z.stopPropagation())}return()=>t.createVNode("div",{ref:C,class:g.value,onClick:Fe},[_(),t.createVNode("div",{ref:s,class:"f-list-view-content",onMouseover:()=>{o.value=!0},onMouseleave:()=>{o.value=!1}},[t.createVNode(re,null,null)]),f.value&&t.createVNode("div",{class:"f-list-view-footer"},[e.slots.footer&&e.slots.footer()])])}}),ae=H.createCollectionBindingResolver();W.register=(r,e,n,s,a)=>{r["list-view"]=O,e["list-view"]=Q(a),r["list-view-table"]=O.FListViewTable,e["list-view-table"]=oe(a),s["list-view"]={bindingResolver:ae}},W.registerDesigner=(r,e,n,s)=>{r["list-view"]=W,e["list-view"]=Q(s),r["list-view-table"]=re,e["list-view-table"]=oe(s)};const Ee=$.withInstall(W);k.FListViewDesign=W,k.bindingResolver=ae,k.default=Ee,k.listViewDesignProps=X,k.propsResolver=Ie,k.propsResolverGenerator=Q,Object.defineProperties(k,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});