UNPKG

epic-designer-dev

Version:

基于vue3的设计器,可视化开发页面表单。在epic-designer的基础上新增了字典选择器

2 lines (1 loc) 3.5 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("vue"),Z=require("../common/component.cjs");require("@vueuse/core");require("../../../hooks/src/store/index.cjs");const _=require("../../../hooks/src/plugin/useFormSchema.cjs"),ee=require("../../../hooks/src/plugin/usePanel.cjs");function G(){let m=[];const o={};let f={};const c={},p=b.ref([]),{formSchema:N,setFormSchema:x}=_.useFormSchema();let a=[];const h=b.ref(!1),l={};let u=["表单","布局"];const{getActivitybars:w,getRightSidebars:A,hideActivitybar:P,hideRightSidebar:q,registerActivitybar:B,registerRightSidebar:E,showActivitybar:I,showRightSidebar:O,viewsContainers:R}=ee.usePanel();function T(e){m.push(e)}function F(e){e.methodName&&console.warn("[Epic:公共函数]注册配置'methodName'属性已弃用,请使用'name'代替"),e.method&&console.warn("[Epic:公共函数]注册配置'method'属性已弃用,请使用'handler'代替"),e.describe&&console.warn("[Epic:公共函数]注册配置'describe'属性已弃用,请使用'description'代替");const t=e.methodName??e.name,i=e.method??e.handler,n=e.describe??e.description;l[t]={description:n,handler:i,name:t}}function M(){f={}}function j(){u=[],r()}function g(e,t){typeof t=="function"&&(t=Z.loadAsyncComponent(t)),c[e]=t}function r(){const e=[];Object.values(o).forEach(t=>{if(!a.includes(t.defaultSchema.type)&&t.groupName){const i=f[t.groupName]??t.groupName;let n=e.findIndex(d=>d.title===i);n===-1&&(e.push({title:i,list:[]}),n=e.length-1);const s=e[n].list.findIndex(d=>d.type===t.defaultSchema.type);s===-1?e[n].list.push(t.defaultSchema):e[n].list[s]=t.defaultSchema}}),e.sort((t,i)=>{const n=u.indexOf(t.title),s=u.indexOf(i.title);return n===-1?1:s===-1?-1:n-s}),e.forEach(t=>{t.list.sort((i,n)=>{var v,C;const s=((v=o[i.type])==null?void 0:v.sort)??1e3,d=((C=o[n.type])==null?void 0:C.sort)??1e3;return s-d})}),p.value=e}function z(e){return c[e]}function V(e){return o[e]}function H(){return o}function $(){return c}function k(){return p}function D(e){a.push(e),r()}function J(e){g(e.defaultSchema.type,e.component),e.defaultSchema.input&&(e.config.action||(e.config.action=[]),e.config.action.unshift({argsConfigs:[{...e.defaultSchema,field:"0",label:"设置数据"}],description:"设置值",type:"setValue"},{description:"获取值",type:"getValue"})),o[e.defaultSchema.type]=e,r()}function K(){m.forEach(e=>{S(e)}),y([]),r()}function S(e){delete o[e],delete c[e]}function L(e){delete l[e]}function y(e){m=e}function Q(e,t){f[e]=t}function U(e){a=e,r()}function W(e){h.value=e}function X(e){u=e,r()}function Y(e){a=a.filter(t=>t!==e),r()}return{addBaseComponentTypes:T,addPublicMethod:F,baseComponentTypes:m,clearComponentGroupNameMap:M,clearSortedGroups:j,component:g,componentConfigs:o,componentGroupNameMap:f,components:c,componentSchemaGroups:p,formSchema:N,getActivitybars:w,getComponent:z,getComponentConfingByType:V,getComponentConfings:H,getComponents:$,getComponentSchemaGroups:k,getRightSidebars:A,hiddenComponents:a,hideActivitybar:P,hideComponent:D,hideRightSidebar:q,initialized:h,publicMethods:l,registerActivitybar:B,registerComponent:J,registerRightSidebar:E,removeBaseComponents:K,removeComponent:S,removePublicMethod:L,setBaseComponentTypes:y,setComponentGroupNameMap:Q,setFormSchema:x,setHideComponents:U,setInitialized:W,setSortedGroups:X,showActivitybar:I,showComponent:Y,showRightSidebar:O,sortedGroups:u,viewsContainers:R}}const te=G();exports.pluginManager=te;exports.usePluginManager=G;