@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
2 lines • 108 kB
JavaScript
(function(w,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("../dynamic-resolver/index.umd.js"),require("lodash-es"),require("../common/index.umd.js"),require("../designer-canvas/index.umd.js"),require("../notify/index.umd.js"),require("../tree-view/index.umd.js"),require("../schema-selector/index.umd.js"),require("../modal/index.umd.js"),require("../input-group/index.umd.js"),require("../combo-list/index.umd.js"),require("../event-parameter/index.umd.js"),require("../locale/index.umd.js"),require("../dynamic-view/index.umd.js"),require("../section/index.umd.js"),require("../accordion/index.umd.js"),require("../avatar/index.umd.js"),require("../../designer/button-edit/index.umd.js"),require("../button-group/index.umd.js"),require("../calendar/index.umd.js"),require("../../designer/capsule/index.umd.js"),require("../../designer/checkbox/index.umd.js"),require("../../designer/checkbox-group/index.umd.js"),require("../combo-tree/index.umd.js"),require("../component/index.umd.js"),require("../color-picker/index.umd.js"),require("../content-container/index.umd.js"),require("../../designer/date-picker/index.umd.js"),require("../../designer/data-grid/index.umd.js"),require("../dropdown/index.umd.js"),require("../../designer/dynamic-form/index.umd.js"),require("../events-editor/index.umd.js"),require("../filter-bar/index.umd.js"),require("../field-selector/index.umd.js"),require("../binding-selector/index.umd.js"),require("../image-cropper/index.umd.js"),require("../../designer/input-group/index.umd.js"),require("../layout/index.umd.js"),require("../list-nav/index.umd.js"),require("../../designer/list-view/index.umd.js"),require("../lookup/index.umd.js"),require("../mapping-editor/index.umd.js"),require("../nav/index.umd.js"),require("../number-range/index.umd.js"),require("../../designer/number-spinner/index.umd.js"),require("../order/index.umd.js"),require("../page-header/index.umd.js"),require("../page-footer/index.umd.js"),require("../pagination/index.umd.js"),require("../progress/index.umd.js"),require("../query-solution/index.umd.js"),require("../../designer/radio-group/index.umd.js"),require("../../designer/rate/index.umd.js"),require("../../designer/response-toolbar/index.umd.js"),require("../response-layout/index.umd.js"),require("../../designer/response-layout-editor/index.umd.js"),require("../search-box/index.umd.js"),require("../../designer/section/index.umd.js"),require("../smoke-detector/index.umd.js"),require("../splitter/index.umd.js"),require("../step/index.umd.js"),require("../../designer/switch/index.umd.js"),require("../../designer/tabs/index.umd.js"),require("../../designer/tags/index.umd.js"),require("../text/index.umd.js"),require("../../designer/time-picker/index.umd.js"),require("../transfer/index.umd.js"),require("../uploader/index.umd.js"),require("../verify-detail/index.umd.js"),require("../video/index.umd.js"),require("../../designer/textarea/index.umd.js"),require("../../designer/tree-grid/index.umd.js"),require("../filter-condition-editor/index.umd.js"),require("../fieldset/index.umd.js"),require("../sort-condition-editor/index.umd.js"),require("../menu-lookup/index.umd.js"),require("../../designer/drawer/index.umd.js"),require("../json-editor/index.umd.js"),require("../property-editor/index.umd.js"),require("../expression-editor/index.umd.js"),require("../code-editor/index.umd.js"),require("../html-template/index.umd.js"),require("../collection-property-editor/index.umd.js"),require("../../designer/modal/index.umd.js"),require("../external-container/index.umd.js"),require("../language-textbox/index.umd.js"),require("../image/index.umd.js"),require("../comment/index.umd.js"),require("../property-panel/index.umd.js")):typeof define=="function"&&define.amd?define(["exports","vue","../dynamic-resolver/index.umd.js","lodash-es","../common/index.umd.js","../designer-canvas/index.umd.js","../notify/index.umd.js","../tree-view/index.umd.js","../schema-selector/index.umd.js","../modal/index.umd.js","../input-group/index.umd.js","../combo-list/index.umd.js","../event-parameter/index.umd.js","../locale/index.umd.js","../dynamic-view/index.umd.js","../section/index.umd.js","../accordion/index.umd.js","../avatar/index.umd.js","../../designer/button-edit/index.umd.js","../button-group/index.umd.js","../calendar/index.umd.js","../../designer/capsule/index.umd.js","../../designer/checkbox/index.umd.js","../../designer/checkbox-group/index.umd.js","../combo-tree/index.umd.js","../component/index.umd.js","../color-picker/index.umd.js","../content-container/index.umd.js","../../designer/date-picker/index.umd.js","../../designer/data-grid/index.umd.js","../dropdown/index.umd.js","../../designer/dynamic-form/index.umd.js","../events-editor/index.umd.js","../filter-bar/index.umd.js","../field-selector/index.umd.js","../binding-selector/index.umd.js","../image-cropper/index.umd.js","../../designer/input-group/index.umd.js","../layout/index.umd.js","../list-nav/index.umd.js","../../designer/list-view/index.umd.js","../lookup/index.umd.js","../mapping-editor/index.umd.js","../nav/index.umd.js","../number-range/index.umd.js","../../designer/number-spinner/index.umd.js","../order/index.umd.js","../page-header/index.umd.js","../page-footer/index.umd.js","../pagination/index.umd.js","../progress/index.umd.js","../query-solution/index.umd.js","../../designer/radio-group/index.umd.js","../../designer/rate/index.umd.js","../../designer/response-toolbar/index.umd.js","../response-layout/index.umd.js","../../designer/response-layout-editor/index.umd.js","../search-box/index.umd.js","../../designer/section/index.umd.js","../smoke-detector/index.umd.js","../splitter/index.umd.js","../step/index.umd.js","../../designer/switch/index.umd.js","../../designer/tabs/index.umd.js","../../designer/tags/index.umd.js","../text/index.umd.js","../../designer/time-picker/index.umd.js","../transfer/index.umd.js","../uploader/index.umd.js","../verify-detail/index.umd.js","../video/index.umd.js","../../designer/textarea/index.umd.js","../../designer/tree-grid/index.umd.js","../filter-condition-editor/index.umd.js","../fieldset/index.umd.js","../sort-condition-editor/index.umd.js","../menu-lookup/index.umd.js","../../designer/drawer/index.umd.js","../json-editor/index.umd.js","../property-editor/index.umd.js","../expression-editor/index.umd.js","../code-editor/index.umd.js","../html-template/index.umd.js","../collection-property-editor/index.umd.js","../../designer/modal/index.umd.js","../external-container/index.umd.js","../language-textbox/index.umd.js","../image/index.umd.js","../comment/index.umd.js","../property-panel/index.umd.js"],e):(w=typeof globalThis<"u"?globalThis:w||self,e(w["events-editor"]={},w.Vue,w.dynamicResolver,w.LodashES,w.common,w.designerCanvas,w.notify,w.FTreeview,w.FSchemaSelector,w.modal,w.FInputGroup,w.FComboList,w.FEventParameter,w.locale,w.dynamicView,w.FSection,w.FAccordion,w.FAvatar,w.FButtonEdit,w.FButtonGroup,w.FCalendar,w.FCapsule,w.FCheckbox,w.FCheckboxGroup,w.FComboTree,w.FComponent,w.FColorPicker,w.FContentContainer,w.FDatePicker,w.FDataGrid,w.FDropdown,w.FDynamicForm$1,w.FEventsEditor$1,w.FFilterBar,w.FFieldSelector,w.FBindingSelector,w.FImageCropper,w.FInputGroup$1,w.FLayout,w.FListNav,w.FListView,w.FLookup,w.FMappingEditor,w.FNav,w.FNumberRange,w.FNumberSpinner,w.FOrder,w.FPageHeader,w.FPageFooter,w.FPagination,w.FProgress,w.FQuerySolution,w.FRadioGroup,w.FRate,w.FResponseToolbar,w.FResponseLayout,w.FResponseLayoutEditorSetting,w.FSearchBox,w.FSection$1,w.FSmokeDetector,w.FSplitter,w.FStep,w.FSwitch,w.FTabs,w.FTags,w.FText,w.FTimePicker,w.FTransfer,w.FUploader,w.FVerifyDetail,w.FVideo,w.FTextArea,w.FTreeGrid,w.FFilterConditionEditor,w.FFieldset,w.FSortConditionEditor,w.FMenuLookup,w.FDrawer,w.FJsonEditor,w.FPropertyEditor,w.FExpressionEditor,w.FCodeEditor,w.FHtmlTemplate,w.FCollectionPropertyEditor,w.FModal,w.FExternalContainer,w.FLanguageTextbox,w.FImage,w.FComment))})(this,function(w,e,ie,J,fe,ln,Fe,We,Ke,sn,dn,Qe,Ge,Je,be,un,mn,fn,pn,hn,gn,vn,Ye,Xe,Cn,bn,yn,Nn,wn,Fn,Vn,Sn,xn,jn,En,Pn,Mn,Tn,kn,Ln,Bn,In,$n,Dn,qn,On,An,Rn,Un,Hn,Gn,_n,zn,Wn,Kn,Qn,Jn,Yn,Xn,Zn,et,nt,tt,ot,at,rt,it,ct,lt,st,dt,ut,mt,ft,pt,ht,gt,vt,Ct,bt,yt,Nt,wt,Ft,Vt,St,xt,jt,Et){"use strict";var Co=Object.defineProperty;var bo=(w,e,ie)=>e in w?Co(w,e,{enumerable:!0,configurable:!0,writable:!0,value:ie}):w[e]=ie;var He=(w,e,ie)=>bo(w,typeof e!="symbol"?e+"":e,ie);const Pt=new Map([["appearance",ie.resolveAppearance]]);function Mt(n,i,c){return i}const Tt={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/events-editor.schema.json",title:"events-editor",description:"A Farris Component",type:"object",properties:{id:{description:"The unique identifier for events-editor",type:"string"},type:{description:"The type events of events-editor",type:"events",default:"events-editor"},initialData:{description:"",type:"object",default:{}},viewSourceHandle:{description:"",type:"function",default:null}},required:["id","type"]},kt={title:"events-editor",description:"A Farris Component",type:"object",categories:{}},Ze=[{label:"pageChange",name:"MockMock切换页码"},{label:"pageSizeChanged",name:"Mock分页条数变化事件"},{label:"scrollYLoad",name:"Mock滚动加载事件"},{label:"onEditClicked",name:"Mock操作列点击编辑"},{label:"onDeleteClicked",name:"Mock操作列点击删除"}],_e={initialData:{type:Object,default:{propertyID:"data-grid-component-viewmodel",propertyType:"events",internalCommandList:[{controllerName:{id:"70b4abd4-9f2c-4b7c-90e9-6ac6f4b74c72",label:"ListController",name:"列表控制器"},controllerList:[{id:"93ee1cd2-cf0b-40b3-b99f-958a3d1fad1c",label:"Load",name:"Mock加载数据",handlerName:"Load"},{id:"71ae8a4c-6202-4875-9246-2e2d959da37f",label:"Search",name:"Mock查询",handlerName:"Search"},{id:"77556491-41c0-4356-8ccf-25e39817060e",label:"Add",name:"Mock添加数据",handlerName:"Add"},{id:"52fdcac3-46c8-466e-aa5d-19920ece2076",label:"View",name:"Mock查看数据",handlerName:"View"},{id:"7ade9996-0531-4401-b1bc-fb9ec8ee3f8e",label:"Edit",name:"Mock编辑数据",handlerName:"Edit"},{id:"6d5a354f-871f-43e6-82bc-7837184380d3",label:"RemoveRows",name:"Mock删除选中行",handlerName:"RemoveRows"},{id:"1a1b7c33-38f0-469f-a017-223086ee6259",label:"ChangePage",name:"Mock切换页码",handlerName:"ChangePage"},{id:"debae2dd-3387-48cf-90ba-96e74ab5a8e5",label:"Remove",name:"Mock删除指定数据",handlerName:"Remove"}]}],events:Ze,boundEventsList:[],viewModel:[],componentLists:[{componentId:"root-component",viewModelId:"root-viewmodel"},{componentId:"data-grid-component",viewModelId:"data-grid-component-viewmodel"}],allComponentList:[{componentId:"root-component",viewModelId:"root-viewmodel"},{componentId:"data-grid-component",viewModelId:"data-grid-component-viewmodel"}],newController:[],isAddControllerMethod:!1,getEventList:()=>({events:Ze,boundEventsList:[]})}},viewSourceHandle:{type:Function,default:()=>{}}},en=ie.createPropsResolver(_e,Tt,Pt,Mt,kt);function nn(){function n(c,s){const t=[{controllerId:"45be24f9-c1f7-44f7-b447-fe2ada458a61",controllerLabel:"AdvancedListCardController",controllerName:"高级列卡控制器",commands:[{name:"增加子表数据",id:"250cd2a2-9995-4c01-64aa-5029afba08ca",handlerName:"AddItem"},{name:"删除子表数据",id:"a2c06958-29b1-0582-5f3e-c3cfcc741f8f",handlerName:"RemoveItem"},{name:"插入数据",id:"3208b00c-543d-c050-3c54-081715972dda",handlerName:"Insert"},{name:"查询从表数据(分页)",id:"b60b7754-35cf-7eaa-0f1d-bc5e5d61c0bc",handlerName:"queryChild"},{name:"批量删除子表",id:"378fcd7d-ce91-c052-5947-d60ecdb38df9",handlerName:"batchDelete"},{name:"移动数据",id:"fcac5d5e-2367-2b61-a82a-f8e874e8efc0",handlerName:"move"},{name:"打开批量编辑界面",id:"8d8b05d6-2d22-b0b7-7cb8-51bbb8cd8a18",handlerName:"openBatchEditDialog"}]},{controllerId:"d7ce1ba6-49c7-4a27-805f-f78f42e72725",controllerLabel:"EditableListController",controllerName:"可编辑列表控制器",commands:[{name:"打开批量编辑界面",id:"c3831e36-27d1-1c98-dd60-30e2d7ec04d2",handlerName:"openBatchEditDialog"},{name:"加载列表数据",id:"f80e026b-bd9b-002b-d2aa-52c44a633bec",handlerName:"Load"}]},{controllerId:"8fe977a1-2b32-4f0f-a6b3-2657c4d03574",controllerLabel:"TreeCardController",controllerName:"树卡控制器",commands:[{name:"新增子表数据",id:"21b0c3af-3caf-b11d-2360-d9af20016501",handlerName:"AddItem"},{name:"删除子表数据",id:"113f1d77-65a4-63bf-3973-80dd15f294d1",handlerName:"RemoveItem"},{name:"批量删除子表",id:"bf13585c-a8f3-384b-356c-bd8bf06751c4",handlerName:"batchDelete"}]},{controllerId:"8d21e69c-70b3-44f6-88b5-fd6a8d3ce11b",controllerLabel:"PopController",controllerName:"弹出控制器",commands:[{name:"新增子表数据",id:"d6933772-8047-9bde-220b-449481883142",handlerName:"AddItem"},{name:"删除子表数据",id:"03c233eb-e39e-8e34-6809-ee4ab3a0d97c",handlerName:"RemoveItem"},{name:"加载并新增",id:"6882ab4a-9c23-8d59-6aac-de891eae20d2",handlerName:"LoadAndAdd"}]},{controllerId:"43f68561-eae4-4495-b318-d629615523f8",controllerLabel:"BatchEditCommands",controlleName:"批量编辑控制器",commands:[{name:"打开批量编辑界面",id:"a659aaba-daa4-3c07-8b26-164b01726022",handlerName:"openBatchEditDialog"},{name:"复制行",id:"d5f67e0a-767d-a238-5ad4-b1285476c16f",handlerName:"copyRow"},{name:"复制行",id:"229d2dd3-2fe7-f06a-b705-cfa0fc711614",handlerName:"clone"}]},{controllerId:"c121742e-6028-48bf-817c-1dda7fb098df",controllerLabel:"AdvancedListCardWithSidebarController",controllerName:"高级列卡控制器(侧边栏)",commands:[{name:"增加子表数据(侧边栏)",id:"250cd2a2-9995-4c01-64aa-5029afba08ca",handlerName:"AddItem"},{name:"删除子表数据(侧边栏)",id:"a2c06958-29b1-0582-5f3e-c3cfcc741f8f",handlerName:"RemoveItem"}]},{controllerId:"8172a979-2c80-4637-ace7-b13074d3f393",controllerLabel:"CardController",controllerName:"卡片控制器",commands:[{name:"新增子表数据",id:"6f987222-ebe2-0f3c-1594-a12408b22801",handlerName:"AddItem"},{name:"删除子表数据",id:"0cdeddcc-8332-f13f-be96-b5eeac84a334",handlerName:"RemoveItem"},{name:"插入数据",id:"2666b526-a1b2-f268-1629-b1b95b71c8dd",handlerName:"Insert"},{name:"打开批量编辑界面",id:"8104dd8e-bb27-a659-ff7c-a0321523f727",handlerName:"openBatchEditDialog"},{name:"新增子节点(子表树)",id:"bbd11957-de2a-c727-11d6-64788c4b0fa8",handlerName:"addSubChild"},{name:"删除子表树节点",id:"c8c9f652-ba52-3a9b-5eb9-dadd42c832cd",handlerName:"RemoveTreeItem"},{name:"批量删除子表",id:"e96857fa-1617-fd92-8a05-5c684e0819a1",handlerName:"batchDelete"}]},{controllerId:"31c1022c-ab40-4e8d-bc31-85d539f1d36c",controllerLabel:"FileController",controllerName:"文件控制器",commands:[{name:"批量删除文件数据",id:"d5bf021b-1aa4-06fe-3236-188fd218f4f7",handlerName:"removeFileRows"}]},{controllerId:"2eb7bbd1-fabd-4d0f-991d-7242f53225b1",controllerLabel:"AttachmentController",controllerName:"附件控制器",commands:[{name:"上传并更新行",id:"2a84e28f-7202-d858-1466-748a8040c1f9",handlerName:"UploadAndUpdateRow"},{name:"通过属性名上传并更新行",id:"0f98c9b8-a01b-55d4-3115-269a73f7ccff",handlerName:"uploadAndUpdateRowWithPropertyName"},{name:"移除版本附件行",id:"b441b6a7-9e13-9f75-77a2-10b2c1f7ef26",handlerName:"RemoveAttachmentItem"},{name:"上传并批量新增行",id:"e6fc25ca-853b-0b2d-76c9-a1f7a253679b",handlerName:"UploadAndBatchAddRows"},{name:"通过属性名上传并批量更新行",id:"e00b70db-9de3-8e3e-eb59-1c550a255fec",handlerName:"uploadAndBatchAddRowsWithPropertyName"}]},{controllerId:"e353b4e9-e073-4e18-b9f7-ec4cc8ac72b1",controllerLabel:"PrintService",controllerName:"打印控制器",commands:[{name:"根据数据条件批量打印",id:"774fa275-2da1-e927-e8bf-d27d9886a168",handlerName:"printMulti"}]},{controllerId:"70b4abd4-9f2c-4b7c-90e9-6ac6f4b74c72",controllerLabel:"ListController",controllerName:"列表控制器",commands:[{name:"加载数据",id:"86c9f281-e5bc-5d5c-1b86-d1e17ab2e850",handlerName:"Load"}]},{controllerId:"7c48ef46-339c-42d4-8365-a21236c63044",controllerLabel:"ListCardController",controllerName:"列卡控制器",commands:[{name:"加载列表数据",id:"e573d6a2-8261-9ad4-c9f1-2e59af53302d",handlerName:"loadList"}]},{controllerId:"26436aa8-88a7-4aee-bf0b-9843c1e8afbf",controllerLabel:"ListListController",controllerName:"双列表控制器",commands:[{name:"加载导航列表数据",id:"f7dd2c84-7abd-d4bf-6b31-71d96035c034",handlerName:"LoadNavList"}]}];let u=-1;const F=t.findIndex(b=>c===b.controllerId);return F!==-1&&(u=t[F].commands.findIndex(b=>s===b.handlerName)),u!==-1}function i(c,s,t){const u=n(c.controllerName.id,s.handlerName);return t.componentLists.length!==0&&u&&(s.hasPath=!0,s.targetComponent=s.targetComponent||t.componentLists[0].componentId,s.componentLists=J.cloneDeep(t.componentLists)),s}return{isContextDependent:n,setComponentLists:i}}var Ne=(n=>(n.Frame="frame",n.dataGrid="data-grid",n.listView="list-view",n.form="form",n.uploader="uploader",n.calendar="calendar",n.page="page",n))(Ne||{});function Lt(n,i){const c=e.inject("designerContext"),s=c&&c.dgControl?c.dgControl:ln.DgControl,t=e.ref(""),u=e.ref("");function F(o){var h,C,V,r;let f="controlIcon fd-i-Family ",y="";switch(o==null?void 0:o.type){case"form-group":{y=((h=s[o.type])==null?void 0:h.icon)||((C=o.editor)==null?void 0:C.type)||"",(V=s[o.editor.type])!=null&&V.icon&&(y=s[o.editor.type].icon);break}default:y=((r=s[o.type])==null?void 0:r.icon)||o.type}const v=`fd_pc-${y}`;return f+=v,f}function b(o,f){var h;let y=o.id;const v=f==null?void 0:f.contents;if((f==null?void 0:f.type)==="splitter"&&v&&v.length===2){const C=f.direction!=="column";o.id===((h=v[0])==null?void 0:h.id)?y=C?"左侧区域":"上方区域":y=C?"右侧区域":"下方区域"}return y}function B(o){if(o.isLikeCardContainer)return"区块";const f=o.appearance&&o.appearance.class||"",y=f.split(" ");return o.id==="page-header"&&f&&f==="f-page-header"?"页头":y.includes("f-page-header-base")?"页头容器":y.includes("f-page-header-extend")?"页头扩展容器":y.includes("f-title")?"标题容器":y.includes("f-page")?"根容器":y.includes("f-page-main")?"内容区域":y.includes("f-scrollspy-content")&&o.isScrollspyContainer?"滚动监听容器":y.includes("f-grid-is-sub")?"表格容器":y.includes("f-filter-container")?"筛选条容器":"容器"}function q(o){const{componentType:f}=o;switch(f){case Ne.Frame:return"根组件";case Ne.dataGrid:return(n==null?void 0:n.formSchemaUtils.selectNode(o,v=>v.type===(s["tree-grid"]&&s["tree-grid"].type)))?"树表格组件":"表格组件";case Ne.uploader:return"附件组件";case Ne.listView:return"列表视图组件";case Ne.form:return"卡片组件";case Ne.calendar:return"日历组件";case Ne.page:return o.name||"页面";default:return"组件"}}function N(o,f){const y=o.name||o.text||o.label||o.title||o.mainTitle;if(o.type!=="component"&&y&&typeof y=="string")return y.trim();switch(o.type){case"content-container":return B(o);case"splitter-pane":return b(o,f);case"component":return q(o);default:return s[o.type]&&s[o.type].name||o.id}}function x(o,f){const y=o.length?o[0]:null;if(!y)return;u.value="",t.value=y.originalId;const v=y?`${y.originalId}-design-item`:"",h=document.getElementById(v);h&&h.click(),i.emit("selectionChanged",y)}function m(o){if(!o)return;const f=`${o}-design-item`,y=document.getElementById(f);y&&y.click()}return{getIcon:F,getTitle:N,onChanged:x,currentSelectedNodeId:t,currentSelectedOutsideNodeId:u,triggerOutsideClick:m}}function Bt(n,i){const{getIcon:c,getTitle:s}=i;function t(N,x,m,o,f){var v;const y=(v=n.data.module)==null?void 0:v.components.find(h=>h.id===N.component);y&&u([y],x,m,o,f)}function u(N,x,m,o,f){return N.forEach(y=>{if(y.type==="component"&&(f=y.id),y.type==="component-ref"){t(y,x,m,o,f);return}const v={originalId:y.id,layer:m,originalParent:o==null?void 0:o.id,componentId:f,name:s(y,o),type:y.type,controlIcon:c(y),rawSchema:y};x.push(J.cloneDeep(v)),(y.contents||y.buttons)&&u(y.contents||y.buttons,x,m+1,y,f)}),x}function F(N){const x=[],m=N.find(v=>v.layer===0);N=N.filter(v=>v.layer!==0),x.push(m);let o=m.originalId,f=0,y=1e3;for(;N.length!==0||y===0;){const v=N.find(h=>h.originalParent===o);v?(x.push(v),o=v.originalId,N=N.filter(h=>h.originalId!==o),f=0):(f-=1,o=x.slice(f)[0].originalId),y-=1}return x}function b(N){return N.forEach((x,m)=>{x.id=(m+1).toString()}),N.forEach(x=>{var m;x.parent=((m=N.find(o=>o.originalId===x.originalParent))==null?void 0:m.id)||""}),N.forEach(x=>{x.hasChildren=N.findIndex(m=>m.parent===x.id)>0}),N}function B(N){const x={originalId:n.data.module.id,layer:0,originalParent:null,name:"页面",type:"module",controlIcon:"controlIcon fd-i-Family fd_pc-module",rawSchema:n.data.module},m=[];return N.forEach(o=>{o[0].originalParent=x.originalId,m.push(...o)}),m.unshift(x),m}function q(){const N=n.data.module?e.ref(n.data.module.components):e.ref([n.data]);if(!N.value)return;const x=[];N.value.forEach(y=>{if(y){const v=[];v.push(y);const V=u(v,[],1,null,y.id);x.push(V)}});const m=B(x),o=F(m);return b(o)}return{getData:q}}function Se(n){const i=e.inject("sourceOutlineData")||[],c=e.ref(),s=e.ref(!1),t=e.ref([]),u=e.ref();function F(v,h,C,V){var r,_,z,A;return{id:fe.useGuid().guid(),source:V||{formId:(r=v.sourceCommunication)==null?void 0:r.formId,formCode:(_=v.sourceCommunication)==null?void 0:_.formCode,componentId:(z=v.sourceCommunication)==null?void 0:z.componentId,externalContainerId:(A=v.sourceCommunication)==null?void 0:A.externalContainerId,event:h||"onCommunication"},target:{formId:(C==null?void 0:C.formId)||"",formCode:(C==null?void 0:C.formCode)||"",externalContainerId:(C==null?void 0:C.externalContainerId)||"",commandCode:(C==null?void 0:C.commandCode)||"",commandViewmodelId:(C==null?void 0:C.commandViewmodelId)||""},paramMappings:[]}}function b(v){var h,C;(h=v==null?void 0:v.communication)!=null&&h.length&&((C=v==null?void 0:v.communication)==null||C.map(V=>{var r,_;if(V!=null&&V.id&&!((r=V==null?void 0:V.source)!=null&&r.componentId)){const z=(_=n.getFormSchema().module.communications)==null?void 0:_.find(A=>A.id===(V==null?void 0:V.id));z&&Object.assign(V,z)}}))}function B(v){const h=n.getFormSchema(),{communications:C}=h.module;C||(h.module.communications=[]);const V=h.module.communications.findIndex(r=>r.id===v.id);V===-1?h.module.communications.push(v):Object.assign(h.module.communications[V],v)}function q(v){var h;if((h=v==null?void 0:v.communication)!=null&&h.length){const C=n.getFormSchema();v.communication.map(V=>{C.module.communications&&V&&(C.module.communications=C.module.communications.filter(r=>r.id!==V.id))}),v.communication=[]}}function N(v){var C;const h=n.getFormSchema();v&&((C=h.module.communications)!=null&&C.length)&&(h.module.communications=h.module.communications.filter(V=>V.id!==v))}function x(v,h,C){const V=Lt(v,h),r=n.externalFormSchema.get(C);if(r!=null&&r.content){const _={data:r.content},{getData:z}=Bt(_,V);return z()}return[]}function m(v){var C;if(!((C=v==null?void 0:v.source)!=null&&C.componentId)){s.value=!1;return}const h=i.find(V=>V.originalId===v.source.componentId);h?(s.value=!1,c.value=h):(s.value=!0,c.value={id:v.source.componentId})}function o(v){var r,_,z,A;t.value=[];const h=(r=c.value)==null?void 0:r.rawSchema;if(!h){u.value=null;return}const C=h.type==="form-group"&&h.editor?h.editor.type:h.type,V=(_=ie.schemaMap[C])==null?void 0:_.events;V&&Object.keys(V).forEach(E=>{t.value.push({eventCode:E,eventName:V[E]})}),(z=v.source)!=null&&z.event&&((A=t.value)!=null&&A.length)&&(u.value=t.value.find(E=>{var $;return E.eventCode===(($=v.source)==null?void 0:$.event)}))}function f(v){var V,r,_,z,A,E,$,l;if(!(v!=null&&v.length))return;m(v[0]),o(v[0]);let h="",C="";return s.value?h=`${((V=v[0].source)==null?void 0:V.componentId)||""}-${((r=v[0].source)==null?void 0:r.event)||""}`:(h=(_=c.value)==null?void 0:_.name,h&&((z=u.value)!=null&&z.eventName)&&(h+=`-${(A=u.value)==null?void 0:A.eventName}`),C=`${(E=c.value)==null?void 0:E.name} (${($=c.value)==null?void 0:$.originalId})`,C=`${C}
${(l=u.value)==null?void 0:l.eventName} (${u.value.eventCode})`),{title:h,titleTip:C,isControlInvalid:s.value}}function y(v){var h;if((h=v==null?void 0:v.communication)!=null&&h.length){const C=v==null?void 0:v.communication[0];return C==null?void 0:C.source}}return{createNewCommunication:F,resolveCommunication:b,clearAllCommunication:q,clearCommunicationById:N,saveCommunication:B,assembleSourceOutline:x,resolveSourceControlEventTitle:f,resolveCommunicationSource:y}}function It(n,i,c){const s=e.ref([]),{boundEvents:t,unBoundEvent:u}=i;function F(m){var f,y;return{event:{label:(f=m.boundEvents)==null?void 0:f.label,name:(y=m.boundEvents)==null?void 0:y.name},showSwitch:[{showSection:[[!1,!1,!1,!1,!1],[!1,!1,!0,!1,!1],[!1,!0,!1,!0,!1]],showSwitchNumber:2}],command:J.cloneDeep(m.command),controller:J.cloneDeep(m.controller),communication:m.communication}}function b(){var m;s.value=(m=t.value)==null?void 0:m.map(o=>F(o))}function B(m,o){const y=F({boundEvents:m,command:null,controller:{id:"",name:"",label:""},communication:o?[o]:[]});if(o){y.showSwitch[0].showSwitchNumber=2,y.showSwitch[0].showSection[2][2]=!1,y.showSwitch[0].showSection[2][3]=!1,y.needSelectCommunicationCommand=!0,s.value.unshift(y);return}m&&(y.showSwitch[0].showSwitchNumber=1,y.showSwitch[0].showSection[2][3]=!0,s.value.unshift(y))}function q(){var m;(m=s.value)==null||m.forEach(o=>{o.showSwitch.forEach(f=>{f.showSection[2][3]=!1}),o.shouldShowCommunicationPanel=!1})}function N(m){s.value[m].showSwitch.forEach(o=>{o.showSection[2][3]=!o.showSection[2][3]})}function x(m){if(m>=0&&m<=s.value.length-1){const o=s.value[m];u(o.event),s.value.splice(m,1);const{clearAllCommunication:f}=Se(n);f(o)}}return{addNewInteraction:B,collapseInteractions:q,deleteInteracton:x,toggleMethodInInteraction:N,interactions:s,loadInteractions:b}}function $t(n){const i=e.ref([]),c=e.ref([]),s=e.ref([]),{isContextDependent:t}=nn();function u(){const{allComponentList:m}=n.value;n.value.componentLists.length&&n.value.viewModel&&n.value.viewModel.forEach(o=>{o.controllerList.forEach(f=>{if(f.targetComponent){const y=m.find(h=>h.componentId===f.targetComponent);if((y?y.viewModelId:void 0)===n.value.viewModelId)f.hasPath=!1;else{const h=t(o.controllerName.id,f.handlerName);f.hasPath=h?!0:f.hasPath,f.componentLists=h?J.cloneDeep(n.value.componentLists):f.componentLists}}})}),n.value.componentLists.length&&n.value.boundEventsList&&n.value.boundEventsList.forEach(o=>{var f;if((f=o.command)!=null&&f.targetComponent){const y=m.find(h=>{var C;return h.componentId===(((C=o.command)==null?void 0:C.targetComponent)||"")});if((y?y.viewModelId:void 0)===n.value.viewModelId)o.command.hasPath=!1;else{const h=t(o.controller.id,o.command.handlerName);o.command.hasPath=h?!0:o.command.hasPath,o.command.componentLists=h?J.cloneDeep(n.value.componentLists):o.command.componentLists}}})}function F(){const m=c.value.reduce((f,y)=>(f.set(y.boundEvents.label,!0),f),new Map);return i.value.filter(f=>!m.has(f.label))}function b(){var o;const m=((o=c.value)==null?void 0:o.length)>0;s.value=m?F():i.value}function B(){u(),i.value=n.value.events,c.value=n.value.boundEventsList,b()}function q(m){s.value=s.value.filter(o=>o.label!==m.label)}function N(m){c.value=c.value.filter(o=>o.boundEvents.label!==m.label),b()}function x(){var f;const m=(f=n.value)==null?void 0:f.getEventList(),{events:o}=m;m&&(n.value.events=J.cloneDeep(o),n.value.boundEventsList=m.boundEventsList),n.value.boundEventsList&&(n.value.boundEventsList=n.value.boundEventsList.filter(function(y){return o.find(v=>v.label===y.boundEvents.label)}))}return{allEvents:i,boundEvents:c,candidateEvents:s,excludeFromCandidates:q,loadEvents:B,resetBoundEvents:x,unBoundEvent:N}}const Dt={sourceCommunication:{type:Object,default:{}}},qt={events:{type:Array,default:[]}},Ot=e.defineComponent({name:"FEventList",props:qt,emits:["click"],setup(n,i){const c=e.ref(n.events);function s(u){i.emit("click",u)}function t(u){return e.createVNode("div",{class:"f-page-events-editor-first-bound-event"},[e.createVNode("div",{onClick:()=>s(u),class:"f-page-events-editor-first-bound-event-name"},[u.name])])}return()=>e.createVNode("div",{class:"f-page-events-editor-events"},[c.value.map(u=>t(u))])}}),xe={communication:{type:Object},sourceCommunication:{type:Object,default:{}},event:{type:String,default:""}},At=e.defineComponent({name:"FSelectSourceControl",props:xe,emits:["selectSourceEvent","deleteControl"],setup(n,i){const c=e.inject("useFormSchema"),{createNewCommunication:s}=Se(c),t=e.ref();t.value=s(n);const u=e.ref([{field:"name",title:"",dataType:"string"}]),F=e.ref([]),b=e.ref(),B=e.ref(),q=e.ref(!0),N=e.ref(!1),x=e.ref([]),m=e.ref(),o=e.ref(!0),f=e.ref(!1);function y(){const E=e.inject("sourceOutlineData");F.value=E||[],B.value.updateDataSource(F.value)}function v(){var $,l,a;if(!((l=($=t.value)==null?void 0:$.source)!=null&&l.componentId)){f.value=!1;return}const E=(a=F.value)==null?void 0:a.find(d=>d.originalId===t.value.source.componentId);E?(B.value.selectItemById(E.id),f.value=!1):(f.value=!0,b.value={id:t.value.source.componentId})}function h(){var E,$,l;($=(E=t.value)==null?void 0:E.source)!=null&&$.event&&((l=x.value)!=null&&l.length)&&(m.value=x.value.find(a=>{var d,j;return a.eventCode===((j=(d=t.value)==null?void 0:d.source)==null?void 0:j.event)}))}e.onMounted(()=>{y(),v(),h(),o.value=!1});function C(){var a;x.value=[];const E=b.value.rawSchema,$=E.type==="form-group"&&E.editor?E.editor.type:E.type,l=(a=ie.schemaMap[$])==null?void 0:a.events;l&&Object.keys(l).forEach(d=>{x.value.push({eventCode:d,eventName:l[d]})})}function V(E){q.value=!1,f.value=!1;const $=b.value!==E[0];$&&(b.value=E[0],C()),o.value||(N.value=!0),!o.value&&$&&(m.value=null)}const r=e.computed(()=>({"item-list":!0,"d-none":!q.value})),_=e.computed(()=>E=>{var $;return{item:!0,selected:(($=m.value)==null?void 0:$.eventCode)===E}});function z(E){var $;q.value=!1,N.value=!1,m.value=E,t.value.source.componentId=b.value.rawSchema.id,t.value.source.event=($=m.value)==null?void 0:$.eventCode,i.emit("selectSourceEvent",t.value)}const A=e.computed(()=>({"form-container":!0,"position-relative":!0,invalid:f.value}));return()=>e.createVNode("div",{class:A.value},[e.createVNode("div",{class:r.value,style:"min-height:220px;"},[e.createVNode("span",{class:"tip"},[e.createTextVNode("请选择源控件")]),e.createVNode(We.FTreeView,{ref:B,data:F.value,columns:u.value,columnOption:{fitColumns:!0,fitMode:"expand"},showTreeNodeIcons:!0,fit:!0,iconField:"controlIcon",onSelectionChange:V},null)]),N.value&&e.createVNode(e.Fragment,null,[e.createVNode("div",{class:"item-list"},[e.createVNode("span",{class:"tip"},[e.createTextVNode("请选择事件")]),x.value.map(E=>e.createVNode("span",{class:_.value(E.eventCode),onClick:()=>z(E)},[E.eventName]))])])])}}),Rt=e.defineComponent({name:"FInteractionButton",props:Dt,emits:["clickEventItem","selectSourceControl"],setup(n,i){const c=new Fe.FNotifyService,s=e.inject("useEventsComposition"),t=e.inject("useInteractionCompostion"),{candidateEvents:u}=s,{collapseInteractions:F}=t,b=e.ref(!1),B=e.ref(!1);function q(f){u.value=u.value.filter(y=>y.label!==f.label)}function N(){var f;(f=n.sourceCommunication)!=null&&f.needSelectSourceControl?B.value=!B.value:b.value=!b.value}function x(f){N(),q(f),i.emit("clickEventItem",f)}function m(){var f;if(!((f=n.sourceCommunication)!=null&&f.needSelectSourceControl)&&u.value.length===0){c.info({position:"top-center",message:"事件已全部绑定"});return}F(),N()}function o(f){B.value=!1,i.emit("selectSourceControl",f)}return()=>e.createVNode(e.Fragment,null,[e.createVNode("div",{class:"f-page-events-editor-top-button"},[e.createVNode("button",{class:"f-page-events-editor-button",onClick:m},[e.createVNode("span",{class:"f-page-events-editor-text"},[e.createTextVNode("新建交互事件")])])]),b.value&&e.createVNode(Ot,{events:u.value,onClick:x},null),B.value&&e.createVNode(At,{sourceCommunication:n.sourceCommunication,onSelectSourceEvent:o},null)])}}),Ut={collapsed:{type:Boolean,default:!0},displayOrder:{type:Number,default:-1},interaction:{type:Object,default:{}},controllers:{type:Array,default:[]},sourceCommunication:{type:Object,default:{}},viewSourceHandle:{type:Function,default:()=>{}},haveBoundCommand:{Type:Boolean,default:!1}},Ht={newImport:{Type:Boolean,default:!1},addInternalCommandList:{Type:Array,default:[]},outerLayerValue:{Type:Number,default:0},exit:{Type:Number,default:-1},haveBoundCommand:{Type:Boolean,default:!1},controllers:{type:Array,default:[]},iteractionDisplayOrder:{Type:Number,default:0},event:{Type:Object},sourceCommunication:{type:Object,default:{}}},Gt={controllers:{type:Array,default:[]}},_t=e.defineComponent({name:"FCommandList",props:Gt,emits:["selectMethod"],setup(n,i){function c(b){return b.controllerList.length!==0}function s(b){return c(b)&&e.createVNode("div",{class:"f-page-internals-controller"},[e.createVNode("div",{class:"f-page-internals-controller-name",title:b.controllerName.name},[b.controllerName.name])])}function t(b,B){i.emit("selectMethod",{method:b,controller:B})}function u(b){return b.controllerList.map(B=>e.createVNode("div",{class:"f-page-internals-command",onClick:()=>t(B,b)},[e.createVNode("div",{class:"f-page-internals-command-name",title:B.label},[B.name])]))}function F(b){return e.createVNode("div",null,[s(b),u(b)])}return()=>e.createVNode("div",{class:"f-page-internals"},[n.controllers.map(b=>F(b))])}}),zt={getEventPath:{type:Function,default:null},notifyService:{type:Object},useFormSchema:{type:Object},sourceCommunication:{type:Object,default:{}},event:{Type:Object}},Wt=e.defineComponent({name:"FBoundEventSelector",props:zt,emits:["cancel","submit"],setup(n,i){var S,R;const c=e.ref(),s=e.ref([]),t=e.ref('<i class="f-icon f-icon-search"></i>'),u=n.useFormSchema.getFormMetadataBasicInfo(),F=e.ref(""),b=e.ref(),B=((S=n.sourceCommunication)==null?void 0:S.unSupportedEventCodes)||[],q=e.ref(!B.includes(n.event.label)&&((R=n.useFormSchema.externalFormSchema)==null?void 0:R.size)>0),N=e.ref(),x=e.ref([]);e.onBeforeMount(()=>{if(n.getEventPath){const g=n.getEventPath();c.value=g.viewModelDisplay;const{actionWithPath:I}=g;I.forEach(O=>{O.sourceComponent.map.forEach(W=>{W.active=!1,W.hide=!1})}),s.value=J.cloneDeep(I)}});function m(g=""){g=g.replace(/ /g,"").replace(/>/g,"").toLowerCase(),g===""&&(g=" "),s.value.forEach(I=>{const O=I.path;I.sourceComponent.map.forEach(W=>{const X=W.command.name,re=W.event.name,M=W.command.label;`${O}${X}${re}${M}`.toLowerCase().includes(g)?W.hide=!1:W.hide=!0})})}function o(g=""){g=g.replace(/ /g,"").replace(/>/g,"").toLowerCase(),x.value.forEach(I=>{if(!I.isCommandNode)return;const O=I.name||"",W=I.code||"",X=I.viewmodelName||"",re=`${O}${W}${X}`.toLowerCase();g&&!re.includes(g)?I.hide=!0:I.hide=!1})}function f(g=""){!N.value||N.value.id===u.id?m(g):o(g)}function y(){const g=e.createVNode("div",{class:"f-vm-search"},[e.createVNode("div",{class:"f-vm-searchBar"},[e.createVNode(dn,{updateOn:"change",groupText:t.value,modelValue:F.value,"onUpdate:modelValue":I=>F.value=I,onChange:f,placeholder:"请输入名称/编号/路径搜索"},null)])]);return q.value?e.createVNode("div",{class:"f-navSelector-header"},[e.createVNode("div",{class:"f-navSelector-recommand"},[e.createVNode("div",{class:"f-navSelector-recommand-text"},[e.createTextVNode("方法列表")])]),e.createVNode("div",{class:"f-navSelector-remainder"},[e.createVNode("div",{class:"f-vm-search"},[g])])]):g}function v(g){return{"f-vm-item":!0,"f-vm-item-focus":g.active}}function h(g,I){let O=0;s.value.forEach(W=>{W.sourceComponent.map.forEach(X=>{!X.command.isInvalid&&g.controller.id===X.controller.id&&g.command.id===X.command.id&&g.event.label===X.event.label&&I.sourceComponent.id===W.sourceComponent.id?(g.active=!g.active,b.value=J.cloneDeep(g)):(X.command.isInvalid&&g.controller.id===X.controller.id&&g.command.id===X.command.id&&g.event.label===X.event.label&&I.sourceComponent.id===W.sourceComponent.id&&(O++,O===1&&(new Fe.FNotifyService().info({position:"top-center",message:"该方法已失效"}),b.value=null)),X.active=!1)})})}function C(g){return{"f-event-func":!g.command.isInvalid,"f-event-func-invalid":g.command.isInvalid}}function V(g){return g.sourceComponent.map.filter(I=>!I.hide).map(I=>{if(!I.command.isInvalid)return e.createVNode("div",{class:v(I),onClick:()=>h(I,g)},[e.createVNode("div",{class:"f-event-commandItem"},[e.createVNode("div",{class:"f-icon-command"},[e.createVNode("div",{class:"f-icon f-icon-source-code",style:"font-size:10px;color:#30B471;"},[e.createTextVNode(" ")])]),e.createVNode("div",{class:C(I)},[I.command.name,e.createTextVNode("("),I.command.label,e.createTextVNode(")")])]),e.createVNode("div",{class:"f-event-path"},[g.path,I.event.name])])})}function r(){return s.value.length>0?e.createVNode("div",{class:"f-vm-viewModel flex-fill"},[s.value.map(g=>V(g))]):e.createVNode("div",{class:"f-list-view-emptydata",style:"height: 360px;position: relative;"},[e.createVNode("div",{class:"f-datagrid-norecords"},[e.createVNode("div",{class:"f-datagrid-norecords-content"},[e.createTextVNode(" 暂无数据")])])])}function _(){i.emit("cancel")}function z(){if(!b.value){n.notifyService.info({position:"top-center",message:"请选择需要绑定的方法"});return}i.emit("submit",{selectedCommand:b.value,selectedForm:N.value})}function A(){const g=n.useFormSchema.externalFormSchema,I=[];return I.push({containerId:"",id:u.id,code:u.code,name:u.name}),Array.from(g.keys()).forEach(O=>{const W=g.get(O);I.push({containerId:O,id:W.id,code:W.code,name:W.name})}),I}const E=e.computed(()=>({"f-vm-all":!0," h-100":!0,"has-page-list":q.value}));function $(g){var X,re;const{viewmodels:I,components:O}=g.module;if((I==null?void 0:I.length)===0||(O==null?void 0:O.length)===0)return[];x.value=[];const W=(re=(X=n.sourceCommunication)==null?void 0:X.parameterData)==null?void 0:re.getViewModelName;I.forEach(M=>{if(!M||!M.commands||M.commands.length===0)return[];const Z=O.find(ge=>ge.viewModel===M.id),ne=W&&Z?W(Z,M.name,g):"";x.value.push({id:M.id,code:M.code,name:ne||M.name}),M.commands.forEach(ge=>{ge.isInvalid||x.value.push({...ge,viewmodelId:M.id,viewmodelName:ne||M.name,isCommandNode:!0})})})}function l(g){var I,O,W;if(!(g.id===N.value.id&&g.containerId===N.value.containerId))if(N.value=g,F.value="",b.value=null,N.value.id!==u.id){const X=(O=n.useFormSchema.externalFormSchema)==null?void 0:O.get((I=N.value)==null?void 0:I.containerId);(W=X==null?void 0:X.content)!=null&&W.module&&$(X.content)}else s.value.map(X=>{X.sourceComponent.map.map(re=>{re.hide=!1,re.active=!1})})}function a(){const g=A();N.value||(N.value=g[0]);const I=e.computed(()=>O=>{var W;return{"f-list-view-group-item":!0,"f-listview-active":O.id===((W=N.value)==null?void 0:W.id)&&O.containerId===N.value.containerId}});return e.createVNode("div",{class:"f-page-nav"},[e.createVNode("div",{class:"f-list-view"},[e.createVNode("div",{class:"f-list-view-content"},[e.createVNode("ul",{class:"f-list-view-group",style:"list-style: none;"},[g.map(O=>{let W=O.name;return O.containerId&&(W+=`, 所属外部容器:${O.containerId}`),e.createVNode("li",{class:I.value(O),onClick:()=>l(O)},[e.createVNode("div",{class:"f-list-content"},[e.createVNode("div",{class:"f-navSelector-leftCategory",title:W},[O.name])])])})])])])])}function d(g){x.value.map(I=>I.active=!1),g.active=!0,b.value=g}function j(){return e.createVNode("div",{class:"f-vm-viewModel flex-fill"},[x.value.filter(g=>!g.hide).map(g=>{if(g.isCommandNode)return e.createVNode("div",{class:v(g),onClick:()=>d(g)},[e.createVNode("div",{class:"f-event-commandItem"},[e.createVNode("div",{class:"f-icon-command"},[e.createVNode("div",{class:"f-icon f-icon-source-code",style:"font-size: 10px; color: rgb(48, 180, 113);"},null)]),e.createVNode("div",{class:"f-event-func"},[g.name,e.createTextVNode("("),g.code,e.createTextVNode(")")])]),e.createVNode("div",{class:"f-event-path"},[g.viewmodelName])])})])}return()=>e.createVNode("div",{class:E.value},[e.createVNode("div",{class:"d-flex f-utils-fill-flex-row splitter"},[q.value?a():"",e.createVNode("div",{class:"f-utils-fill-flex-column"},[y(),!N.value||N.value.id===u.id?r():j()])]),e.createVNode("div",{class:"modal-footer"},[e.createVNode("button",{type:"button",class:"btn btn-secondary",onClick:_},[e.createTextVNode("取消")]),e.createVNode("button",{type:"button",class:"btn btn-primary",onClick:z},[e.createTextVNode("确定")])])])}}),Kt=e.defineComponent({name:"FCommandSource",props:Ht,emits:["addInternalCommandListChanged","newImportChanged","selectBoundMethod","click","existChanged","newFunctionChanged","close","selectMethod","addCommunication"],setup(n,i){const c=e.inject("useMethodsComposition"),s=e.inject("useFormCommand"),t=new Fe.FNotifyService,{checkIfNewControllerExists:u,addNewController:F}=c,b=e.ref(n.controllers),B=e.inject("useFormSchema"),q=e.inject(sn.F_MODAL_SERVICE_TOKEN);let N,x;const m=e.ref(!1);e.onMounted(()=>{m.value=B.externalFormSchema.size>0});function o(d,j,S){if(F(d),d.Commands){const R=s.getInternalControllerFromControllerMetadata(d,j,S);u(R)&&t.info({position:"top-center",message:"该控制器已存在"})}}async function f(d){s.getSupportedControllerMetadata(d).then(j=>{j&&o(j.controller,j.code,j.nameSpace)}).finally(()=>{N&&N.destroy&&N.destroy()})}function y(d){N&&N.destroy&&N.destroy()}function v(){const d={formBasicInfo:B==null?void 0:B.getFormMetadataBasicInfo()};return e.createVNode(Ke.FSchemaSelector,{injectSymbolToken:fe.ControllerSchemaRepositorySymbol,"view-type":"NavList",editorParams:d,showFooter:!0,onCancel:y,onSubmit:f},null)}function h(){N=q.open({title:"选择控制器",width:950,render:v,showButtons:!1})}function C(){i.emit("newFunctionChanged")}function V(){x&&x.destroy&&x.destroy()}function r(d){const{selectedCommand:j,selectedForm:S}=d;!S||(S==null?void 0:S.id)===B.getFormMetadataBasicInfo().id?(c.selectBoundCommand(j,n.iteractionDisplayOrder),i.emit("selectBoundMethod")):i.emit("addCommunication",d),V()}function _(){const{getEventPath:d}=c;return e.createVNode(Wt,{getEventPath:d,notifyService:t,useFormSchema:B,sourceCommunication:n.sourceCommunication,event:n.event,onCancel:V,onSubmit:r},null)}function z(){x=q.open({title:"已有方法",width:950,height:500,fitContent:!1,render:_,showButtons:!1,enableEsc:!1,draggable:!0})}function A(){i.emit("close",null)}function E(){return e.createVNode("div",{class:"f-command-breakline"},[e.createTextVNode("------------------------------------------------------------")])}function $(){return e.createVNode("div",{class:"f-page-internals-new-command"},[e.createVNode("div",{class:"f-page-internals-new-command-func1"},[e.createVNode("div",{class:"f-icon f-icon-panel-retraction"},null),e.createVNode("div",{class:"f-function-class",onClick:()=>h()},[e.createTextVNode("引入控制器")])]),e.createVNode("div",{class:"f-page-internals-new-command-func2"},[e.createVNode("div",{class:"f-icon f-icon-new-edit"},null),e.createVNode("div",{class:"f-function-class",onClick:()=>C()},[e.createTextVNode("添加新方法")])]),(n.haveBoundCommand||m.value)&&e.createVNode("div",{class:"f-page-internals-new-command-func3"},[e.createVNode("div",{class:"f-icon f-icon-licensed"},null),e.createVNode("div",{class:"f-function-class",onClick:()=>z()},[e.createTextVNode("已有方法")])])])}function l(d){i.emit("selectMethod",d)}function a(){return e.createVNode("div",{class:"f-page-command-source-choice"},[e.createVNode(_t,{controllers:b.value,onSelectMethod:l},null)])}return()=>e.createVNode("div",{class:"f-page-events-editor-command-source"},[a(),E(),$(),E(),e.createVNode("div",null,[e.createVNode("div",{class:"f-page-internals-close",onClick:A},[e.createTextVNode("取消")])])])}}),Qt={command:{type:Object,default:{}},showParameter:{type:Boolean,default:!1},controller:{type:Object,default:{}},showDeleteIcon:{type:Boolean,default:!1}},Jt=e.defineComponent({name:"FParameterEditor",props:Qt,emits:["confirm","change","targetChange","viewSource","deleteCommand"],setup(n,i){const c=new Fe.FNotifyService,s=e.inject("FMessageBoxService"),t=e.ref(J.cloneDeep(n.command)),u=e.ref(n.controller),F=e.ref(0),b=e.computed(()=>t.value.id==="abandoned"),B=e.computed(()=>t.value.id==="deleted"),q=e.computed(()=>n.showDeleteIcon),N=e.computed(()=>t.value!==null),x=e.inject("useMethodsComposition"),m=e.ref(n.showParameter),o=e.inject("useFormSchema"),f=e.computed(()=>t.value.componentLists&&t.value.hasPath),y=e.computed(()=>{const M=t.value.id!=="abandoned"&&t.value.id!=="deleted",Z=f.value,ne=t.value.property&&t.value.property.length>0;return M&&(Z||ne)});function v(){const{targetComponent:M}=t.value;let Z="";return t.value.componentLists&&t.value.componentLists.forEach(ne=>{if(ne.componentId===M){Z=ne.viewModelId;return}}),Z}const h=e.ref(v()),C=e.computed(()=>t.value.targetComponent||"");function V(){c.info({position:"top-center",message:"方法已被移除,请重新绑定"})}function r(){return e.createVNode("div",{title:"方法已被移除,请重新绑定",class:"f-icon f-icon-flowline-warning text-danger text-center ",style:"font-size: 13px;margin-right:10px;width: 30px;height: 20px;",onClick:()=>V()},null)}function _(){c.info({position:"top-center",message:"方法已失效,请重新绑定"})}function z(){return e.createVNode("div",{title:"'方法已被删除,请绑定其他方法'",class:"f-icon f-icon-flowline-warning text-danger text-center ",style:"font-size: 13px;margin-right:10px;width: 30px;height: 20px;",onClick:()=>_()},null)}function A(M){m.value=!m.value}function E(){return e.createVNode("div",{class:"f-icon f-icon-edit-button",style:"font-size: 13px;margin-right:10px;",onClick:()=>A(F.value)},null)}function $(M,Z){t.value.targetComponent=M[0].componentId,i.emit("targetChange",t.value)}function l(){const M=e.reactive({content:"将此方法添加到指定的组件",placement:"top"});return e.createVNode("div",null,[e.createVNode("div",{class:"f-page-parameter-editor-targetComponent"},[e.createVNode("div",{class:"f-page-parameter-editor-targetComponent-topic"},[e.createTextVNode("挂载到目标组件"),e.withDirectives(e.createVNode("span",{class:"farris-label-tips ml-2"},[e.createVNode("i",{class:"f-icon f-icon-description-tips"},null)]),[[e.resolveDirective("tooltip"),M]])]),e.createVNode("div",{class:"f-page-parameter-editor-targetComponent-dropdown"},[e.createVNode(Qe,{modelValue:h.value,"onUpdate:modelValue":Z=>h.value=Z,enableClear:!1,idField:"viewModelId",valueField:"viewModelId",textField:"componentId",data:t.value.componentLists,editable:!1,onChange:$},null)])])])}function a(M,Z){Z.value=M}function d(){i.emit("change",t.value)}function j(){let M="";return C.value?M=o.getViewModelIdByComponentId(C.value):M=x.getViewModeId(),M}function S(M,Z){var pe,ue,te,ce,se,me,P,G,Q,Y,oe,le,he,ve,Ce,De,qe,Oe,we,Ae,Re;const ne=j(),Ee=o.getViewModelById(ne).commands.find(ae=>{var ye;return(ae==null?void 0:ae.id)===((ye=n.command)==null?void 0:ye.id)}),Pe=e.reactive(M.context.data),{assembleSchemaFieldsByComponent:Me,assembleOutline:Te,assembleStateVariables:p,assembleSchemaFieldsUnderBoundEntity:U,getEditor:H}=M.context.generalData,{designerMode:K}=o,ee=ae=>{a(ae,M),d()},de=ae=>{var ye,ke,Ve,Ue;return((Ue=(Ve=(ke=(ye=M==null?void 0:M.origin)==null?void 0:ye.controlSource)==null?void 0:ke.context)==null?void 0:Ve.data)==null?void 0:Ue.value)===":Entity"||ae.raw.children&&ae.raw.children.length&&(ae.disabled=!0),ae};return e.createVNode(Ge,{readonly:K==="PC_RTC"&&!Z.isRtcCommand,defaultValue:M==null?void 0:M.origin.defaultValue,modelValue:M.value,"onUpdate:modelValue":ae=>M.value=ae,data:Pe,editor:H(M.value,M,Ee,ne,ee),fieldData:Me(),formData:Te(),varData:p(),activeViewModelFieldData:U(C.value),editorControlSource:(pe=M==null?void 0:M.origin)==null?void 0:pe.controlSource,customRowStatus:de,idField:((se=(ce=(te=(ue=M==null?void 0:M.origin)==null?void 0:ue.controlSource)==null?void 0:te.context)==null?void 0:ce.data)==null?void 0:se.value)===":Entity"?"bindTo":((Q=(G=(P=(me=M==null?void 0:M.origin)==null?void 0:me.controlSource)==null?void 0:P.context)==null?void 0:G.valueField)==null?void 0:Q.value)||((he=(le=(oe=(Y=M==null?void 0:M.origin)==null?void 0:Y.controlSource)==null?void 0:oe.context)==null?void 0:le.idField)==null?void 0:he.value)||"id",textField:((qe=(De=(Ce=(ve=M==null?void 0:M.origin)==null?void 0:ve.controlSource)==null?void 0:Ce.context)==null?void 0:De.textField)==null?void 0:qe.value)||"label",editable:(Re=(Ae=(we=(Oe=M==null?void 0:M.origin)==null?void 0:Oe.controlSource)==null?void 0:we.context)==null?void 0:Ae.editable)==null?void 0:Re.value,onConfirm:ae=>{a(ae,M),d()},onValueChange:ae=>{var ye,ke;if(((ye=M.origin)==null?void 0:ye.Code)==="lookupId"){const Ve=(ke=t.value.property)==null?void 0:ke.find(Ue=>Ue.name==="mappingFields");Ve&&Ve.value&&(Ve.value="")}a(ae,M),d()}},null)}function R(){var M;return(M=t.value.property)==null?void 0:M.map((Z,ne)=>{const ge=e.reactive({content:Z.description,placement:"top"});return e.createVNode("div",{key:Z.name+ne},[e.createVNode("div",{class:"f-page-parameter-editor-row1"},[e.createVNode("div",{class:"f-page-parameter-editor-parameter-name"},[Z.shownName,Z.description&&e.withDirectives(e.createVNode("div",{class:"ml-2 farris-label-tips"},[e.createVNode("i",{class:"f-icon f-icon-description-tips"},null)]),[[e.resolveDirective("tooltip"),ge]])])]),e.createVNode("div",{class:"f-page-parameter-editor-row2"},[S(Z,t.value)])])})}function g(){return e.createVNode("div",{class:"f-page-parameter-editor-group"},[f.value&&l(),R()])}function I(M){M.stopPropagation(),i.emit("viewSource",{command:t.value,event:M})}function O(){s.question(`确定删除命令【${t.value.name}】吗?`,"",()=>{i.emit("deleteCommand")})}function W(){return e.createVNode("div",{class:"f-icon f-icon-yxs_delete",title:"删除命令",onClick:M=>O()},null)}const X=e.computed(()=>{var M;return{cursor:b.value||u.value.isCommon||((M=u.value)==null?void 0:M.label.indexOf(o==null?void 0:o.getModule().code))===-1?"default":"pointer"}});function re(){return e.createVNode("div",null,[e.createVNode("div",{class:"f-page-parameter-editor-first-row"},[e.createVNode("span",{class:"f-page-parameter-editor-command-name",style:X.value,title:t.value.label,onDblclick:I},[t.value.name]),e.createVNode("div",{class:"f-page-parameter-editor-first-row-icon"},[b.value&&r(),B.value&&z(),y.value&&E(),q.value&&W()])]),m.value&&g()])}return()=>e.createVNode("div",{class:"f-page-parameter-editor"},[N.value&&re()])}}),Yt="root-viewmodel";class Xt{constructor(i,c){He(this,"formSchemaUtils");He(this,"controlCreatorUtils");He(this,"designViewModelUtils");this.resolver=i,this.designerHostService=c,this.formSchemaUtils=this.designerHostService.formSchemaUtils,this.controlCreatorUtils=this.designerHostService.controlCreatorUtils,this.designViewModelUtils=this.designerHostService.designViewModelUtils}createComponent(i){const c=this.createComponentRefNode(i),s=this.createComponentNode(i),t=this.createViewModeNode(i),u=this.formSchemaUtils.getFormSchema();return u.module.viewmodels.push(t),u.module.components.push(s),this.designViewModelUtils.assembleDesignViewModel(),c}createComponentRefNode(i){const c=this.resolver.getSchemaByType("component-ref");return Object.assign(c,{id:`${i.componentId}-c