@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
2 lines (1 loc) • 24.2 kB
JavaScript
(function(b,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("../button-edit/index.umd.js"),require("../tree-grid/index.umd.js"),require("../radio-group/index.umd.js"),require("../common/index.umd.js"),require("../dynamic-resolver/index.umd.js"),require("../locale/index.umd.js"),require("bignumber.js"),require("lodash-es"),require("../property-panel/index.umd.js"),require("../notify/index.umd.js"),require("../data-grid/index.umd.js")):typeof define=="function"&&define.amd?define(["exports","vue","../button-edit/index.umd.js","../tree-grid/index.umd.js","../radio-group/index.umd.js","../common/index.umd.js","../dynamic-resolver/index.umd.js","../locale/index.umd.js","bignumber.js","lodash-es","../property-panel/index.umd.js","../notify/index.umd.js","../data-grid/index.umd.js"],t):(b=typeof globalThis<"u"?globalThis:b||self,t(b["binding-selector"]={},b.Vue,b.FButtonEdit,b.FTreeGrid,b.FRadioGroup,b.common,b.dynamicResolver,b.locale,b.BigNumber,b.LodashES,b.propertyPanel,b.notify,b.dataGrid))})(this,function(b,t,H,ue,me,_,fe,J,ve,ee,q,pe,ge){"use strict";var Ve=Object.defineProperty;var Ce=(b,t,H)=>t in b?Ve(b,t,{enumerable:!0,configurable:!0,writable:!0,value:H}):b[t]=H;var D=(b,t,H)=>Ce(b,typeof t!="symbol"?t+"":t,H);const ye={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/binding-selector.schema.json",title:"binding-selector",description:"字段绑定选择器",type:"object",properties:{disabled:{description:"",type:"boolean",default:!1},readonly:{description:"",type:"boolean",default:!1},bindingType:{description:"",type:"object",default:{}},idField:{description:"",type:"string",default:"id"},title:{description:"",type:"string",default:"字段选择器"},modalWidth:{description:"",type:"number",default:800},modalHeight:{description:"",type:"number",default:600},separator:{description:"",type:"string",default:","},bindingData:{description:"",type:"array",default:[]},textField:{description:"",type:"string",default:"code"},editorParams:{description:"",type:"object",default:{}}}},te=[{field:"name",title:"名称"},{field:"bindingField",title:"绑定字段"},{field:"fieldType",title:"字段类型"}],ne=[{field:"name",title:"名称"},{field:"code",title:"编号"},{field:"displayTypeName",title:"变量类型"},{field:"fromSource",title:"来源"}],oe=[{value:"Form",text:"绑定字段"},{value:"Variable",text:"绑定变量"}],U={disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},modelValue:{type:Object,default:null},bindingType:{type:Object,default:{enable:!0,value:"Form",textField:"text",valueField:"value"}},data:{type:Array,default:[]},idField:{type:String,default:"id"},title:{type:String,default:"字段选择器"},modalWidth:{type:Number,default:800},modalHeight:{type:Number,default:600},multiSelect:{type:Boolean,default:!1},separator:{type:String,default:","},bindingData:{type:Array,default:[]},textField:{type:String,default:"code"},beforeOpenDialog:{type:Function,default:null},editorParams:{type:Object,default:null},onFieldSelected:{type:Function,default:null},showCustomFooter:{type:Boolean,default:!1}},ie=fe.createPropsResolver(U,ye),he={showCloseButton:{type:Boolean,default:!0},position:{type:String,default:"top-center"},timeout:{type:Number,default:3e3},theme:{type:String,default:"bootstrap"},left:{type:Number},right:{type:Number},top:{type:Number},bottom:{type:Number},id:{type:String},animate:{type:String,default:"fadeIn"},options:{type:Object},safeHtml:{type:Boolean,default:!0}},be={showCloseButton:{type:Boolean,default:!0},animate:{type:String,default:"fadeIn"},options:{type:Object}},Q=t.defineComponent({name:"Toast",props:be,emits:["close","click"],setup:(e,n)=>{const l=t.ref(e.animate),r="fadeOut",i=t.computed(()=>e.options),u=t.ref(!1),m=t.computed(()=>i.value.title&&i.value.message),p=t.computed(()=>!i.value.title&&i.value.message),N=t.computed(()=>{const h={animated:u.value,toast:!0,"toast--only-content":!m.value};return h[e.animate]=!1,h[r]=u.value,h["toasty-type-"+i.value.type]=!0,i.value.theme&&(h[i.value.theme]=!0),h}),S=t.computed(()=>{const k=`f-icon-${i.value&&i.value.type?i.value.type.replace("toasty-type-",""):"default"}`,T={"f-icon":!0};return T[k]=!0,T}),C=t.computed(()=>i.value.title||i.value.message),M=t.computed(()=>e.showCloseButton),I=t.computed(()=>!!i.value.buttons||!!n.slots.default),O=t.computed(()=>J.LocaleService.getLocale()==="en"?{wordBreak:"keep-all",overflowWrap:"break-word"}:{});function R(h){h.stopPropagation(),h.preventDefault(),u.value=!1,setTimeout(()=>{n.emit("close",i.value)},200)}function j(h,E){}function x(h){return`f-preten-link ${h.customClass?h.customClass:""}`}t.watch(l,()=>{l.value});const P=()=>{var h;return t.createVNode(t.Fragment,null,[t.createVNode("div",{class:"after-toast-msg text-right"},[!n.slots.default&&((h=i.value.buttons)==null?void 0:h.map(E=>t.createVNode("span",{class:x(E),onClick:k=>void 0},[E.text]))),n.slots.default&&n.slots.default()])])};return()=>t.createVNode("div",{class:N.value,style:"min-height:44px"},[M.value&&t.createVNode("button",{title:J.LocaleService.getLocaleValue("messageBox.close"),class:"toast-close f-btn-icon f-bare",onClick:R},[t.createVNode("span",{class:"f-icon modal_close"},null)]),C.value&&t.createVNode("section",{class:"modal-tips"},[!m.value&&t.createVNode("div",{class:"float-left modal-tips-iconwrap"},[t.createVNode("span",{class:S.value},null)]),t.createVNode("div",{class:"modal-tips-content"},[m.value&&t.createVNode(t.Fragment,null,[t.createVNode("h5",{class:"toast-title modal-tips-title",innerHTML:i.value.title},null),t.createVNode("p",{class:"toast-msg",innerHTML:i.value.message,style:O.value},null),I.value&&P()]),p.value&&(i.value.buttons?t.createVNode("div",{class:"toast-title-btns-wrapper d-flex"},[t.createVNode("h5",{class:"toast-title modal-tips-title only-toast-msg",style:O.value,innerHTML:i.value.message},null),t.createVNode("div",{class:"after-toast-title text-right ml-auto"},[P()])]):t.createVNode("h5",{class:"toast-title modal-tips-title only-toast-msg",style:O.value,innerHTML:i.value.message},null))])])])}}),Fe=["moz","ms","webkit"];function Se(){let e=0;return n=>{const l=new Date().getTime(),r=Math.max(0,16-(l-e)),i=setTimeout(()=>{n(l+r)},r);return e=l+r,i}}function Te(){if(typeof window>"u")return()=>0;if(window.requestAnimationFrame)return window.requestAnimationFrame.bind(window);const e=Fe.filter(n=>`${n}RequestAnimationFrame`in window)[0];return e?window[`${e}RequestAnimationFrame`]:Se()}Te(),t.ref("");function we(){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],l=[/iPad/i,/Android(?!.*Mobile)/i,/Tablet/i,/PlayBook/i,/Kindle/i,/Silk/i];for(const p of l)if(p.test(e))return!1;for(const p of n)if(p.test(e))return!0;const r="ontouchstart"in window||navigator.maxTouchPoints>0,i=screen.width,u=screen.height,m=Math.min(i,u);return!!(r&&m<=768)}const W=t.defineComponent({name:"Notify",props:he,emits:["close","empty"],setup(e,n){var j;const l=we(),i=`farris-notify-${(j=e.options)!=null&&j.type?e.options.type:"info"}}`,u=t.computed(()=>({"farris-notify":!0,[i]:l})),m={left:12,right:12,top:20,bottom:12},p=t.ref(),N=t.ref(e.options),S=t.ref(e.showCloseButton),C=t.computed(()=>e.position||"bottom-right"),M=t.computed(()=>e.timeout!=null?e.timeout:3e3),I=t.computed(()=>{const x=e.bottom?e.bottom:m.bottom,P=e.top?e.top:m.top,h={transition:"all 0.2s ease",left:C.value.indexOf("left")>-1?`${e.left?e.left:m.left}px`:"",right:C.value.indexOf("right")>-1?`${e.right?e.right:m.right}px`:"",top:C.value.indexOf("top")>-1?`${P}px`:"",bottom:C.value.indexOf("bottom")>-1?`${x}px`:""};return C.value.indexOf("center")>-1&&(h.left="50%",h.marginLeft="calc(-24rem / 2)",C.value==="center-center"&&(h.top="50%",h.transform="translate(-50%, -50%)")),h});function O(x){n.emit("close")}M.value&&setTimeout(()=>{O()},M.value),n.expose({closeToast:O,container:p,notifyPosition:C});function R(x,P){O()}return()=>{var x;return l?t.createVNode("div",{class:u.value,ref:p},[(x=e.options)==null?void 0:x.message]):t.createVNode("div",{class:u.value,style:I.value,ref:p},[t.createVNode(Q,{options:N.value,showCloseButton:S.value,animate:e.animate,onClose:P=>R(P,N.value)},null)])}}});class ae{constructor(){D(this,"notifyRefs",[]);D(this,"globalConfig",t.reactive({}))}escapeAllHtml(n){if(typeof n!="string"||!n)return"";const l=document.createElement("div");return l.textContent=n||"",l.innerHTML.replace(/\\n/g,"<br>").replace(/\\t/g," ").replace(/\\r/g,"")}createNotifyInstance(n){const l=this,i=Object.assign({timeout:3e3,position:"bottom-right",showCloseButton:!0,safeHtml:!0},this.globalConfig,{...n}),u=document.createElement("div");u.style.display="contents";const m=t.createApp({setup(){var S;const p=t.ref();function N(){p.value.container.style.transform="scale(0)",setTimeout(()=>{l.updateNotifyPositionForClose(i,p),m.unmount()},220)}if(i.position.indexOf("top")>-1){const C=l.getNotifyInstances(i.position),M=C[C.length-1];if(M){const I=M.value.container.getBoundingClientRect();i.top=I.bottom}}return i.safeHtml&&((S=i.options)!=null&&S.message)&&(i.options.message=l.escapeAllHtml(i.options.message)),t.onUnmounted(()=>{document.body.removeChild(u)}),t.onMounted(()=>{l.updateNotifyPositionForCreate(i,p)}),()=>t.createVNode(t.Transition,{mode:"out-in",name:"fade",appear:!0},{default:()=>[t.createVNode(W,t.mergeProps({ref:p},i,{onClose:N}),null)]})}});return m.provide("NotifyService",this),document.body.appendChild(u),m.use(J.LocaleService.i18n),m.mount(u),m}getNotifyInstances(n){return this.notifyRefs.filter(l=>l.value.notifyPosition===n)}updateNotifyPositionForCreate(n,l){if(this.notifyRefs&&this.notifyRefs.length){const r=window.innerHeight;n.position.indexOf("bottom")>-1&&this.getNotifyInstances(n.position).forEach(i=>{const u=i.value.container.getBoundingClientRect();i.value.container.style.bottom=u.height+r-u.bottom+"px"})}this.notifyRefs=[...this.notifyRefs,l]}updateNotifyPositionForClose(n,l){const r=this.notifyRefs.indexOf(l);if(n.position.indexOf("top")>-1){const i=this.getNotifyInstances(n.position),u=i.indexOf(l);i.slice(u+1).forEach(m=>{m.value.container.style.top=m.value.container.offsetTop-m.value.container.offsetHeight+"px"})}r>-1&&this.notifyRefs.splice(r,1)}show(n){return this.createNotifyInstance(n)}buildNotifyProps(n,l){let r="",i="",u,m,p;typeof l=="string"?r=l:l&&(r=l.message||"",i=l.title||"",m=l.position||null,p=l.showCloseButton!=null?l.showCloseButton:null,u=l.timeout!=null?l.timeout:null);const S={options:{type:n,message:r,title:i}};return m!=null&&(S.position=m),p!=null&&(S.showCloseButton=p),u!=null&&(S.timeout=u),S}info(n){const l=this.buildNotifyProps("info",n);return this.show(l)}success(n){const l=this.buildNotifyProps("success",n);return this.show(l)}warning(n){const l=this.buildNotifyProps("warning",n);return this.show(l)}error(n){const l=this.buildNotifyProps("error",n);return this.show(l)}close(n){n&&n.unmount()}closeAll(){this.notifyRefs.forEach(n=>{n==null||n.value.closeToast()}),this.notifyRefs.length=0}}const Ne=Symbol("NOTIFY_SERVICE_TOKEN");W.install=e=>{e.component(W.name,W),e.component(Q.name,Q);const n=new ae;e.provide(Ne,n),e.provide("FNotifyService",n)};function le(e){const{designViewModelUtils:n,schemaService:l,formSchemaUtils:r,designerContext:i}=e.editorParams.designerHostService,{viewModelId:u}=e.editorParams;let m=[],p=[],N=[];const S=new ae;S.globalConfig={position:"top-center"};function C(o){switch(o){case"LocaleVariable":return p;case"RemoteVariable":return N;default:return m}}function M(){m=n.getAllFields2TreeByVMId(u)}function I(){const o=r.getViewModelById(u);if(o.parent){const s=r.getLocaleVariablesByViewModelId(o.parent);s&&s.length&&(s[0].data.name="根组件",p=p.concat(s))}const a=r.getLocaleVariablesByViewModelId(u);return p=p.concat(a),p||[]}function O(){return N=r.getRemoteVariables(),N||[]}function R(o,a=null){const s=[];return o&&o.forEach(g=>{var F;if(!g.nodeType&&(!g.children||!g.children.length))g.data&&s.push({...g.data,fromSource:(F=a==null?void 0:a.data)==null?void 0:F.name});else if(g.children){const y=R(g.children,g);s.push(...y)}}),s}function j(){const o=R(I()),a=O().map(s=>({...s.data,fromSource:"视图对象"}));return[...o,...a]}function x(o){var y,V,B,d;const a=ee.merge({},o.rawData,{groupId:null,groupName:null}),s=(y=e.editorParams.componentSchema)==null?void 0:y.binding,g=(V=e.editorParams.componentSchema)==null?void 0:V.label,F=n.getDgViewModel(u);if(s!=null&&s.field){const c=F.fields.find(f=>f.id===s.field);if(F.removeField([s.field]),c){const{groupId:f,groupName:v,editor:w}=c;ee.merge(a,{editor:w,groupId:f,groupName:v})}}F.addField(a),(d=(B=e.editorParams.componentSchema)==null?void 0:B.editor)!=null&&d.type&&F.changeField(a.id,{editor:a.editor}),g&&F.changeField(a.id,{name:g})}function P(o){var F;const a=(F=e.editorParams.componentSchema)==null?void 0:F.binding,s=n.getDgViewModel(u),g={type:"Variable",id:o.id,fieldName:o.code,groupId:"",groupName:""};if(a!=null&&a.field){const y=r.getViewModelById(u),V=y==null?void 0:y.fields.find(B=>B.id===(a==null?void 0:a.field));V&&(g.groupName=V.groupName,g.groupId=V.groupId),s.removeField([a==null?void 0:a.field])}r.addViewModelField(u,g)}function h(o,a){if(!e.editorParams.needSyncToViewModel||!e.editorParams.viewModelId||!e.editorParams.designerHostService)return;const s=e.editorParams.componentSchema.binding;s&&s.field===o.id||(a==="Form"?x(o):P(o))}function E(o){if(!e.editorParams.needSyncToViewModel||!e.editorParams.viewModelId||!e.editorParams.designerHostService)return;const a=e.editorParams.componentSchema.binding;if(!(!a||a.field===o.id)&&r.getExpressions().length){const{componentSchema:s}=e.editorParams,g=r.getExpressions().findIndex(F=>F.target===a.field);g>-1&&(r.getExpressions().splice(g,1),S.warning("切换绑定后,请重新配置表达式"),Object.keys(s).forEach(F=>{s[F]&&s[F].type==="Expression"&&(s[F].expressionId=""),s.editor&&Object.keys(s.editor).forEach(y=>{s.editor[y]&&s.editor[y].type==="Expression"&&(s.editor[y].expressionId="")})}))}}function k(o){var s;[_.FormSchemaEntityFieldTypeName.Number,_.FormSchemaEntityFieldTypeName.String,_.FormSchemaEntityFieldTypeName.Text].includes(o.type.name)&&((s=o.type)==null?void 0:s.length)&&e.editorParams.componentSchema.editor&&!Object.prototype.hasOwnProperty.call(e.editorParams.componentSchema.editor,"maxLength")&&(e.editorParams.componentSchema.editor.maxLength=o.type.length)}function T(o,a){if(e.editorParams.componentSchema)return e.editorParams.componentSchema.binding||(e.editorParams.componentSchema.binding={}),a==="Form"?(e.editorParams.componentSchema.binding.path=o.bindingField,e.editorParams.componentSchema.binding.field=o.id,e.editorParams.componentSchema.binding.fullPath=o.path):o.category==="locale"?(e.editorParams.componentSchema.binding.path=o.viewModelId===u?o.code:"root-component."+o.code,e.editorParams.componentSchema.binding.field=o.id,e.editorParams.componentSchema.binding.fullPath=o.code):(e.editorParams.componentSchema.binding.path="root-component."+o.code,e.editorParams.componentSchema.binding.field=o.id,e.editorParams.componentSchema.binding.fullPath=o.code),e.editorParams.componentSchema.binding.type=a,e.editorParams.componentSchema.path=o.bindingPath,k(o),e.editorParams.componentSchema.binding}function A(o){const a=o==null?void 0:o.field,s=new Set,g=r.getFormSchema().module,F=r.getViewModelById(u),y=g.components.find(d=>d.viewModel===u),V=r.checkComponentExistInDrawer(y.id);let B=y.componentType;return(B==="frame"||B==="table")&&(B="form"),g.viewmodels.forEach(d=>{if(!d.fields||d.fields.length===0)return;const c=g.components.find(w=>w.viewModel===d.id);let{componentType:f}=c;if((f==="frame"||f==="table")&&(f="form"),f!==B||d.bindTo!==F.bindTo)return;const v=r.checkComponentExistInDrawer(c.id);V&&v&&d.fields.forEach(w=>{w.id!==a&&s.add(w.id)}),!V&&!v&&d.fields.forEach(w=>{w.id!==a&&s.add(w.id)})}),s}function z(o){if(!o)return[];const a={},s=i&&i.schemaDOMMapping?i.schemaDOMMapping:q.SchemaDOMMapping,{fieldControlTypeMapping:g}=s;for(const F in g){const y=g[F];!y||!y.length||y.forEach(V=>{a[V.key]=a[V.key]||[],a[V.key].push(F)})}return a["language-textbox"]=["multiLanguage"],a[o]}function X(){M()}function Y(o,a){if(o.multiLanguage)return{fieldType:"multiLanguage",fieldTypeName:"多语言"};const s=a===q.FormBindingType.Form?o.type.name:o.type,g=a===q.FormBindingType.Form?o.type.displayName:o.displayTypeName;return{fieldType:s,fieldTypeName:g}}function G(){var F;const o=(F=e.editorParams)==null?void 0:F.componentSchema,a=o==null?void 0:o.binding;if(!a)return{originalFieldType:"",isOriginalBindComplexField:!1};let s,g=!1;if(a.type===q.FormBindingType.Form){const y=l.getFieldByID(a.field);y&&(s=Y(y,q.FormBindingType.Form).fieldType,y.$type===_.FormSchemaEntityField$Type.ComplexField&&(g=!0))}else{const y=r.getVariableById(a.field);y&&(s=y.type)}return{originalFieldType:s,isOriginalBindComplexField:g}}function Z(o,a){var re,se,de,ce;if(!(o!=null&&o.length))return S.warning({message:"请先选择数据"}),!1;const s=(re=e.editorParams)==null?void 0:re.componentSchema;if(!(s==null?void 0:s.binding))return!0;let F=!0;const{originalFieldType:y,isOriginalBindComplexField:V}=G(),B=o[0],{fieldType:d,fieldTypeName:c}=Y(B,a),f="不可以切换成",v="类型字段,请重新选择!",w=(ce=(de=(se=e.editorParams)==null?void 0:se.componentSchema)==null?void 0:de.editor)==null?void 0:ce.type,$=z(w);return V||!y?($!=null&&$.length&&!$.includes(d)&&(S.warning(`${f}${c}${v}`),F=!1),F):y&&y!==d?w==="combo-list"||w==="lookup"||w==="radio-group"?a===q.FormBindingType.Form?$.includes(d):d==="String"||d==="Object":e.editorParams.canChangeFieldType?!0:(S.warning(`${f}${c}${v}`),!1):F}return{initTreeData:X,getTreeDataSource:C,updateViewModel:h,updateComponentSchema:T,resolveOccupiedFields:A,resolveFieldTypesByEditorType:z,checkFieldValiation:Z,clearExpresssionConfig:E,getOriginalFieldType:G,getVariableData:j}}const K=t.defineComponent({name:"FBindingSelectorContainer",props:U,emits:["selected","bindingTypeChange","cancel","submit","skip"],setup(e,n){var y,V,B;const l=t.ref(e.data),r=t.ref(((y=e.modelValue)==null?void 0:y.type)||"Form"),i=t.ref(e.bindingData),u=t.ref(),m=t.ref(),p=t.ref(),N=t.ref(),{getTreeDataSource:S,initTreeData:C,resolveOccupiedFields:M,resolveFieldTypesByEditorType:I,getOriginalFieldType:O,getVariableData:R}=le(e),{originalFieldType:j,isOriginalBindComplexField:x}=O(),P=t.ref([]),h={};t.onBeforeMount(()=>{var d,c,f,v,w,$;C(),P.value=R(),l.value=S(r.value),(d=e.editorParams)!=null&&d.disableOccupiedFields&&(p.value=M((f=(c=e.editorParams)==null?void 0:c.componentSchema)==null?void 0:f.binding)),N.value=I(($=(w=(v=e.editorParams)==null?void 0:v.componentSchema)==null?void 0:w.editor)==null?void 0:$.type)}),t.onMounted(()=>{setTimeout(()=>{var c,f,v;const d=(v=(f=(c=e.editorParams)==null?void 0:c.componentSchema)==null?void 0:f.binding)==null?void 0:v.field;d&&(r.value==="Form"?(u.value.selectItemById(d),i.value=u.value.getSelectedItems()):(m.value.selectItemById(d),m.value.activeRowById(d),i.value=m.value.getSelectedItems()),h[r.value]=i.value,n.emit("selected",i.value))})});const E={"f-utils-fill":!0,"m-2":(V=e.bindingType)==null?void 0:V.enable,"mx-2":!((B=e.bindingType)!=null&&B.enable),border:!0};function k(d){n.emit("selected",h[d]||[]),n.emit("bindingTypeChange",d)}function T(d){i.value=d,h[r.value]=d,n.emit("selected",d)}function A(){return t.createVNode("div",{class:"px-3"},[t.createVNode(me,{name:"bindingType",textField:e.bindingType.textField||"text",valueField:e.bindingType.valueField||"value",data:oe,modelValue:r.value,"onUpdate:modelValue":d=>r.value=d,onChangeValue:k},null)])}function z(d,c="Form"){var f;return d.raw.multiLanguage?"multiLanguage":c==="Form"?(f=d.raw.type)==null?void 0:f.name:d.raw.type}const X=()=>{var d,c,f;return((f=(c=(d=e.editorParams)==null?void 0:d.componentSchema)==null?void 0:c.editor)==null?void 0:f.type)||""},Y=t.computed(()=>{var d,c,f;return(((f=(c=(d=e.editorParams)==null?void 0:d.componentSchema)==null?void 0:c.editor)==null?void 0:f.type)||"")==="language-textbox"}),G=d=>({customRowStatus:c=>{var w;if(c.raw.$type&&c.raw.$type!==_.FormSchemaEntityField$Type.SimpleField||p.value&&p.value.has(c.raw.id))return c.disabled=!0,c;const f=z(c,d),v=X();if(v==="combo-list"||v==="lookup")return d!=="Form"?(c.disabled=f!=="Object",c):(c.disabled=!N.value.includes(f),c);if(v==="radio-group")return d!=="Form"?c.disabled=f!=="String":c.disabled=!N.value.includes(f),c;if(x||!j){if(f&&((w=N.value)!=null&&w.length)&&!N.value.includes(f))return c.disabled=!0,c}else if(j&&j!==f)return c.disabled=!0,c;return c.disabled=!1,c}});function Z(){return t.createVNode(ue,{ref:u,fit:!0,data:l.value,idField:e.idField,columns:te,rowNumber:{enable:!1},columnOption:{fitColumns:!0},onSelectionChange:T,"row-option":G("Form")},null)}function o(){return t.createVNode(ge.FDataGrid,{ref:m,fit:!0,data:P.value,idField:e.idField,columns:ne,rowNumber:{enable:!1},columnOption:{fitColumns:!0},onSelectionChange:T,"row-option":G("Variable")},null)}function a(){n.emit("cancel")}function s(){if(!i.value||!i.value.length){const d=new pe.FNotifyService;return d.globalConfig={position:"top-center"},d.warning({message:"请先选择数据"}),!1}return!0}function g(){s()&&n.emit("submit",{selectedData:i.value[0],bindingType:r.value})}function F(){n.emit("skip")}return()=>t.createVNode("div",{class:"h-100 d-flex flex-column"},[e.bindingType.enable&&!Y.value&&A(),t.createVNode("div",{class:E,style:"position:relative;border-radius:10px;"},[t.createVNode("div",{class:{"h-100":!0,"d-none":r.value!=="Form"}},[Z()]),t.createVNode("div",{class:{"h-100":!0,"d-none":r.value==="Form"}},[o()])]),e.showCustomFooter?t.createVNode("div",{class:"modal-footer"},[t.createVNode("button",{type:"button",class:"btn btn-secondary",onClick:a},[t.createTextVNode("取消")]),t.createVNode("button",{type:"button",class:"btn btn-secondary",onClick:F},[t.createTextVNode("跳过绑定")]),t.createVNode("button",{type:"button",class:"btn btn-primary",onClick:g},[t.createTextVNode("确定")])]):""])}}),L=t.defineComponent({name:"FBindingSelector",props:U,emits:["selected","bindingTypeChanged"],setup(e,n){var h,E,k;const l='<i class="f-icon f-icon-lookup"></i>',r=t.ref(e.bindingData),i=t.ref(e.data),u=t.ref(),m=t.ref(((h=e.modelValue)==null?void 0:h.type)||"Form"),p=t.ref(m.value==="Form"?(E=e.modelValue)==null?void 0:E.path:(k=e.modelValue)==null?void 0:k.fullPath),{updateViewModel:N,updateComponentSchema:S,checkFieldValiation:C,clearExpresssionConfig:M}=le(e);function I(T){r.value=T}function O(T){m.value=T}function R(T){p.value=(T==null?void 0:T.type)==="Form"?T.path:T.fullPath}function j(){return t.createVNode(K,{ref:u,data:i.value,onSelected:I,modelValue:e.modelValue,idField:e.idField,bindingData:r.value,onBindingTypeChange:O,editorParams:e.editorParams,bindingType:e.bindingType,showCustomFooter:!1},null)}function x(){return!!C(r.value,m.value)}const P={title:e.title,fitContent:!1,height:e.modalHeight,width:e.modalWidth,buttons:[{name:"cancel",text:"取消",class:"btn btn-secondary",handle:T=>(r.value=[],!0)},{name:"accept",text:"确定",class:"btn btn-primary",handle:T=>{if(!x())return!1;N(r.value[0],m.value),M(r.value[0]);const A=S(r.value[0],m.value);return R(A),e.onFieldSelected&&typeof e.onFieldSelected=="function"&&e.onFieldSelected(A,void 0,r.value[0]),!0}}],resizeable:!1,draggable:!0};return()=>t.createVNode(H,{modelValue:p.value,"onUpdate:modelValue":T=>p.value=T,editable:!1,disabled:e.disabled,readonly:e.readonly,inputType:"text",enableClear:!1,buttonContent:l,buttonBehavior:"Modal",modalOptions:P,enableTitle:!0},{default:()=>[t.createVNode("div",{class:"h-100 d-flex flex-column"},[j()])]})}});L.install=e=>{e.component(L.name,L),e.component(K.name,K)},L.register=(e,n,l,r)=>{e["binding-selector"]=L,n["binding-selector"]=ie},b.BindingSelector=L,b.FBindingSelectorContainer=K,b.bindingSelectorProps=U,b.bindingTypes=oe,b.default=L,b.fieldColumns=te,b.propsResolver=ie,b.variableColumns=ne,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});