@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
18 lines • 60 kB
JavaScript
(function(A,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("../dynamic-resolver/index.umd.js"),require("../common/index.umd.js"),require("../data-view/index.umd.js"),require("../locale/index.umd.js"),require("../checkbox/index.umd.js"),require("../button-edit/index.umd.js"),require("../list-view/index.umd.js"),require("lodash-es"),require("bignumber.js"),require("../../designer/button-edit/index.umd.js"),require("../property-panel/index.umd.js"),require("../designer-canvas/index.umd.js")):typeof define=="function"&&define.amd?define(["exports","vue","../dynamic-resolver/index.umd.js","../common/index.umd.js","../data-view/index.umd.js","../locale/index.umd.js","../checkbox/index.umd.js","../button-edit/index.umd.js","../list-view/index.umd.js","lodash-es","bignumber.js","../../designer/button-edit/index.umd.js","../property-panel/index.umd.js","../designer-canvas/index.umd.js"],t):(A=typeof globalThis<"u"?globalThis:A||self,t(A.order={},A.Vue,A.dynamicResolver,A.common,A.dataView,A.locale,A.checkbox,A.FButtonEdit,A.FListView$1,A.LodashES,A.BigNumber,A.FButtonEditDesign,A.propertyPanel,A.designerCanvas))})(this,function(A,t,D,R,L,Q,Z,pe,ve,be,wt,Ce,Se,ne){"use strict";const Fe=new Map([["appearance",D.resolveAppearance]]),we={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/order.schema.json",title:"order",description:"A Farris Component",type:"object",properties:{id:{description:"The unique identifier for a order",type:"string"},type:{description:"The type string of order component",type:"string",default:"order"},appearance:{description:"",type:"object",properties:{class:{type:"string"},style:{type:"string"}},default:{}},binding:{description:"",type:"object",default:{}},editable:{description:"",type:"boolean",default:!0},enableLinkLabel:{description:"",type:"boolean",default:!1},label:{description:"",type:"string",default:""},lableWidth:{description:"",type:"number"},placeholder:{description:"",type:"string",default:""},readonly:{description:"",type:"boolean",default:!1},required:{description:"",type:"boolean",default:!1},tabindex:{description:"",type:"number",default:-1},textAlign:{description:"",type:"string",enum:["left","middle","right"],default:"left"},visible:{description:"",type:"boolean",default:!0},onBlur:{description:"",type:"string",default:""},onClickLinkLabel:{description:"",type:"string",default:""}},required:["id","type"]};function Ve(e,n,r){return n}const Ie={title:"order",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:[]}}}},behavior:{description:"Basic Infomation",title:"行为",properties:{editable:{description:"",title:"允许编辑",type:"boolean"},readonly:{description:"",title:"只读",type:"string"},required:{description:"",title:"必填",type:"boolean"},visible:{description:"",title:"可见",type:"boolean"},placeholder:{description:"",title:"提示文本",type:"string"},tabindex:{description:"",title:"tab索引",type:"number"},textAlign:{description:"",title:"对齐方式",type:"enum",editor:{type:"combo-list",textField:"name",valueField:"value",data:[{value:"left",name:"左对齐"},{value:"center",name:"居中"},{value:"right",name:"右对齐"}]}}}}}},z={dataSource:{type:Array,default:[]},items:{type:Array,default:[]}},ee=D.createPropsResolver(z,we,Fe,Ve,Ie),xe={columns:{type:Array,default:[{field:"name",title:"",dataType:"string"}]},customClass:{type:String,default:""},data:{type:Array,default:[]},draggable:{type:Boolean,default:!1},multiSelect:{type:Boolean,default:!1},idField:{type:String,default:"id"},valueField:{type:String,default:"id"},textField:{type:String,default:"name"},titleField:{type:String,default:"name"},view:{type:String,default:"ContentView"},size:{type:String,default:"default"},placeholder:{type:String,default:""},header:{type:String,default:"ContentHeader"},headerClass:{type:String,default:""},itemClass:{type:[String,Function],default:"",validator:e=>typeof e=="string"||typeof e=="function"},itemStyle:{type:[String,Function],default:"",validator:e=>typeof e=="string"||typeof e=="function"},itemContentClass:{type:String,default:""},selectionValues:{type:Array,default:[]},group:{type:Object},selection:{type:Object,default:{enableSelectRow:!0,multiSelect:!1,multiSelectMode:"DependOnCheck",showCheckbox:!1,showSelectAll:!1,showSelection:!0}},keepOrder:{type:Boolean,default:!1},disableField:{type:String,default:"disabled"},enableHighlightSearch:{type:Boolean,default:!0},virtualized:{type:Boolean,default:!0},checkBeforeRemoveItem:{type:Function,default:null},headerTemplate:{type:Object},contentTemplate:{type:Object},footerTemplate:{type:Object},emptyTemplate:{type:Object},pagination:{type:Object,default:{enable:!1,size:20}},showActiveWhenMultiSelect:{type:Boolean,default:!0},allowDelete:{type:Boolean,default:!0}};function Te(e,n){function r(f){const a=[];let y=f.nextNode();for(;y;)a.push(y),y=f.nextNode();return a}function o(f,a){const y=document.createTreeWalker(f,NodeFilter.SHOW_TEXT);return r(y).map(h=>({textNode:h,text:(h.textContent||"").toLocaleLowerCase()})).map(({textNode:h,text:w})=>{const T=[];let p=0;for(;p<w.length;){const M=w.indexOf(a,p);if(M===-1)break;T.push(M),p=M+a.length}return T.map(M=>{const N=new Range;return N.setStart(h,M),N.setEnd(h,M+a.length),N})}).flat()}function u(f){if(!CSS.highlights||(CSS.highlights.clear(),!f||!n))return;const a=o(n.value,f.toLocaleLowerCase()),y=new Highlight(...a);CSS.highlights.set("search-result",y)}return{search:u}}function le(e,n,r,o,u,f,a,y,F,x){const b=t.ref(e.size),h=t.ref(e.textField),w=t.ref(e.titleField),T=t.ref(e.disableField),p=t.computed(()=>{var C,B;return((C=e.selection)==null?void 0:C.multiSelect)&&((B=e.selection)==null?void 0:B.showCheckbox)}),{onMouseenterItem:M,onMouseoverItem:N,onMouseoutItem:l}=f,{getKey:i,listViewItemClass:d,listViewItemStyle:c,onCheckItem:s,onClickItem:m}=a,I=t.computed(()=>{const C={"text-overflow":"ellipsis",overflow:"hidden","white-space":"nowrap"};return e.itemClass?C:{margin:b.value==="small"?"0.25rem 0":"8px 0",...C}});function k(C,B,P){return C.checked=y.findIndexInSelectedItems(C)>-1,t.createVNode("li",{class:d(C,B),id:i(C,B),key:i(C,B),style:c(C,B),onClick:$=>m(C,B,$),onMouseenter:$=>M($,C,B),onMouseover:$=>N($,C,B),onMouseout:$=>l($,C,B)},[p.value&&t.createVNode("div",{class:"f-list-select",onClick:$=>$.stopPropagation()},[t.createVNode(Z.FCheckbox,{id:"list-"+i(C,B),customClass:"listview-checkbox float-left",disabled:C[T.value],checked:C.checked,"onUpdate:checked":$=>C.checked=$,onChange:$=>{s(C,B,!$.checked)}},null)]),t.createVNode("div",{class:"f-list-content"},[t.createVNode("div",{class:e.itemContentClass,style:I.value,title:C.raw[w.value]||C.raw[h.value]},[C.raw[h.value]])])])}return{renderItem:k}}function ke(e,n,r,o,u,f,a,y,F,x){const b=t.ref(e.multiSelect),h=t.ref(e.disableField),w=t.ref(e.textField),{onMouseenterItem:T,onMouseoverItem:p,onMouseoutItem:M}=f,{getKey:N,listViewItemClass:l,listViewItemStyle:i,onCheckItem:d,onClickItem:c,updateSelectedItems:s}=a;function m(k,C,B){return e.contentTemplate?t.createVNode(t.Fragment,null,[e.contentTemplate({item:k.raw,index:C,selectedItem:B})]):n.slots.content?t.createVNode(t.Fragment,null,[n.slots.content&&n.slots.content({item:k.raw,index:C,selectedItem:B})]):t.createVNode("div",{style:"margin: 10px 0;"},[k.raw[w.value||"name"]])}function I(k,C,B){return t.createVNode("li",{class:l(k,C),id:N(k,C),key:N(k,C),style:i(k,C),onClick:P=>c(k,C,P),onMouseenter:P=>T(P,k,C),onMouseover:P=>p(P,k,C),onMouseout:P=>M(P,k,C)},[b.value&&t.createVNode("div",{class:"f-list-select",onClick:P=>P.stopPropagation()},[t.createVNode(Z.FCheckbox,{id:"list-"+N(k,C),customClass:"listview-checkbox",disabled:k[h.value],checked:k.checked,"onUpdate:checked":P=>k.checked=P,onChange:P=>{d(k,C,!P.checked),s()}},null)]),t.createVNode("div",{class:"f-list-content"},[m(k,C,B)])])}return{renderItem:I}}function Ne(e,n,r,o,u,f,a,y,F,x){const b=t.ref(e.multiSelect),h=t.ref(e.disableField),w=t.ref(e.textField),{onMouseenterItem:T,onMouseoverItem:p,onMouseoutItem:M}=f,{getKey:N,listViewItemClass:l,onCheckItem:i,onClickItem:d}=a,{dragstart:c,dragenter:s,dragover:m,dragend:I}=o,{removeItem:k}=F,C=t.computed(()=>({margin:b.value?"10px 0":"10px 0px 10px 14px"}));function B(V,v=""){const S=V.target;S.title=S.scrollWidth>S.clientWidth?v:""}function P(V){return t.createVNode("div",{style:C.value,onMouseenter:v=>B(v,V.raw[w.value||"name"])},[V.raw[w.value||"name"]])}function $(){return n.slots.itemContent?n.slots.itemContent:P}const _=$();function E(V,v,S){return t.createVNode("li",{class:l(V,v),id:N(V,v),key:N(V,v),onClick:g=>d(V,v,g),onMouseenter:g=>T(g,V,v),onMouseover:g=>p(g,V,v),onMouseout:g=>M(g,V,v),draggable:"true",onDragstart:g=>c(g,V,v),onDragenter:g=>s(g,v),onDragend:g=>I(g,V),onDragover:g=>m(g)},[b.value&&t.createVNode("div",{class:"f-list-select",onClick:g=>g.stopPropagation()},[t.createVNode(Z.FCheckbox,{id:"list-"+N(V,v),customClass:"listview-checkbox",disabled:V[h.value],checked:V.checked,"onUpdate:checked":g=>V.checked=g,onChange:g=>i(V,v,!g.checked)},null)]),t.createVNode("div",{class:"f-list-content"},[_(V)]),e.allowDelete&&t.createVNode("div",{class:"f-list-remove",onClick:g=>{g.stopPropagation(),k(v)}},[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:E}}function Me(e,n,r,o,u,f,a,y,F,x){var N;const b=t.ref(((N=e.group)==null?void 0:N.groupFields)||[]),{collpaseGroupIconClass:h}=u,{toggleGroupRow:w}=x;function T(l,i){l.stopPropagation(),i.collapse=!i.collapse,r.value=w(i.collapse?"collapse":"expand",i,r.value)}function p(l,i,d){return n.slots.group?t.createVNode(t.Fragment,null,[n.slots.content&&n.slots.group({item:l.raw,index:i,selectedItem:d})]):t.createVNode("div",{class:"f-navlookup-recentHeader",onClick:c=>T(c,l)},[t.createVNode("div",{class:"fv-grid-group-row-icon"},[t.createVNode("span",{class:h(l)},null)]),t.createVNode("div",{class:"f-navlookup-recommandLabel"},[l.raw[b.value[l.layer]]])])}function M(l,i,d){return l.layer>-1&&p(l,i,d)}return{renderItem:M}}function Be(e,n,r,o){const{dataView:u}=r,{updateSelectedItems:f}=o;function a(y){if(y>-1&&y<u.value.length){if(e!=null&&e.checkBeforeRemoveItem&&!e.checkBeforeRemoveItem(u.value[y]))return;const F=u.value.splice(y,1);f(),n.emit("removeItem",F[0])}}return{removeItem:a}}function Pe(e,n,r,o,u,f,a,y,F,x){const b=t.ref(e.view),h=t.ref(e.view==="CardView"),w=t.ref({}),T=Be(e,n,o,F),p=t.computed(()=>({"f-list-view-group":!0,"f-list-view-group-multiselect":e.multiSelect,"d-flex":h.value,"flex-wrap":h.value})),M=t.computed(()=>!!r.value&&r.value.length>0),N=t.computed(()=>r.value.length===0);t.computed(()=>N.value&&!n.slots.empty);function l(){return b.value==="SingleView"?le:b.value==="DraggableView"?Ne:(b.value==="ContentView"||b.value==="CardView")&&(e.contentTemplate||n.slots.content)?ke:le}const i=l(),{renderItem:d}=i(e,n,r,x,u,f,F,a,T,y),{renderItem:c}=Me(e,n,r,x,u,f,F,a,T,y),s=[d,c];function m(){return r.value.filter(C=>C.visible!==!1).map((C,B)=>s[C.type](C,B,w))}function I(){return t.createVNode("div",{class:"f-list-view-emptydata",style:"margin: 0 auto;"},[t.createVNode("p",{class:"f-empty-title"},[e.emptyTemplate?e.emptyTemplate():n.slots.empty?n.slots.empty():Q.LocaleService.getLocaleValue("listView.emptyMessage")])])}function k(){return t.createVNode("ul",{class:p.value,style:"list-style: none;"},[M.value&&m(),N.value&&I()])}return{renderListArea:k}}function Oe(e,n,r){function o(){return n.slots.header&&t.createVNode("div",{class:"f-list-view-header"},[n.slots.header()])}return{renderHeader:o}}function ie(e,n,r){const o=t.ref(e.headerClass),u=t.ref(e.placeholder),f=t.ref(""),a=t.computed(()=>!f.value),y=t.computed(()=>!!f.value);function F(w){f.value=""}t.watch(f,w=>{e.enableHighlightSearch&&r.search(w),n.emit("afterSearch",w)});const x=t.computed(()=>{const w={"form-group":!0,"farris-form-group":!0};return o.value&&o.value.split(" ").reduce((p,M)=>(p[M]=!0,p),w),w});function b(w){}function h(){return t.createVNode("div",{class:"f-list-view-header",onClick:t.withModifiers(()=>b,["prevent","stop"])},[t.createVNode("div",{class:x.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":w=>f.value=w,name:"input-group-value",type:"text",placeholder:u.value,autocomplete:"off"},null),[[t.vModelText,f.value]]),t.createVNode("div",{class:"input-group-append"},[y.value&&t.createVNode("span",{class:"input-group-text input-group-clear",onClick:w=>F()},[t.createVNode("i",{class:"f-icon f-icon-close-circle"},null)]),a.value&&t.createVNode("span",{class:"input-group-text"},[t.createVNode("span",{class:"f-icon f-icon-search"},null)])])])])])])])}return{renderHeader:h}}function He(){const e=t.ref(""),n=t.ref(-1),r=t.ref(""),o=t.ref(-1),u=t.ref(!1);function f(h,w,T){o.value=T}function a(h,w,T){u.value||(o.value=T)}function y(h,w,T){o.value=-1}function F(){u.value=!0}function x(){u.value=!1}function b(){n.value=-1,e.value=""}return{activeIndex:n,focusedItemId:r,hoverIndex:o,clearActiveItem:b,onMouseenterItem:f,onMouseoverItem:a,onMouseoutItem:y,resumeHover:x,suspendHover:F}}function $e(e,n,r,o,u){const f=t.ref(e.idField),{dataView:a}=r,y=t.ref(-1),F=t.ref(!1),{activeIndex:x,focusedItemId:b,hoverIndex:h,resumeHover:w,suspendHover:T}=o;let p,M=0,N=0,l=null,i=null;const d=10,c=50;function s(V){if(!V)return null;const{overflowY:v}=getComputedStyle(V);return v==="auto"||v==="scroll"?V:s(V.parentElement)}function m(V,v){i&&clearInterval(i),i=window.setInterval(()=>{v==="up"?V.scrollTop-=d:V.scrollTop+=d},16)}function I(){i&&(clearInterval(i),i=null)}function k(V){const v=V.target;if(l||(l=s(v)),!l){I();return}const S=l.getBoundingClientRect(),g=V.clientY,O=g-S.top,j=S.bottom-g;O<c&&l.scrollTop>0?m(l,"up"):j<c&&l.scrollTop<l.scrollHeight-l.clientHeight?m(l,"down"):I()}function C(V,v){const S=V-M,g=v-N;p.style.left=parseInt(p.style.left)+S+"px",p.style.top=parseInt(p.style.top)+g+"px",M=V,N=v}function B(V){const{left:v,top:S}=V.getBoundingClientRect(),g=V.cloneNode(!0);return g.className=g.className+" f-listview-drag-moving",g.style.cssText=`
position:absolute;
left:${v}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(V).width};
height:${getComputedStyle(V).height};
`,g.children[0].style.cssText="padding: 0 0 0 14px",g.children[0].children[0].style.cssText=`
margin: 10px 0px 10px 14px;
overflow: hidden;text-overflow: ellipsis;white-space: nowrap;
`,g.children[1].style.cssText="flex:1 1 auto; width:100%",g.children[2].style.cssText="padding: 0 14px 0 0",g.children[2].children[0].style.cssText="display: initial",document.body.appendChild(g),g}function P(V,v,S){if(V.stopPropagation(),T(),v){if(p=B(V.target),V.dataTransfer){const g=new Image;g.src="",V.dataTransfer.setDragImage(g,0,0)}M=V.pageX,N=V.pageY,setTimeout(()=>{y.value=S,F.value=!0,v.moving=!0})}}function $(V,v){if(V.preventDefault(),y.value!==v&&y.value!==-1){const S=a.value[y.value],g=u.value[y.value];S&&g&&(a.value.splice(y.value,1),a.value.splice(v,0,S),u.value.splice(y.value,1),u.value.splice(v,0,g),u.value.forEach((O,j)=>{O.index=j,O.raw.__fv_index__=j}),y.value=v,C(V.pageX,V.pageY))}}function _(V){V.preventDefault(),V.dataTransfer&&(V.dataTransfer.dropEffect="move"),C(V.pageX,V.pageY),k(V)}function E(V,v){var g,O;I(),l=null,v&&(v.moving=!1,p&&(document.body.removeChild(p),p=null)),a.value.forEach((j,q)=>{j.__fv_index__=q}),u.value.forEach((j,q)=>{j.index=q,j.raw&&(j.raw.__fv_index__=q)}),F.value=!1,w();const S=((g=v.raw)==null?void 0:g.__fv_index__)??0;h.value=S,x.value=S,b.value=(O=v.raw)==null?void 0:O[f.value],n.emit("change",a.value),n.emit("activeChange",[v.raw])}return{dragstart:P,dragenter:$,dragover:_,dragend:E,isDragging:F}}function Ae(e,n,r,o,u,f){var E,V;const a=t.ref(e.idField),y=t.ref(e.disableField),F=t.ref(e.draggable);t.ref(e.itemClass);const x=t.ref(((E=e.selection)==null?void 0:E.multiSelect)??!1),b=t.ref(((V=e.selection)==null?void 0:V.multiSelectMode)||"DependOnCheck"),{isDragging:h}=o,{activeIndex:w,focusedItemId:T,hoverIndex:p}=u,{clearSelection:M,getSelectedItems:N,toggleSelectItem:l,currentSelectedDataId:i,multiSelectOnlyOnCheck:d}=f,c=t.ref(N()),s=v=>c.value.length===0?!1:c.value.some(S=>{let g="";return S.data?g=S.data[a.value]:g=S[a.value],g===v});function m(){c.value=N()}function I(v,S){return v.raw[a.value]!=null?v.raw[a.value]+"_"+S:""}function k(v,S){const g={"f-list-view-group-item":!0,"f-list-view-draggable-item":F.value,"f-un-click":!v.checked,"f-un-select":!!v.raw[y.value],"f-listview-active":x.value&&s(I(v,S))&&e.showActiveWhenMultiSelect||!x.value&&v.raw[a.value]===i.value||x.value&&!e.showActiveWhenMultiSelect&&v.raw[a.value]===i.value,"f-listview-hover":!h.value&&S===p.value,moving:!!v.moving};if(typeof e.itemClass=="string")return R.getCustomClass(g,e.itemClass);if(typeof e.itemClass=="function"){const O=e.itemClass(v);return R.getCustomClass(g,O)}return g}function C(v,S){const g={};if(typeof e.itemStyle=="string")return R.getCustomStyle(g,e.itemStyle);if(typeof e.itemStyle=="function"){const O=e.itemStyle(v);return R.getCustomStyle(g,O)}return g}const B=t.computed(()=>!x.value);function P(v,S,g){v.checked=g,!v.raw[y.value]&&(B.value&&(T.value=v.raw[a.value]),l(v))}const $=t.computed(()=>!x.value||x.value&&b.value==="OnCheckAndClick");function _(v,S,g){if(v.raw[y.value]){g==null||g.preventDefault(),g==null||g.stopPropagation();return}i.value=v.raw[a.value],T.value=v.raw[a.value],w.value=S,$.value&&(l(v),m()),n.emit("clickItem",{data:c.value,index:S,dataItem:v.raw}),n.emit("activeChange",c.value)}return{getKey:I,selectedItems:c,listViewItemClass:k,listViewItemStyle:C,updateSelectedItems:m,onCheckItem:P,onClickItem:_}}const ae=t.defineComponent({name:"FListView",props:xe,emits:["afterSearch","checkValuesChange","clickItem","selectItem","unSelectItem","selectionChange","removeItem","change","activeChange","pageIndexChanged","pageSizeChanged","changed","selectionUpdate"],setup(e,n){var ye;const r=t.ref(!1),o=t.ref(),u=t.ref(!0),f=t.ref(((ye=e.rowOption)==null?void 0:ye.rowHeight)||28),a=t.ref(!1),y=t.ref([]),F=0,x=t.ref(e.columns),b=L.useFilter(e,n),h=L.useIdentify(e),w=L.useHierarchy(e),T=L.useGroupData(e,h),p=L.useDataView(e,new Map,b,w,h),M=L.useSelection(e,p,h,y,n),N=Te(e,o),l=L.usePagination(e,p),i=t.computed(()=>p.dataView.value.length),d=L.useRow(e,n,M,h),c=L.useEdit(e,n,h,d,y),s=L.useVisualDataBound(e,p,f),m=L.useVisualDataCell(e,{},s),I=L.useVisualDataRow(e,p,c,w,h,s,m,f),k=L.useVisualGroupRow(e,h,m,I),C=L.useVisualSummaryRow(e,h,m,I),B=L.useVisualData(e,x,p,i,F,I,k,C),{getVisualData:P}=B;y.value=P(0,i.value+F-1);const $=t.computed(()=>{const H={"f-list-view":!0,"f-list-view-multiple":e.multiSelect};return e.size!=="default"&&(H[`${e.size}-item`]=!0),R.getCustomClass(H,e.customClass)}),_=t.computed(()=>!!n.slots.footer||u.value);function E(){return e.header==="SearchBar"?ie:e.header==="ContentHeader"?Oe:ie}const V=E(),{renderHeader:v}=V(e,n,N),S=He(),g=$e(e,n,p,S,y),O=Ae(e,n,y,g,S,M),{renderListArea:j}=Pe(e,n,y,p,T,S,M,B,O,g);function q(H){N.search(H)}function dt(H){H&&(p.load(H),y.value=P(0,i.value+F-1))}function ct(){M.clearSelection(),S.clearActiveItem()}function ut(){return O.selectedItems.value}function ft(){return O.selectedItems.value.map(H=>H[h.idField.value])}function he(H){M.selectedValues.value=H,O.updateSelectedItems()}function mt(){return M.currentSelectedDataId.value}function gt(H){d.activeRowById(H)}function ht(H){const G=h.idField.value,U=y.value.find(te=>te.raw[G]===H),J=y.value.findIndex(te=>te.raw[G]===H);U&&J>-1&&O.onClickItem(U,J)}function yt(H){const G=h.idField.value,U=y.value.find(J=>J.raw[G]===H);U&&d.changeRow(U)}function pt(H){l.updatePagination(H)}function vt(H){return y.value.filter(G=>H.includes(G.raw[e.idField]))}n.expose({search:q,updateDataSource:dt,clearSelection:ct,getSelections:ut,updateSelectionByIds:he,getSelectionIds:ft,activeRowById:gt,getCurrentRowId:mt,clickRowItemById:ht,updatePagination:pt,getVisibleDataByIds:vt,selectRowById:yt}),t.watch(()=>e.selectionValues,(H,G)=>{H!==G&&he(H)});const bt=L.useSidebar(e,M),{sidebarWidth:Ct,showSidebarCheckBox:Qt}=bt,St=L.useColumn(e,n),{applyColumnSorter:Zt,columnContext:Ft,updateColumnRenderContext:en}=St;return L.useVirtualScroll(e,p,y,Ft,B,i,F,Ct,f,r,c),()=>t.createVNode("div",{class:$.value},[v(),t.createVNode("div",{ref:o,class:"f-list-view-content",onMouseover:()=>{a.value||(a.value=!0)},onMouseleave:()=>{a.value&&(a.value=!1)}},[j()]),_.value&&t.createVNode("div",{class:"f-list-view-footer"},[e.footerTemplate?e.footerTemplate():n.slots.footer&&n.slots.footer()])])}}),Re={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/component.schema.json",title:"button",description:"A Farris Visual Button",type:"object",properties:{id:{description:"The unique identifier for a component",type:"string"},type:{description:"The type string of component",type:"string",default:"button"},text:{description:"The text string of component",type:"string"},disabled:{description:"",type:"boolean",default:!1},appearance:{description:"",type:"object",properties:{class:{type:"string"},style:{type:"string"}},default:{}},visible:{description:"",type:"boolean",default:!0},size:{description:"大小",type:"string",default:"middle"},icon:{description:"图标",type:"string",default:""},onClick:{description:"点击事件",type:"string",default:""}},required:["id","type","text"],events:{onClick:"点击事件"}},Le=new Map([["appearance",D.resolveAppearance]]);function je(e,n,r){return Object.assign(n,{text:"按钮",appearance:{class:"btn btn-secondary"}}),n}const oe={id:String,type:{type:String,default:"primary"},disabled:{type:Boolean,default:!1},size:{type:String,default:"middle"},icon:{type:String,default:""},text:{type:String,default:""},customClass:{type:String,default:""},customStyle:{type:String,default:""},visible:{type:Boolean,default:!0}};D.createPropsResolver(oe,Re,Le,je);function Ee(e,n){function r(o){o.stopPropagation(),e.disabled||n.emit("click",o)}return{onClickButton:r}}function qe(e){const n=t.computed(()=>{const o={"f-icon":!0};if(e.icon){const u=e.icon.trim().split(" ");u&&u.length&&u.reduce((f,a)=>(f[a]=!0,f),o)}return o}),r=t.computed(()=>!!(e.icon&&e.icon.trim()));return{iconClass:n,shouldShowIcon:r}}const re=t.defineComponent({name:"FButton",props:oe,emits:["click"],setup(e,n){const{onClickButton:r}=Ee(e,n),{iconClass:o,shouldShowIcon:u}=qe(e),f=t.computed(()=>{const a={btn:!0,"btn-lg":e.size==="large","btn-md":e.size!=="large"&&e.size!=="small","btn-sm":e.size==="small","btn-icontext":u.value};return a[`btn-${e.type}`]=!0,e.customClass&&(typeof e.customClass=="string"?R.getCustomClass(a,e.customClass):Object.keys(e.customClass).reduce((y,F)=>(y[F]=e.customClass[F],y),a)),a});return()=>e.visible?t.createVNode("button",{class:f.value,disabled:e.disabled,style:e.customStyle,onClick:a=>r(a)},[u.value&&t.createVNode("i",{class:o.value},null),e.text?e.text:"",n.slots.default&&n.slots.default()]):null}}),se=new Map([["appearance",D.resolveAppearance]]),de={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/combo-list.schema.json",title:"combo-list",description:"A Farris Input Component",type:"object",properties:{id:{description:"The unique identifier for a combo list",type:"string"},type:{description:"The type string of number combo list component",type:"string",default:"combo-list"},appearance:{description:"",type:"object",properties:{class:{type:"string"},style:{type:"string"}},default:{}},binding:{description:"",type:"object",default:{}},disabled:{description:"",type:"boolean",default:!1},enableClear:{description:"",type:"boolean",default:!1},editable:{description:"",type:"boolean",default:!1},enableLinkLabel:{description:"",type:"boolean",default:!1},label:{description:"",type:"string",default:""},lableWidth:{description:"",type:"number"},placeholder:{description:"",type:"string",default:"请选择"},idField:{description:"",type:"string",default:"id"},valueField:{description:"",type:"string",default:"id"},titleField:{description:"",type:"string",default:"name"},textField:{description:"",type:"string",default:"name"},dataSourceType:{description:"",type:"string",default:"static"},data:{description:"",type:"array"},dataSource:{description:"",type:"string"},remote:{description:"",type:"string"},readonly:{description:"",type:"boolean",default:!1},required:{description:"",type:"boolean",default:!1},tabindex:{description:"",type:"number",default:-1},textAlign:{description:"",type:"string",enum:["left","middle","right"],default:"left"},multiSelect:{description:"",type:"boolean",default:!1},maxLength:{description:"",type:"number",default:null},visible:{description:"",type:"boolean",default:!0},onBlur:{description:"",type:"string",default:""},onClickLinkLabel:{description:"",type:"string",default:""},maxHeight:{description:"",type:"number",default:350},minPanelWidth:{description:"",type:"number",default:160},popupOnClick:{description:"",type:"boolean",default:!0},separator:{description:"",type:"string",default:","},viewType:{description:"",type:"string",default:"tag"},enableSearch:{description:"启用搜索",type:"boolean",default:!0},enableHighlightSearch:{description:"启用高亮搜索",type:"boolean",default:!1},beforeOpen:{description:"打开下拉面板前回调",type:"string"},beforeHide:{description:"关闭下拉面板前回调",type:"string"},onShown:{description:"面板打开事件",type:"string"},onHidden:{description:"面板关闭事件",type:"string"},onChange:{description:"值变化事件",type:"string",default:""},onInput:{description:"输入事件",type:"string",default:""},onClear:{description:"清空事件",type:"string",default:""},onDataChanged:{description:"清空事件",type:"string",default:""},hideDisabledItems:{description:"隐藏禁用项",type:"boolean",default:!1},expandable:{description:"",type:"boolean",default:!1},expandMode:{description:"",type:"string",default:"text"},expandContent:{description:"",type:"string",default:""},expandDisabled:{description:"",type:"boolean",default:!1},onExpandClick:{description:"",type:"string",default:""}},required:["type"],ignore:["id","appearance","binding","visible"],events:{onClear:"清空事件",onShown:"面板打开事件",onHidden:"面板关闭事件",onChange:"值变化事件",beforeOpen:"打开面板前事件",beforeHide:"关闭面板前事件"}};function ce(e,n,r){return n}function _e(){function e(n,r,o){const u={};return u.beforeOpen=f=>r.call("beforeOpen",n,[f,n],o),u}return{resolve:e}}const W={id:{type:String},data:{type:Array,default:[]},disabled:{default:!1,type:Boolean},dropDownIcon:{type:String,default:'<span class="f-icon f-icon-arrow-chevron-down"></span>'},editable:{default:!1,type:Boolean},enableClear:{default:!0,type:Boolean},enableSearch:{type:Boolean,default:!1},enableTitle:{default:!0,type:Boolean},fitEditor:{default:!1,type:Boolean},forcePlaceholder:{default:!1,type:Boolean},hidePanelOnClear:{default:!0,type:Boolean},idField:{default:"id",type:String},mapFields:{type:Object},maxHeight:{default:350,type:Number},maxLength:{type:Number},multiSelect:{type:Boolean,default:!1},modelValue:{type:String,default:""},placeholder:{type:String,default:"请选择"},placement:{type:String,default:"auto"},readonly:{default:!1,type:Boolean},remote:{default:null,type:Object},remoteSearch:{default:!1,type:Boolean},separator:{default:",",type:String},tabIndex:{type:Number,default:-1},textField:{default:"name",type:String},titleField:{default:"name",type:String},valueField:{default:"id",type:String},viewType:{default:"tag",type:String},change:{type:Function,default:()=>{}},focusOnCreated:{type:Boolean,default:!1},selectOnCreated:{type:Boolean,default:!1},autoHeight:{type:Boolean,default:!0},beforeOpen:{type:Function,default:null},load:{type:Function},searchOption:{type:[Boolean,Function],default:!1},enableHighlightSearch:{type:Boolean,default:!0},minPanelWidth:{type:Number,default:160},popupOnClick:{type:Boolean,default:!0},expandable:{type:Boolean,default:!1},expandMode:{type:String,default:"text"},expandContent:{type:String,default:""},expandDisabled:{type:Boolean,default:!1},popupClass:{type:String,default:""},hideDisabledItems:{type:Boolean,default:!1}},Ge=Object.assign({},W,{readonly:{}});D.createPropsResolver(W,de,se,ce);const ue=D.getPropsResolverGenerator(W,de,se,ce),De=_e(),Ue={dataSource:{type:Array,default:[]},enableSearch:{type:Boolean,default:!1},idField:{type:String,default:"id"},multiSelect:{type:Boolean,default:!1},selectedValues:{type:String,default:""},separator:{type:String,default:","},textField:{type:String,default:"name"},titleField:{type:String,default:"name"},width:{type:Number},maxHeight:{type:Number},valueField:{type:String,default:"id"},onSelectionChange:{type:Function,default:()=>{}},searchOption:{type:[Boolean,Function],default:!1},enableHighlightSearch:{type:Boolean,default:!0}},ze=t.defineComponent({name:"FComboListContainer",props:Ue,emits:["selectionChange"],setup(e,n){const r=t.ref(),o=t.ref(e.dataSource),u=t.ref(e.dataSource),f=t.ref([]),a=t.ref(e.separator),y=t.ref(e.width),F=t.ref(e.maxHeight),x=t.computed(()=>e.multiSelect),b=t.ref(e.multiSelect?String(e.selectedValues).split(a.value):[e.selectedValues]),h=t.computed(()=>({enableSelectRow:!0,multiSelect:e.multiSelect,multiSelectMode:"OnCheckAndClick",showCheckbox:x.value,showSelectAll:!1,showSelection:!0}));t.watch(e.dataSource,()=>{o.value=e.dataSource,u.value=e.dataSource}),t.computed(()=>e.enableSearch?"SearchBar":"ContentHeader");const w=t.computed(()=>{const l={};return y.value!==void 0&&(l.width=`${y.value}px`),F.value!==void 0&&F.value>0&&(l.maxHeight=`${F.value}px`),l});function T(l){r.value.search(l)}function p(l){f.value=l.map(i=>Object.assign({},i)),b.value=l.map(i=>i[e.idField]),n.emit("selectionChange",f.value)}function M(l){if(e.enableHighlightSearch)return;let i=[];const{searchOption:d}=e;typeof d=="function"?i=o.value.filter(c=>d(l,c)):i=o.value.filter(c=>c[e.valueField].indexOf(l)>-1||c[e.textField].indexOf(l)>-1),r.value.updateDataSource(i)}t.watch([()=>e.selectedValues],([l])=>{e.multiSelect?b.value=l.split(a.value):b.value=[l]});function N(l){r.value.activeRowById(l)}return t.onMounted(()=>{var l,i;if(!e.multiSelect){const d=(l=b.value)==null?void 0:l[0];let c=d;const s=o.value.map(m=>m[e.valueField||e.idField]);if(!be.isUndefined(d)&&s.includes(d)){const m=typeof d,I=typeof((i=o.value[0])==null?void 0:i[e.valueField||e.idField]);I==="number"&&m!==I&&(c=Number(d)),I==="boolean"&&m!==I&&(c=d==="true"?!0:d==="false"?!1:d),N(c)}}}),n.expose({search:T,activeRowById:N}),()=>t.createVNode("div",{class:"f-combo-list-container",style:w.value},[t.createVNode(ve,{ref:r,size:"small",itemClass:"f-combo-list-item",itemContentClass:"text-truncate",header:"ContentHeader",headerClass:"f-combo-list-search-box",data:o.value,idField:e.idField,textField:e.textField,titleField:e.titleField,multiSelect:e.multiSelect,selection:h.value,enableHighlightSearch:e.enableHighlightSearch,selectionValues:b.value,onSelectionUpdate:p,onAfterSearch:M},null)])}}),fe={property:"all",duration:.3,timingFunction:"cubic-bezier(0.17, 0.89, 0.45, 1)",delay:0},We=(e,n)=>{const r=e.lineHeight/2,o=R.useTouchMomentum({maxOverflowY:44}),u=t.reactive({...fe}),f=c=>{n.emit("change",c)},a=t.reactive({value:0,max:0,min:0,start:0,index:0,currentItem:void 0,active:!1}),y=()=>{a.max=e.visiableOptionCount/2*e.lineHeight;const c=e.column.length*e.lineHeight;a.min=a.max-c+e.lineHeight},F=(c=0)=>{y(),a.index=c,a.value=a.max-c*e.lineHeight,a.currentItem=e.column[c]},x=c=>{const s=e.column.length-1,m=Math.min(a.index,s),I=e.column.findIndex(k=>k[e.valueField]===c);return I>=0?I:m},b=c=>{const s=e.column.length-1;return a.index>s?e.column[s]:e.column[c]},h=c=>{c&&(a.currentItem=c,u.duration=0);const s=a.currentItem[e.valueField],m=x(s),I=b(a.index)[e.valueField];F(m),s!==I&&setTimeout(()=>{f(a.currentItem)},u.duration*1e3)},w=()=>{const c=Array.isArray(e.value)?e.value[0]:e.value;F(x(c))};w(),t.watch(()=>e.value,()=>{e.multiSelect||w()}),t.watch(()=>e.column,()=>h());const T=(c,s=a.max,m=a.min)=>{const I=a.start+c;a.value=I>r?Math.min(I,s):Math.max(I,m),a.index=Math.round((a.max-a.value)/e.lineHeight),a.currentItem=b(a.index)},p=R.useTouch(),M=c=>{p.start(c),a.active=!0,a.start=a.value,o.start(a.start),u.duration=0},N=c=>{c.preventDefault(),p.move(c),T(p.deltaY.value,a.max+e.lineHeight,a.min-e.lineHeight),o.move(p.deltaY.value),u.duration=fe.duration},l=c=>{const s=c<0,m=c%e.lineHeight>r?1:0,I=Math.floor(c/e.lineHeight);return(s?I-m:I+m)*e.lineHeight+r};return{translateY:a,transition:u,onTouchStart:M,onTouchMove:N,onTouchEnd:()=>{a.start=0;const c=o.end();let s=0;if(c){const{destination:m,duration:I}=o.get(a.value,a.min,a.max);s=m,u.duration=I/1e3}else s=a.value;T(l(s)),f(a.currentItem)},onTransitionend:()=>{a.active=!1},updateTranslate:h}},Ye={column:{type:Array,default:()=>[]},valueField:{type:String,default:"value"},textField:{type:String,default:"text"},value:{type:[Array,String,Number],default:()=>[]},multiSelect:{type:Boolean,default:!1},showIcon:{type:Boolean,default:!1},lineHeight:{type:Number,default:0},visiableOptionCount:{type:Number,default:5}},Ke=t.defineComponent({props:Ye,emits:["change","click"],setup(e,n){const{addUnit:r}=R.useCommonUtils(),{bem:o}=R.useBem("FComboTouchList"),{translateY:u,transition:f,onTouchStart:a,onTouchMove:y,onTouchEnd:F,onTransitionend:x}=We(e,n),b=T=>{n.emit("click",T)},h=t.computed(()=>({transform:`translateY(${r(u.value)})`,transition:`all ${u.active?f.duration:0}s ${f.timingFunction} 0s`})),w=T=>e.showIcon?Array.isArray(e.value)&&e.value.includes(T[e.valueField]):!1;return()=>t.createVNode("div",{class:o("column"),style:h.value,onTouchstart:a,onTouchmove:y,onTouchend:F,onTransitionend:x},[e.column.map(T=>t.createVNode("div",{class:o("column-item"),onClick:()=>b(T)},[t.createVNode("span",null,[T[e.textField]]),w(T)&&t.createVNode("span",{class:`f-icon f-icon-check ${o("column-item-icon")}`},null)]))])}}),Xe={modelValue:{type:[String,Array],default:""},columns:{type:Array,default:()=>[]},title:{type:String,default:""},valueField:{type:String,default:"value"},textField:{type:String,default:"text"},childrenField:{type:String,default:"children"},multiSelect:{type:Boolean,default:!1},lineHeight:{type:Number,default:44},cancelText:{type:String,default:"取消"},confirmText:{type:String,default:"确定"},optionFormatter:{type:Function,default:void 0},visiableOptionCount:{type:Number,default:5},showToolbar:{type:Boolean,default:!0},separator:{type:String,default:","}},Je=(e,n)=>{const{finalValue:r,initValue:o,setSelectedByIndex:u,getSelectedValueByIndex:f}=n,{isArray:a,isFunction:y,isObject:F}=R.useCommonUtils(),x=s=>s&&s[0],b=t.computed(()=>{var s;return((s=e.columns)==null?void 0:s.length)>0&&a(e.columns[0])}),h=s=>{if((s==null?void 0:s.length)===0)return!1;const m=x(s);return m&&a(m[e.childrenField])},w=(s,m)=>{const I=x(s),k=f(m);let C=s.find(P=>P[e.valueField]===k);C=C||I;const B=C[e.childrenField]||[];if(h(B)){const P=w(B,m+1);return[B,...P]}return[B]},T=()=>{const s=e.columns,m=w(s,0);return[s,...m]},p=(s,m)=>{const I=s[e.textField];return y(e.optionFormatter)?e.optionFormatter(m,s):I},M=(s,m)=>s.map(I=>{const k=F(I)?I:{[e.valueField]:I,[e.textField]:I};return k[e.textField]=p(k,m),k}),N=t.computed(()=>{let s=[];return b.value?s=e.columns:h(e.columns)?s=T():s=[e.columns],s.map(M)}),l=()=>N.value.map((s,m)=>{const I=r.value[m];return s.find(C=>C[e.valueField]===I)}).filter(s=>s),i=()=>l().map(s=>s[e.valueField]),d=()=>l().map(s=>s[e.textField]).join("-"),c=()=>{N.value.forEach((s,m)=>{if(e.multiSelect)r.value[m].forEach(k=>{const C=s.find(B=>B[e.valueField]===k);C&&u(m,C)});else{const I=r.value[m],k=s.find(C=>C[e.valueField]===I);k?u(m,k):u(m,x(s))}})};return t.watch(()=>e.modelValue,()=>{o(e.modelValue),c()},{immediate:!0}),{columns:N,getPickeds:l,getValue:i,getTextValue:d}},Qe=e=>{const{isArray:n,isMultiArray:r,isString:o,isDef:u}=R.useCommonUtils(),f=l=>{let i=[];return n(l)?i=l:o(l)?i=l.split(e.separator):u(l)&&(i=[l]),e.multiSelect?r(i)?i:[i]:i},a=t.ref([]),y=l=>{a.value=f(l)},F=t.reactive([]),x=t.computed(()=>F.map(l=>l[e.valueField])),b=t.reactive([]),h=t.computed(()=>b.map(l=>l.map(i=>i[e.valueField])));return{finalValue:a,initValue:y,getSelected:()=>e.multiSelect?b:F,getSelectedValue:()=>e.multiSelect?h.value:x.value,setSelectedByIndex:(l,i)=>{if(e.multiSelect){const d=b[l]||[];d.includes(i)?b[l]=d.filter(c=>c!==i):b[l]=[...d,i]}else F[l]=i},getSelectedByIndex:l=>e.multiSelect?b[l]:F[l],getSelectedValueByIndex:l=>e.multiSelect?h.value[l]:x.value[l]}},Ze=t.defineComponent({props:Xe,emits:["change","confirm","cancel","update:modelValue"],setup(e,n){const{emit:r}=n,{addUnit:o}=R.useCommonUtils(),u=Qe(e),{finalValue:f,getSelectedValue:a,getSelectedValueByIndex:y,getSelected:F,setSelectedByIndex:x}=u,{columns:b}=Je(e,u),h=(d,c=!0)=>{const{value:s,index:m}=d;(c&&!e.multiSelect||!c&&e.multiSelect)&&(r("change",d),x(m,s))},w=()=>{f.value=a(),r("confirm",F()),r("update:modelValue",f.value)},T=()=>{r("cancel")},{bem:p}=R.useBem("FComboTouchList"),M=()=>t.createVNode("div",{class:p("toolbar")},[t.createVNode("div",{class:p("toolbar-left"),onClick:T},[t.createVNode("span",null,[e.cancelText])]),t.createVNode("div",{class:p("toolbar-title")},[t.createVNode("span",null,[e.title])]),t.createVNode("div",{class:p("toolbar-right"),onClick:w},[t.createVNode("span",null,[e.confirmText])])]),N=t.computed(()=>{const d=(e.visiableOptionCount+1)*e.lineHeight;return{height:o(d)}}),l=t.computed(()=>{const d=e.visiableOptionCount*e.lineHeight/2;return{backgroundSize:`100% ${o(d)}`}}),i=()=>t.createVNode("div",{class:p("content")},[t.createVNode("div",{class:p("columns"),style:N.value},[b.value.map((d,c)=>t.createVNode(Ke,{column:d,value:y(c),showIcon:e.multiSelect,textField:e.textField,multiSelect:e.multiSelect,valueField:e.valueField,lineHeight:e.lineHeight,visiableOptionCount:e.visiableOptionCount,onChange:s=>h({value:s,index:c}),onClick:s=>h({value:s,index:c},!1)},null)),!e.multiSelect&&t.createVNode("div",{class:p("mask"),style:l.value},null),t.createVNode("div",{class:p("frame")},null)])]);return()=>t.createVNode("div",{class:p("")},[e.showToolbar&&M(),i()])}});function et(e,n){const r=t.ref(""),o=t.ref(e.modelValue),u=t.ref(e.data||[]),f=t.ref(e.editable),a=t.computed(()=>e.hideDisabledItems?u.value.filter(l=>!l.disabled):u.value);function y(l){const i=e.multiSelect?String(l).split(e.separator):[String(l)],d=i.map(m=>[m,!0]),c=new Map(d);return u.value.filter(m=>c.has(String(m[e.valueField]))).sort((m,I)=>{const k=i.indexOf(m[e.valueField]),C=i.indexOf(I[e.valueField]);return k-C})}function F(l){const i=y(l).map(d=>d[e.textField]).join(e.separator);r.value=f.value?i||l:i}function x(l){if(e.multiSelect){const i=l.split(e.separator).map(c=>[c,!0]),d=new Map(i);return u.value.filter(c=>d.has(c[e.textField]))}return u.value.filter(i=>""+i[e.textField]===l)}function b(l){const i={};return i[e.idField]=l,i[e.textField]=l,[i]}function h(l){let i=x(l);const d=i&&i.length>0;return f.value&&!d&&(i=b(l)),i}function w(){const{url:l,method:i="GET",headers:d={"Content-Type":"application/json;charset=utf-8;"},body:c=null}=e.remote;if(!l)return;const{basePath:s}=R.useFarrisConfig().value,m=i.toLowerCase()==="get"?{method:i,headers:d}:{method:i,headers:d,body:c};let I=!1;fetch(new Request(s+l,m)).then(k=>{var B,P;if(k.status===200)return I=!!((P=(B=k.headers)==null?void 0:B.get("content-type"))!=null&&P.includes("application/json")),I?k.text():k.json();throw k.status===405?new Error(Q.LocaleService.getLocaleValue("comboList.remoteError")):new Error(k.statusText)}).then(k=>{k.length&&(u.value=I?JSON.parse(k):k,o.value&&F(o.value))}).catch(k=>{console.warn(k)})}e.remote&&(e.load?e.load().then(l=>{u.value=l}).catch(l=>{console.log(l)}):w()),t.watch(()=>e.data,()=>{u.value=e.data}),t.watch([u],([l],[i])=>{if(e.modelValue!=null&&!e.multiSelect){const d=l.find(c=>c[e.valueField]===o.value);d?d[e.valueField]!==o.value?(o.value=d[e.valueField],r.value=d[e.textField],n.emit("update:modelValue",d[e.valueField]),n.emit("change",[d],d[e.valueField])):r.value!==d[e.textField]&&(r.value=d[e.textField]):o.value!==""&&(o.value="",r.value="",n.emit("update:modelValue",""),n.emit("change",[],""))}}),t.watch(()=>e.modelValue,(l,i)=>{i!==l&&(o.value=l,F(l))});function T(l){u.value=l,n.emit("dataChanged",l)}function p(){return u.value}function M(){return r.value}async function N(){const l=typeof e.beforeOpen=="function";return!e.beforeOpen||!l?Promise.resolve(!0):Promise.resolve().then(()=>e.beforeOpen({instance:{updateDataSource:T,getData:p,getDisplayText:M}})).then(i=>typeof(i==null?void 0:i.canOpen)=="boolean"?i==null?void 0:i.canOpen:!0)}return F(e.modelValue),{dataSource:u,filteredDataSource:a,displayText:r,editable:f,modelValue:o,beforeOpenList:N,getItemsByDisplayText:x,getItemsByValue:y,getSelectedItemsByDisplayText:h}}const tt=["moz","ms","webkit"];function nt(){let e=0;return n=>{const r=new Date().getTime(),o=Math.max(0,16-(r-e)),u=setTimeout(()=>{n(r+o)},o);return e=r+o,u}}function lt(){if(typeof window>"u")return()=>0;if(window.requestAnimationFrame)return window.requestAnimationFrame.bind(window);const e=tt.filter(n=>`${n}RequestAnimationFrame`in window)[0];return e?window[`${e}RequestAnimationFrame`]:nt()}lt(),t.ref("");function me(){const e=navigator.userAgent||navigator.vendor||window.opera,n=[/iPhone/i,/iPod/i,/Android.*Mobile/i,/webOS/i,/BlackBerry/i,/IEMobile/i,/Opera Mini/i,/Harmony/i],r=[/iPad/i,/Android(?!.*Mobile)/i,/Tablet/i,/PlayBook/i,/Kindle/i,/Silk/i];for(const y of r)if(y.test(e))return!1;for(const y of n)if(y.test(e))return!0;const o="ontouchstart"in window||navigator.maxTouchPoints>0,u=screen.width,f=screen.height,a=Math.min(u,f);return!!(o&&a<=768)}const Y=t.defineComponent({name:"FComboList",props:W,emits:["clear","update:modelValue","change","input","dataChanged","expandClick"],setup(e,n){const r=t.ref(),o=t.ref(),u=t.ref(e.disabled||e.readonly),f=t.ref(e.enableClear),a=t.ref(e.enableSearch),y=t.ref(e.readonly),{dataSource:F,displayText:x,editable:b,modelValue:h,filteredDataSource:w,getItemsByDisplayText:T,getItemsByValue:p,beforeOpenList:M}=et(e,n),N=t.ref(e.dropDownIcon);N.value==='<span class="f-icon f-icon-arrow-chevron-down"></span>'&&(N.value='<span id="'+e.id+'-icon-dropdown" class="f-icon f-icon-arrow-chevron-down"></span>');const l=t.computed(()=>e.multiSelect),i=t.computed(()=>o.value?o.value.elementRef.getBoundingClientRect().width:0);function d(){!l.value&&o.value&&o.value.hidePopup()}function c(S){x.value=S.map(O=>O[e.textField]).join(e.separator)||h.value;let g="";S.length===1?g=S[0][e.valueField]:g=S.map(O=>O[e.valueField]).join(e.separator),h.value!==g&&(h.value=g,n.emit("update:modelValue",h.value),n.emit("change",S,h.value))}function s(){const S=p(h.value);c(S)}function m(){y.value||x.value}function I(S){var g;h.value="",(g=r.value)==null||g.activeRowById(""),n.emit("clear")}function k(S){var g,O;e.enableSearch&&e.enableHighlightSearch&&((g=r.value)==null||g.search(S)),(O=r.value)==null||O.activeRowById(S),n.emit("change",[h.value],h.value)}function C(S){if(e.multiSelect){const g=T(S);e.viewType;const j=g.map(q=>q[e.idField||e.valueField]).join(e.separator);h.value!==j&&(h.value=j,n.emit("update:modelValue",h.value),n.emit("change",g,h.value))}else S!==h.value&&(h.value=S,n.emit("update:modelValue",h.value),n.emit("change",[],S))}function B(){return x.value}function P(S){const{value:g}=S.target;k(g),n.emit("input",g)}function $(){o.value.hidePopup()}function _(S){F.value=S}function E(){return F.value}const V={getDisplayText:B,hidePopup:$,updateDataSource:_,getData:E};n.expose(V),t.watch([()=>e.disabled,()=>e.editable,()=>e.enableClear,()=>e.enableSearch,()=>e.readonly],([S,g,O,j,q])=>{u.value=S,b.value=g,f.value=O,a.value=j,y.value=q});const v=()=>{n.emit("expandClick")};return()=>t.createVNode(pe,{ref:o,id:e.id,disable:u.value,readonly:y.value,forcePlaceholder:e.forcePlaceholder,editable:b.value,buttonContent:N.value,placeholder:e.placeholder==="请选择"?Q.LocaleService.getLocaleValue("comboList.placeholder"):e.placeholder,enableClear:f.value,maxLength:e.maxLength,tabIndex:e.tabIndex,enableTitle:e.enableTitle,multiSelect:e.multiSelect,inputType:e.multiSelect?e.viewType:"text",modelValue:x.value,"onUpdate:modelValue":S=>x.value=S,focusOnCreated:e.focusOnCreated,selectOnCreated:e.selectOnCreated,onClear:I,onClick:m,onChange:C,onBlur:s,onInput:P,beforeOpen:M,placement:me()?"bottom":e.placement,popupMinWidth:e.minPanelWidth,popupClass:"f-combo-list-wrapper",popupOnClick:e.popupOnClick,limitContentBySpace:!0,expandable:e.expandable,expandMode:e.expandMode,expandContent:e.expandContent,expandDisabled:e.expandDisabled,onExpandClick:v},{default:()=>[me()?t.createVNode(Ze,{modelValue:h.value,valueField:e.valueField,textField:e.textField,columns:F.value,multiSelect:e.multiSelect,separator:e.separator,onConfirm:S=>{const g=e.multiSelect?S[0]||[]:S;c(g),o==null||o.value.hidePopup()},onCancel:()=>{o==null||o.value.hidePopup()}},null):t.createVNode(ze,{class:e.popupClass,ref:r,idField:e.idField,valueField:e.valueField,textField:e.textField,titleField:e.titleField,dataSource:w.value,selectedValues:h.value,separator:e.separator,multiSelect:e.multiSelect,enableSearch:a.value,maxHeight:e.maxHeight,enableHighlightSearch:e.enableHighlightSearch,width:e.fitEditor?i.value:void 0,onSelectionChange:S=>{c(S),d()}},null)]})}}),ge={convertFrom:(e,n)=>(e.editor.remote||{})[n],convertTo:(e,n,r)=>{e.editor.remote=e.editor.remote||{},e.editor.remote[n]=r}};class it extends Se.InputBaseProperty{constructor(n,r){super(n,r)}getCommonEditorProperties(n){var r,o,u;return{viewType:{visible:!!((r=n.editor)!=null&&r.multiSelect),description:"数据展示类型,有标签和文本两种方式",title:"数据展示类型",type:"enum",editor:{data:[{id:"tag",name:"标签"},{id:"text",name:"文本"}]},refreshPanelAfterChanged:!0},separator:{visible:!!((o=n.editor)!=null&&o.multiSelect)&&((u=n.editor)==null?void 0:u.viewType)==="text",description:"下拉列表启用多选且数据展示类型为文本时的分隔符",title:"分隔符",type:"enum",editor:{data:[{id:",",name:"逗号(,)"},{id:"#",name:"井号(#)"},{id:".",name:"句号(.)"},{id:"|",name:"竖线(|)"}]}},editable:{description:"",title:"允许编辑",type:"boolean",refreshPanelAfterChanged:!0,readonly:!0},hideDisabledItems:{description:"当数据项禁用时,隐藏数据项",title:"隐藏禁用项",type:"boolean",refreshPanelAfterChanged:!0}}}getEditorProperties(n){var F,x,b,h,w,T,p,M,N,l,i,d,c;const r=this;let o="";if(((F=n==null?void 0:n.binding)==null?void 0:F.type)==="Form"){const s=this.schemaService.getFieldByIDAndVMID(n.binding.field,this.viewModelId);(x=s==null?void 0:s.schemaField)!=null&&x.type&&(o=s.schemaField.type.$type)}const u=this.getPropertyEditorParams(n,["Variable"]),f=!n.editor.dataSourceType||n.editor.dataSourceType==="static",a=(((h=(b=this.designViewModelField)==null?void 0:b.type)==null?void 0:h.$type)===R.FormSchemaEntityFieldType$Type.StringType||!!this.formRule&&((w=this.designerHostService.schemaService.getFieldByID(n.binding.field))==null?void 0:w.type.$type)===R.FormSchemaEntityFieldType$Type.StringType)&&((T=n.editor)==null?void 0:T.type)==="combo-list"&&((p=n.editor)==null?void 0:p.dataSourceType)==="dynamic"&&!((N=(M=n.editor)==null?void 0:M.remote)!=null&&N.url)&&!((l=n.editor)!=null&&l.multiSelect);return r.getComponentConfig(n,{type:"combo-list"},{enableClear:{description:"是否显示清除按钮",title:"启用清除按钮",type:"boolean"},dataSourceType:{description:"",title:"数据源类型",type:"enum",editor:{default:"static",data:[{id:"static",name:"静态"},{id:"dynamic",name:"动态"}]},refreshPanelAfterChanged:!0},dataSource:{description:"动态数据源绑定变量",visible:a,title:"数据",editor:{...u,controlName:"",enableClear:!0},refreshPanelAfterChanged:!0},data:{description:"",title:"数据",type:"array",visible:f,...r.getItemCollectionEditor(n,n.editor.valueField,n.editor.textField),refreshPanelAfterChanged:!0},url:{visible:n.editor.dataSourceType==="dynamic"&&!((i=n.editor)!=null&&i.dataSource),$converter:ge,description:"",title:"服务端API",type:"string",refreshPanelAfterChanged:!0},body:{visible:!1,$converter:ge,description:"",title:"服务端API参数",type:"string"},textField:{description:"",title:"数据源显示字段",type:"string",readonly:n.editor.dataSourceType!=="dynamic"},valueField:{description:"",title:"数据源值字段",type:"string",readonly:n.editor.dataSourceType!=="dynamic"},multiSelect:{description:"",title:"启用多选",visible:!o||o==="StringType",readonly:((d=n.editor)==null?void 0:d.dataSourceType)==="dynamic"&&!!((c=n.editor)!=null&&c.dataSource),type:"boolean",refreshPanelAfterChanged:!0},maxLength:{description:"",title:"最大输入长度",type:"number",editor:{nullable:!0,min:0,useThousands:!1,needValid:!0}},...this.getCommonEditorProperties(n)},(s,m)=>{if(!s||!m.editor)return;const I=this;switch(s.propertyID){case"dataSourceType":{s.propertyValue==="static"?(m.editor.valueField="value",m.editor.textField="name",m.editor.remote=null):s.propertyValue==="dynamic"&&(m.editor.remote={method:"GET"},m.editor.valueField="value",m.editor.textField="name");break}case"data":{!I.checkEnumDataReadonly(m)&&m.formatter&&(m.formatter.data=[...s.propertyValue]);break}case"viewType":{s.propertyValue==="tag"&&(m.editor.editable=!1);break}case"dataSource":I.afterMutilEditorChanged(m,s);break}})}getGridFieldEdtiorProperties(n,r){var F,x,b,h,w,T,p,M,N,l,i,d,c;const o=this;let u="";if(((F=n==null?void 0:n.binding)==null?void 0:F.type)==="Form"){const s=this.schemaService.getFieldByIDAndVMID(n.binding.field,this.viewModelId);(x=s==null?void 0:s.schemaField)!=null&