UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

2 lines (1 loc) 34.8 kB
(function(k,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("lodash-es"),require("../notify/index.umd.js"),require("../schema-selector/index.umd.js"),require("../modal/index.umd.js"),require("../common/index.umd.js"),require("../combo-list/index.umd.js"),require("../event-parameter/index.umd.js")):typeof define=="function"&&define.amd?define(["exports","vue","lodash-es","../notify/index.umd.js","../schema-selector/index.umd.js","../modal/index.umd.js","../common/index.umd.js","../combo-list/index.umd.js","../event-parameter/index.umd.js"],e):(k=typeof globalThis<"u"?globalThis:k||self,e(k["events-editor"]={},k.Vue,k.LodashES,k.notify,k.schemaSelector,k.modal,k.common,k.ComboList,k.FEventParameter))})(this,function(k,e,M,X,ge,Ne,ee,Ce,Se){"use strict";const ne={},te={};function Z(n){const{properties:t,title:c,ignore:o}=n,l=o&&Array.isArray(o),i=Object.keys(t).reduce((h,m)=>((!l||!o.find(S=>S===m))&&(h[m]=t[m].type==="object"&&t[m].properties?Z(t[m]):M.cloneDeep(t[m].default)),h),{});if(c&&(!l||!o.find(h=>h==="id"))){const h=c.toLowerCase().replace(/-/g,"_");i.id=`${h}_${Math.random().toString().slice(2,6)}`}return i}function Me(n){const{properties:t,title:c,required:o}=n;if(o&&Array.isArray(o)){const l=o.reduce((i,h)=>(i[h]=t[h].type==="object"&&t[h].properties?Z(t[h]):M.cloneDeep(t[h].default),i),{});if(c&&o.find(i=>i==="id")){const i=c.toLowerCase().replace(/-/g,"_");l.id=`${i}_${Math.random().toString().slice(2,6)}`}return l}return{type:c}}function oe(n,t={},c){const o=ne[n];if(o){let l=Me(o);const i=te[n];return l=i?i({getSchemaByType:oe},l,t,c):l,l}return null}function Ve(n,t){const c=Z(t);return Object.keys(c).reduce((o,l)=>(Object.prototype.hasOwnProperty.call(n,l)&&(o[l]&&M.isPlainObject(o[l])&&M.isPlainObject(n[l]||!n[l])?Object.assign(o[l],n[l]||{}):o[l]=n[l]),o),c),c}function ae(n,t){return Object.keys(n).filter(o=>n[o]!=null).reduce((o,l)=>{if(t.has(l)){const i=t.get(l);if(typeof i=="string")o[i]=n[l];else{const h=i(l,n[l],n);Object.assign(o,h)}}else o[l]=n[l];return o},{})}function Ee(n,t,c=new Map){const o=Ve(n,t);return ae(o,c)}function Le(n={}){function t(u,b,s,a){if(typeof s=="number")return a[u].length===s;if(typeof s=="object"){const d=Object.keys(s)[0],v=s[d];if(d==="not")return Number(a[u].length)!==Number(v);if(d==="moreThan")return Number(a[u].length)>=Number(v);if(d==="lessThan")return Number(a[u].length)<=Number(v)}return!1}function c(u,b,s,a){return a[u]&&a[u].propertyValue&&String(a[u].propertyValue.value)===String(s)}const o=new Map([["length",t],["getProperty",c]]);Object.keys(n).reduce((u,b)=>(u.set(b,n[b]),u),o);function l(u,b){const s=u;return typeof b=="number"?[{target:s,operator:"length",param:null,value:Number(b)}]:typeof b=="boolean"?[{target:s,operator:"getProperty",param:u,value:!!b}]:typeof b=="object"?Object.keys(b).map(a=>{if(a==="length")return{target:s,operator:"length",param:null,value:b[a]};const d=a,v=b[a];return{target:s,operator:"getProperty",param:d,value:v}}):[]}function i(u){return Object.keys(u).reduce((s,a)=>{const d=l(a,u[a]);return s.push(...d),s},[])}function h(u,b){if(o.has(u.operator)){const s=o.get(u.operator);return s&&s(u.target,u.param,u.value,b)||!1}return!1}function m(u,b){return i(u).reduce((d,v)=>d&&h(v,b),!0)}function S(u,b){const s=Object.keys(u),a=s.includes("allOf"),d=s.includes("anyOf"),v=a||d,V=(v?u[v?a?"allOf":"anyOf":"allOf"]:[u]).map(L=>m(L,b));return a?!V.includes(!1):V.includes(!0)}return{parseValueSchema:S}}const ye={},Be={};Le();function Fe(n,t,c=new Map,o=(h,m,S,u)=>m,l={},i=h=>h){return ne[t.title]=t,te[t.title]=o,ye[t.title]=l,Be[t.title]=i,(h={},m=!0)=>{if(!m)return ae(h,c);const S=Ee(h,t,c),u=Object.keys(n).reduce((b,s)=>(b[s]=n[s].default,b),{});return Object.assign(u,S)}}function Pe(n,t){return{customClass:t.class,customStyle:t.style}}const ke=new Map([["appearance",Pe]]);function Ae(n,t,c){return t}const De={$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:{}}},required:["id","type"]},Te={title:"events-editor",description:"A Farris Component",type:"object",categories:{}},re=[{label:"pageChange",name:"MockMock切换页码"},{label:"pageSizeChanged",name:"Mock分页条数变化事件"},{label:"scrollYLoad",name:"Mock滚动加载事件"},{label:"onEditClicked",name:"Mock操作列点击编辑"},{label:"onDeleteClicked",name:"Mock操作列点击删除"}],U={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:re,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:re,boundEventsList:[]})}}},K=Fe(U,De,ke,Ae,Te);function ce(){function n(c,o){const l=[{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"}]},{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"}]}];let i=-1;const h=l.findIndex(m=>c===m.controllerId);return h!==-1&&(i=l[h].commands.findIndex(m=>o===m.handlerName)),i!==-1}function t(c,o,l){const i=n(c.controllerName.id,o.handlerName);return l.componentLists.length!==0&&i&&(o.hasPath=!0,o.targetComponent=o.targetComponent||l.componentLists[0].componentId,o.componentLists=M.cloneDeep(l.componentLists)),o}return{isContextDependent:n,setComponentLists:t}}function le(n,t){const c=e.ref([]),{boundEvents:o,unBoundEvent:l}=t;function i(s){return{event:{label:s.boundEvents.label,name:s.boundEvents.name},showSwitch:[{showSection:[[!1,!1,!1,!1,!1],[!1,!1,!0,!1,!1],[!1,!0,!1,!0,!1]],showSwitchNumber:2}],command:M.cloneDeep(s.command),controller:M.cloneDeep(s.controller)}}function h(){var s;c.value=(s=o.value)==null?void 0:s.map(a=>i(a))}function m(s){const d=i({boundEvents:s,command:null,controller:{id:"",name:"",label:""}});d.showSwitch[0].showSwitchNumber=1,d.showSwitch[0].showSection[2][3]=!0,c.value.unshift(d)}function S(){var s;(s=c.value)==null||s.forEach(a=>{a.showSwitch.forEach(d=>{d.showSection[2][3]=!1})})}function u(s){c.value[s].showSwitch.forEach(a=>{a.showSection[2][3]=!a.showSection[2][3]})}function b(s){if(s>=0&&s<=c.value.length-1){const a=c.value[s];l(a.event),c.value.splice(s,1)}}return{addNewInteraction:m,collapseInteractions:S,deleteInteracton:b,toggleMethodInInteraction:u,interactions:c,loadInteractions:h}}function se(n){const t=e.ref([]),c=e.ref([]),o=e.ref([]),{isContextDependent:l}=ce();function i(){const{allComponentList:a}=n.value;n.value.componentLists.length&&n.value.viewModel&&n.value.viewModel.forEach(d=>{d.controllerList.forEach(v=>{if(v.targetComponent){const g=a.find(V=>V.componentId===v.targetComponent);if((g?g.viewModelId:void 0)===n.value.viewModelId)v.hasPath=!1;else{const V=l(d.controllerName.id,v.handlerName);v.hasPath=V?!0:v.hasPath,v.componentLists=V?M.cloneDeep(n.value.componentLists):v.componentLists}}})}),n.value.componentLists.length&&n.value.boundEventsList&&n.value.boundEventsList.forEach(d=>{var v;if((v=d.command)!=null&&v.targetComponent){const g=a.find(V=>{var A;return V.componentId===(((A=d.command)==null?void 0:A.targetComponent)||"")});if((g?g.viewModelId:void 0)===n.value.viewModelId)d.command.hasPath=!1;else{const V=l(d.controller.id,d.command.handlerName);d.command.hasPath=V?!0:d.command.hasPath,d.command.componentLists=V?M.cloneDeep(n.value.componentLists):d.command.componentLists}}})}function h(){const a=c.value.reduce((v,g)=>(v.set(g.boundEvents.label,!0),v),new Map);return t.value.filter(v=>!a.has(v.label))}function m(){var d;const a=((d=c.value)==null?void 0:d.length)>0;o.value=a?h():t.value}function S(){i(),t.value=n.value.events,c.value=n.value.boundEventsList,m()}function u(a){o.value=o.value.filter(d=>d.label!==a.label)}function b(a){c.value=c.value.filter(d=>d.boundEvents.label!==a.label),m()}function s(){var v;const a=(v=n.value)==null?void 0:v.getEventList(),{events:d}=a;a&&(n.value.events=M.cloneDeep(d),n.value.boundEventsList=a.boundEventsList),n.value.boundEventsList&&(n.value.boundEventsList=n.value.boundEventsList.filter(function(g){return d.find(F=>F.label===g.boundEvents.label)}))}return{allEvents:t,boundEvents:c,candidateEvents:o,excludeFromCandidates:u,loadEvents:S,resetBoundEvents:s,unBoundEvent:b}}const je={},Oe={events:{type:Array,default:[]}},Re=e.defineComponent({name:"FEventList",props:Oe,emits:["click"],setup(n,t){const c=e.ref(n.events);function o(i){t.emit("click",i)}function l(i){return e.createVNode("div",{class:"f-page-events-editor-first-bound-event"},[e.createVNode("div",{onClick:()=>o(i),class:"f-page-events-editor-first-bound-event-name"},[i.name])])}return()=>e.createVNode("div",{class:"f-page-events-editor-events"},[c.value.map(i=>l(i))])}}),ie=e.defineComponent({name:"FInteractionButton",props:je,emits:["click"],setup(n,t){const c=new X.FNotifyService,o=e.inject("useEventsComposition"),l=e.inject("useInteractionCompostion"),{candidateEvents:i}=o,{collapseInteractions:h}=l,m=e.ref(!1);function S(a){i.value=i.value.filter(d=>d.label!==a.label)}function u(a=!1){m.value=a}function b(a){u(),S(a),t.emit("click",a)}function s(){if(i.value.length===0){c.info({position:"top-center",message:"事件已全部绑定"});return}h(),u(!m.value)}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:s},[e.createVNode("span",{class:"f-page-events-editor-text"},[e.createTextVNode("新建交互事件")])])]),m.value&&e.createVNode(Re,{events:i.value,onClick:b},null)])}}),$e={collapsed:{type:Boolean,default:!0},displayOrder:{type:Number,default:-1},interaction:{type:Object,default:{}},controllers:{type:Array,default:[]}},qe={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:[]}},xe={controllers:{type:Array,default:[]}},_e=e.defineComponent({name:"FCommandList",props:xe,emits:["selectMethod"],setup(n,t){function c(m){return m.controllerList.length!==0}function o(m){return c(m)&&e.createVNode("div",{class:"f-page-internals-controller"},[e.createVNode("div",{class:"f-page-internals-controller-name",title:m.controllerName.name},[m.controllerName.name])])}function l(m,S){t.emit("selectMethod",{method:m,controller:S})}function i(m){return m.controllerList.map(S=>e.createVNode("div",{class:"f-page-internals-command",onClick:()=>l(S,m)},[e.createVNode("div",{class:"f-page-internals-command-name",title:S.label},[S.name])]))}function h(m){return e.createVNode("div",null,[o(m),i(m)])}return()=>e.createVNode("div",{class:"f-page-internals"},[n.controllers.map(m=>h(m))])}}),He=e.defineComponent({name:"FCommandSource",props:qe,emits:["addInternalCommandListChanged","newImportChanged","currentCommandChanged","originalDataChanged","click","existChanged","newFunctionChanged","close","selectMethod"],setup(n,t){const c=e.inject("useMethodsComposition"),o=e.inject("useFormCommand"),l=new X.FNotifyService,{checkIfNewControllerExists:i,addNewController:h}=c,m=e.ref(!1),S=e.ref(n.canAddNewMethod),u=e.ref(n.controllers),b=e.computed(()=>!S.value),s=e.computed(()=>m.value),a=e.computed(()=>({"font-size":"15px",margin:"5px",color:"#226eff",flex:"1 1 0"})),d=e.inject("useFormSchema"),v=e.inject(Ne.F_MODAL_SERVICE_TOKEN);let g;function F(D,r,C){if(h(D),D.Commands){const P=o.getInternalControllerFromControllerMetadata(D,r,C);i(P)&&l.info({position:"top-center",message:"该控制器已存在"})}}async function V(D){o.getSupportedControllerMetadata(D).then(r=>{r&&F(r.controller,r.code,r.nameSpace)}).finally(()=>{g&&g.destroy&&g.destroy()})}function A(D){g&&g.destroy&&g.destroy()}function L(){const D={formBasicInfo:d==null?void 0:d.getFormMetadataBasicInfo()};return e.createVNode(ge.FSchemaSelector,{injectSymbolToken:ee.ControllerSchemaRepositorySymbol,"view-type":"NavList",editorParams:D,showFooter:!0,onCancel:A,onSubmit:V},null)}function E(){g=v.open({title:"选择控制器",width:950,render:L,showButtons:!1})}function B(){t.emit("newFunctionChanged")}function p(){}function f(){t.emit("close",null)}function w(){return e.createVNode("div",{class:"f-command-breakline"},[e.createTextVNode("------------------------------------------------------------")])}function N(){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",style:a.value},null),e.createVNode("div",{class:"f-function-class",onClick:()=>E()},[e.createTextVNode("引入控制器")])]),b.value&&e.createVNode("div",{class:"f-page-internals-new-command-func2"},[e.createVNode("div",{class:"f-icon f-icon-new-edit",style:a.value},null),e.createVNode("div",{class:"f-function-class",onClick:()=>B()},[e.createTextVNode("添加新方法")])]),s.value&&void 0])}function y(D){t.emit("selectMethod",D)}function T(){return e.createVNode("div",{class:"f-page-command-source-choice"},[e.createVNode(_e,{controllers:u.value,onSelectMethod:y},null)])}return()=>e.createVNode("div",{class:"f-page-events-editor-command-source"},[T(),w(),N(),w(),e.createVNode("div",null,[e.createVNode("div",{class:"f-page-internals-close",onClick:f},[e.createTextVNode("取消")])])])}}),ze={command:{type:Object,default:{}},showParameter:{type:Boolean,default:!1}},Ue=e.defineComponent({name:"FParameterEditor",props:ze,emits:["confirm","change","targetChange"],setup(n,t){const c=new X.FNotifyService,o=e.ref(M.cloneDeep(n.command)),l=e.ref(0),i=e.computed(()=>o.value.id==="abandoned"),h=e.computed(()=>o.value.id==="deleted"),m=e.computed(()=>o.value!==null),S=e.computed(()=>o.value.id!=="abandoned"&&o.value.id!=="deleted"),u=e.ref(n.showParameter);function b(){const{targetComponent:r}=o.value;let C="";return o.value.componentLists&&o.value.componentLists.forEach(P=>{if(P.componentId===r){C=P.viewModelId;return}}),C}const s=e.ref(b());function a(){c.info({position:"top-center",message:"方法已被移除,请重新绑定"})}function d(){return e.createVNode("div",null,[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:()=>a()},null)])}function v(){c.info({position:"top-center",message:"方法已失效,请重新绑定"})}function g(){return e.createVNode("div",null,[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 F(r){u.value=!u.value}function V(){return e.createVNode("div",null,[e.createVNode("div",{class:"f-icon f-icon-edit-button",style:"font-size: 13px;margin-right:10px;",onClick:()=>F(l.value)},null)])}const A=e.computed(()=>o.value.componentLists&&o.value.hasPath);function L(r,C){o.value.targetComponent=r[0].componentId,t.emit("targetChange",o.value)}function E(){const r=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"),r]])]),e.createVNode("div",{class:"f-page-parameter-editor-targetComponent-dropdown"},[e.createVNode(Ce,{modelValue:s.value,"onUpdate:modelValue":C=>s.value=C,enableClear:!1,idField:"viewModelId",valueField:"viewModelId",textField:"componentId",data:o.value.componentLists,editable:!1,onChange:L},null)])])])}function B(r,C){C.value=r}function p(){t.emit("change",o.value)}function f(r){var _,O,$,q,G,W,Y,H,J,Q,x,fe,me,pe,he,ve,be,we;r.context.generalData;const C=e.reactive(r.context.data),{assembleSchemaFieldsByComponent:P,assembleOutline:j,assembleStateVariables:R}=r.context.generalData;return e.createVNode(Se,{modelValue:r.value,"onUpdate:modelValue":z=>r.value=z,data:C,fieldData:P(),formData:j(),varData:R(),editorType:((O=(_=r==null?void 0:r.origin)==null?void 0:_.controlSource)==null?void 0:O.type)||"Default",idField:((W=(G=(q=($=r==null?void 0:r.origin)==null?void 0:$.controlSource)==null?void 0:q.context)==null?void 0:G.valueField)==null?void 0:W.value)||((Q=(J=(H=(Y=r==null?void 0:r.origin)==null?void 0:Y.controlSource)==null?void 0:H.context)==null?void 0:J.idField)==null?void 0:Q.value)||"id",textField:((pe=(me=(fe=(x=r==null?void 0:r.origin)==null?void 0:x.controlSource)==null?void 0:fe.context)==null?void 0:me.textField)==null?void 0:pe.value)||"label",editable:(we=(be=(ve=(he=r==null?void 0:r.origin)==null?void 0:he.controlSource)==null?void 0:ve.context)==null?void 0:be.editable)==null?void 0:we.value,onConfirm:z=>{B(z,r),p()},onValueChange:z=>{B(z,r),p()}},null)}function w(){var r;return(r=o.value.property)==null?void 0:r.map((C,P)=>{const j=e.reactive({content:C.description,placement:"top"});return e.createVNode("div",{key:C.name+P},[e.createVNode("div",{class:"f-page-parameter-editor-row1"},[e.createVNode("div",{class:"f-page-parameter-editor-parameter-name"},[C.shownName,C.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"),j]])])]),e.createVNode("div",{class:"f-page-parameter-editor-row2"},[f(C)])])})}function N(r){u.value=!1,t.emit("confirm")}function y(){return e.createVNode("div",null,[e.createVNode("div",{class:"f-page-parameter-editor-btn"},[e.createVNode("div",{class:"btn-finish",onClick:()=>N(l.value)},[e.createTextVNode("完成")])])])}function T(){return e.createVNode("div",{class:"f-page-parameter-editor-group"},[A.value&&E(),w()])}function D(){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",title:o.value.label},[o.value.name]),e.createVNode("div",{class:"f-page-parameter-editor-first-row-icon"},[i.value&&d(),h.value&&g(),S.value&&V()])]),u.value&&T(),u.value&&y()])}return()=>e.createVNode("div",{class:"f-page-parameter-editor"},[m.value&&D()])}}),de=e.defineComponent({name:"FInteractionItem",props:$e,emits:["addAction","delete","toggle"],setup(n,t){const{guid:c}=ee.useGuid(),o=e.inject("useMethodsComposition"),{toggleSelectingMethod:l,emitFinalState:i,getViewModeId:h,getMethodsOnViewModel:m,getComponentList:S,updateTarget:u,updateCommandHasPath:b}=o,s=e.ref(n.controllers),a=e.ref(n.interaction),d=e.ref(!1),v=e.computed(()=>{const r=a.value.showSwitch[0];return r.showSection[r.showSwitchNumber][2]}),g=e.computed(()=>{const r=!!a.value.command,C=a.value.showSwitch[0],P=C.showSection[C.showSwitchNumber][3];return r&&P}),F=e.computed(()=>({"f-icon":!0,"f-icon-arrow-chevron-down":g.value,"f-icon-arrow-chevron-left":!g.value}));function V(){t.emit("delete",n.displayOrder)}function A(){const r=a.value.showSwitch[0];r.showSection[r.showSwitchNumber][3]=!r.showSection[r.showSwitchNumber][3],t.emit("toggle",n.displayOrder)}function L(){if(a.value.command!==null){const C=a.value.showSwitch[0];l(C),t.emit("addAction",n.displayOrder)}}function E(r){r===null&&a.value.command===null&&t.emit("delete",n.displayOrder);const C=a.value.showSwitch[0];l(C)}function B(r,C,P){let j=`${C}${P}${r}`,R=-1;const _=m();for(;R===-1;){let O=!1;for(let $=0;$<_.length;$++)_[$].controllerList.forEach(q=>{q.label||q.label===""?O=q.label.toLowerCase()===j.toLowerCase()?!0:O:O=!1});if(O)r+=1,j=`${C}${P}${r}`;else{R=0;break}}return{newName:j,suffix:r}}function p(r){const{method:C,controller:P}=r,{label:j,handlerName:R,property:_,componentLists:O,hasPath:$}=C,q=h().replace(/-/g,"").replace("component","").replace("viewmodel",""),G=j.slice(0,1).toUpperCase()+j.slice(1),{newName:W,suffix:Y}=B(1,q,G),{controllerName:H}=P,J=H.id,Q={id:c(),label:W,name:`${C.name}${Y}`,handlerName:R,hasPath:$,cmpId:J,property:_,componentLists:O};a.value.command=b(P,Q),a.value.controller={id:H.id,label:H.label,name:H.name};const x=a.value.showSwitch[0];x.showSwitchNumber=2,x.showSection[x.showSwitchNumber][2]=!1,x.showSection[x.showSwitchNumber][3]=!0,d.value=!0,i(!1,null)}function f(){a.value.command={id:"abandoned",label:"未绑定方法",name:"未绑定方法",property:[],hasPath:!1,handlerName:"未绑定方法",cmpId:"",shortcut:{},isRTCmd:void 0,isNewGenerated:void 0,extensions:[],isInvalid:!1},a.value.controller={label:"",name:"",id:""},i(!0,a.value.event);const r=a.value.showSwitch[0];l(r)}function w(){return e.createVNode(He,{controllers:s.value,onClose:E,onSelectMethod:p,onNewFunctionChanged:()=>f()},null)}function N(){const r=a.value.showSwitch[0];r.showSection[r.showSwitchNumber][3]=!1}function y(r){a.value.command=M.cloneDeep(r),i(!1,null)}function T(r){r.componentLists=S(),u(r),a.value.command=M.cloneDeep(r),i(!1,null)}function D(){return e.createVNode(Ue,{command:a.value.command,showParameter:d.value,onConfirm:()=>N(),onChange:r=>y(r),onTargetChange:r=>T(r)},null)}return()=>e.createVNode("div",{class:"show-switch"},[e.createVNode("div",{class:"f-page-events-editor-bound-event"},[e.createVNode("div",{class:"f-page-events-editor-bound-event-name",title:a.value.event.label},[a.value.event.name]),e.createVNode("div",{style:"float:right;margin:5px;"},[e.createVNode("div",{class:F.value,style:"font-size: 10px;",onClick:A},null)]),e.createVNode("div",{class:"f-icon f-icon-yxs_delete",style:"font-size: 13px;float: right; margin:8px;",onClick:V},null),e.createVNode("div",{class:"f-icon f-icon-home-add",style:"float:right; font-size: 10px; margin:8px;",onClick:L},null)]),v.value&&w(),g.value&&D()])}});function ue(n,t,c){const{interactions:o}=t,{setComponentLists:l}=ce(),i=e.ref(n.value.internalCommandList);function h(p){o.value[p].showSwitch=[],o.value[p].showSwitch.push(M.cloneDeep({showSection:[[!1,!1,!1,!1,!1],[!1,!1,!0,!1,!1],[!1,!0,!1,!0,!1]],showSwitchNumber:2})),o.value=M.cloneDeep(o.value)}function m(p,f,w){}function S(p){var w;const f=[];return(w=n.value.newController)==null||w.forEach(N=>{p.forEach(y=>{N.Code===y.controller.label&&f.push(M.cloneDeep(N))})}),f}function u(p=!1,f=null){var D;n.value.newFuncEvents=f?M.cloneDeep(f):null,n.value.isAddControllerMethod=p;const w=[],N=M.cloneDeep(n.value.internalCommandList);o.value.map(r=>{const C=M.cloneDeep(r.controller),P=M.cloneDeep(r.command),j=M.cloneDeep(r.event),R={controller:C,command:P,boundEvents:j};w.push(M.cloneDeep(R))});const y=(D=n.value.newController)!=null&&D.length&&w.length?M.cloneDeep(S(w)):[],T={viewModelId:n.value.viewModelId,savedCommand:M.cloneDeep(n.value.viewModel),boundEventsList:M.cloneDeep(w),events:M.cloneDeep(n.value.events),internalCommandList:M.cloneDeep(N),componentLists:[],relativePath:n.value.relativePath,envType:n.value.envType,newController:M.cloneDeep(y),isAddControllerMethod:n.value.isAddControllerMethod,repititionCommand:n.value.repititionCommand,preCommand:n.value.preCommand,newFuncEvents:n.value.newFuncEvents};c.emit("savedCommandListChanged",T)}function b(p){p.showSection[p.showSwitchNumber][2]=!0}function s(p){p.showSection[p.showSwitchNumber][2]=!1}function a(p){p.showSection[p.showSwitchNumber][3]=!0}function d(p){p.showSection[p.showSwitchNumber][3]=!1}function v(p){p.showSection[p.showSwitchNumber][2]?(s(p),a(p)):(b(p),d(p))}function g(){return n.value.componentLists}function F(p){n.value.viewModel.forEach(f=>{for(let w=0;w<f.controllerList.length;w++)f.controllerList[w].label===p.label&&(f.controllerList[w]=M.cloneDeep(p))})}function V(){return n.value.viewModelId}function A(){return n.value.getEventPath?n.value.getEventPath().viewModelDisplay:[]}function L(p,f){return l(p,f,n.value)}function E(p){n.value.newController=n.value.newController||[],n.value.newController.push(M.cloneDeep(p));const f=n.value.newController;for(let w=0;w<f.length;w++)for(let N=w+1;N<f.length;N++)f[w].Id===f[N].Id&&(f.splice(N,1),N--)}function B(p){let f=!1;return n.value.internalCommandList.forEach(w=>{if(w.controllerName.label===p.controllerName.label){f=!0;return}}),f||n.value.internalCommandList.push(p),f}return{controllers:i,onClosed:h,emitFinalState:u,onCurrentCommandChanged:m,toggleSelectingMethod:v,getViewModeId:V,getComponentList:g,updateTarget:F,updateCommandHasPath:L,addNewController:E,checkIfNewControllerExists:B,getMethodsOnViewModel:A}}const I=e.defineComponent({name:"FEventsEditor",props:U,emits:["savedCommandListChanged"],setup(n,t){const c=e.ref(n.initialData),o=se(c),{loadEvents:l,resetBoundEvents:i}=o,h=le(c,o),{addNewInteraction:m,deleteInteracton:S,interactions:u,loadInteractions:b}=h,s=ue(c,h,t),{emitFinalState:a,controllers:d}=s;e.provide("useEventsComposition",o),e.provide("useInteractionCompostion",h),e.provide("useMethodsComposition",s);function v(){c.value.isAddControllerMethod=!1}e.onMounted(()=>{v(),i(),l(),b()});function g(L){S(L),a(!1,null)}function F(L,E){const B=L.showSwitch[0],p=B.showSection[B.showSwitchNumber][3];return e.createVNode(de,{controllers:d.value,interaction:L,displayOrder:E,collapsed:p,onDelete:g},null)}function V(){var L;return(L=u.value)==null?void 0:L.map((E,B)=>e.createVNode("div",{class:"events-display-order",key:E.event.label},[F(E,B)]))}function A(L){m(L)}return()=>e.createVNode("div",{class:"f-page-events-editor"},[e.createVNode("div",{class:"f-page-events-editor-content"},[e.createVNode(ie,{onClick:A},null),V()])])}});function Ie(n,t,c){var p;const o="",l="",i=e.ref();function h(){return(t==null?void 0:t.schema.componentType)!=="frame"}function m(){return!1}function S(){return(t==null?void 0:t.schema.componentType)!=="frame"}function u(){return(t==null?void 0:t.schema.componentType)==="frame"}function b(f){if(!f||!f.value)return null;if(f.value.schema&&f.value.schema.type==="component")return f.value;const w=e.ref(f==null?void 0:f.value.parent),N=b(w);return N||null}function s(f=t){var T;const{componentInstance:w,designerItemElementRef:N}=f;if(!w||!w.value)return null;const{getCustomButtons:y}=w.value;return w.value.canMove||y&&((T=y())!=null&&T.length)?N:s(f.parent)}function a(f){return!!c}function d(){return(t==null?void 0:t.schema.label)||(t==null?void 0:t.schema.title)||(t==null?void 0:t.schema.name)}function v(){}function g(f,w){var N;!f||!w||(N=t==null?void 0:t.setupContext)==null||N.emit("dragEnd")}function F(f,w){const{componentType:N}=f;let y=oe(N,f,w);const T=N.toLowerCase().replace(/-/g,"_");return y&&!y.id&&y.type===N&&(y.id=`${T}_${Math.random().toString().slice(2,6)}`),y}function V(f){}function A(...f){}function L(){t!=null&&t.schema.contents&&t.schema.contents.map(f=>{let w=f.id;f.type==="component-ref"&&(w=f.component);const N=n.value.querySelectorAll(`#${w}-design-item`);N!=null&&N.length&&Array.from(N).map(y=>{var T;(T=y==null?void 0:y.componentInstance)!=null&&T.value.onRemoveComponent&&y.componentInstance.value.onRemoveComponent()})})}function E(){}function B(f){}return i.value={canMove:h(),canSelectParent:m(),canDelete:S(),canNested:!u(),contents:t==null?void 0:t.schema.contents,elementRef:n,parent:(p=t==null?void 0:t.parent)==null?void 0:p.componentInstance,schema:t==null?void 0:t.schema,styles:o,designerClass:l,canAccepts:a,getBelongedComponentInstance:b,getDraggableDesignItemElement:s,getDraggingDisplayText:d,getPropConfig:A,getDragScopeElement:v,onAcceptMovedChildElement:g,onChildElementMovedOut:V,addNewChildComponentSchema:F,triggerBelongedComponentToMoveWhenMoved:e.ref(!1),triggerBelongedComponentToDeleteWhenDeleted:e.ref(!1),onRemoveComponent:L,getCustomButtons:E,onPropertyChanged:B},i}const Ge=e.defineComponent({name:"FEventsEditorDesign",props:U,emits:["savedCommandListChanged"],setup(n,t){const c=e.ref(n.initialData),o=se(c),{loadEvents:l,resetBoundEvents:i}=o,h=le(c,o),{addNewInteraction:m,deleteInteracton:S,interactions:u,loadInteractions:b}=h,s=ue(c,h,t);e.provide("useEventsComposition",o),e.provide("useInteractionCompostion",h),e.provide("useMethodsComposition",s);const a=e.ref(),d=e.inject("design-item-context"),v=Ie(a,d);e.onMounted(()=>{a.value.componentInstance=v,g(),i(),l(),b()}),t.expose(v.value);function g(){c.value.isAddControllerMethod=!1}function F(E){S(E)}function V(E,B){const p=E.showSwitch[0],f=p.showSection[p.showSwitchNumber][3];return e.createVNode(de,{interaction:E,displayOrder:B,collapsed:f,onDelete:F},null)}function A(){var E;return(E=u.value)==null?void 0:E.map((B,p)=>e.createVNode("div",{class:"events-display-order",key:B.event.label},[V(B,p)]))}function L(E){m(E)}return()=>e.createVNode("div",{ref:a,class:"f-page-events-editor"},[e.createVNode("div",{class:"f-page-events-editor-content"},[e.createVNode(ie,{onClick:L},null),A()])])}}),We={install(n){n.component(I.name,I)},register(n,t,c,o){n["events-editor"]=I,t["events-editor"]=K},registerDesigner(n,t,c){n["events-editor"]=Ge,t["events-editor"]=K}};k.FEventsEditor=I,k.default=We,k.eventsEditorProps=U,k.propsResolver=K,Object.defineProperties(k,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});