form-designer-xinyi 1.6.1 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3 -3
- package/dist/index.js +106 -103
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("./index-CIyLEDdm.cjs"),e=require("vue"),n=require("./revoke-Bbm2vFx2.cjs");function F(){const{isDark:t}=B(),r=x.useToggle(t);return{isDark:t,toggleDark:r}}function A(){const t=e.ref(!1);return e.onMounted(()=>{P(t),q(t)}),e.watch(()=>t.value,()=>{t.value?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")}),{isDark:t}}function P(t){var r=document.documentElement;r&&(r.classList.contains("dark")?t.value=!0:t.value=!1)}function q(t){var r=document.querySelector("html"),o=new MutationObserver(function(s){for(var i of s)if(i.type==="attributes"&&i.attributeName==="class"){const f=i.target;new Array(...f.classList).includes("dark")?t.value=!0:t.value=!1}});o.observe(r,{attributes:!0,attributeFilter:["class"]}),e.onUnmounted(()=>{o.disconnect()})}function T(){const t=e.ref(1),r=e.ref(!1),{isDark:o}=A(),{pressSpace:s,pressShift:i,pressCtrl:f}=$();return{canvasScale:t,pressSpace:s,pressShift:i,pressCtrl:f,disabledZoom:r,isDark:o}}const B=x.createSharedComposable(T);function $(){const t=e.ref(!1),r=e.ref(!1),o=e.ref(!1);return x.onKeyDown(" ",s=>{var i=s.target;["INPUT","TEXTAREA"].includes(i.tagName)||s.preventDefault(),t.value=!0}),x.onKeyUp(" ",()=>{t.value=!1}),x.onKeyDown("Shift",s=>{s.preventDefault(),r.value=!0}),x.onKeyUp("Shift",()=>{r.value=!1}),x.onKeyDown("Control",s=>{s.preventDefault(),o.value=!0}),x.onKeyUp("Control",()=>{o.value=!1}),{pressSpace:t,pressShift:r,pressCtrl:o}}function U(t){const{pressSpace:r}=B();let o=0,s=0;function i(m){var d;o=m.x,s=m.y,(d=m.dataTransfer)==null||d.setDragImage(document.createElement("div"),0,0)}function f(m){if(m.preventDefault(),!m.x||!m.y||!r.value)return;const d=m.x-o,h=m.y-s;o=m.x,s=m.y,t.value&&(t.value.scrollTop-=h,t.value.scrollLeft-=d)}function v(){r.value=!1}return{handleElementDragStart:i,handleElementDrag:f,handleElementDragEnd:v}}function K(t){const{pressCtrl:r,canvasScale:o,disabledZoom:s}=B();function i(f){if(!r.value||s.value)return;f.preventDefault();let v=0;f.deltaY<0?v=o.value+.05:v=o.value-.05,!(v>150||v<.5)&&(o.value=v)}return e.watch(()=>o.value,f=>{t.value&&!s.value&&(t.value.style.transform=`scale(${f})`)}),{handleZoom:i,canvasScale:o}}function H(t,r=16.66){let o;function s(){i(),o=window.setInterval(t,r)}function i(){window.clearInterval(o)}return{startTimedQuery:s,stopTimedQuery:i}}function L(t,r){let o=null;return(...s)=>{o&&clearTimeout(o),o=setTimeout(()=>{t.apply(this,s)},r)}}function O(){const t=e.ref(0),r=e.computed(()=>t.value===0);function o(){t.value++}function s(){t.value>0&&t.value--}return{isAllMounted:r,pendingCount:t,pop:s,push:o}}function I(){const t=e.ref({}),r=e.ref({}),o=e.ref(!1),s=e.ref([]),i=O();function f(a){return t.value[a]}function v(a,S){t.value[a]=S}function m(a){delete t.value[a]}function d(a,S=!1){const c=Object.entries(n.pluginManager.publicMethods).reduce((p,[
|
|
2
|
-
请添加表单组件后再尝试!`),console.error(c)}}return r({handleOpen:a}),(c,p)=>(e.openBlock(),e.createBlock(e.unref(s),{modelValue:f.value,"onUpdate:modelValue":p[1]||(p[1]=
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("./index-CIyLEDdm.cjs"),e=require("vue"),n=require("./revoke-Bbm2vFx2.cjs");function F(){const{isDark:t}=B(),r=x.useToggle(t);return{isDark:t,toggleDark:r}}function A(){const t=e.ref(!1);return e.onMounted(()=>{P(t),q(t)}),e.watch(()=>t.value,()=>{t.value?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")}),{isDark:t}}function P(t){var r=document.documentElement;r&&(r.classList.contains("dark")?t.value=!0:t.value=!1)}function q(t){var r=document.querySelector("html"),o=new MutationObserver(function(s){for(var i of s)if(i.type==="attributes"&&i.attributeName==="class"){const f=i.target;new Array(...f.classList).includes("dark")?t.value=!0:t.value=!1}});o.observe(r,{attributes:!0,attributeFilter:["class"]}),e.onUnmounted(()=>{o.disconnect()})}function T(){const t=e.ref(1),r=e.ref(!1),{isDark:o}=A(),{pressSpace:s,pressShift:i,pressCtrl:f}=$();return{canvasScale:t,pressSpace:s,pressShift:i,pressCtrl:f,disabledZoom:r,isDark:o}}const B=x.createSharedComposable(T);function $(){const t=e.ref(!1),r=e.ref(!1),o=e.ref(!1);return x.onKeyDown(" ",s=>{var i=s.target;["INPUT","TEXTAREA"].includes(i.tagName)||s.preventDefault(),t.value=!0}),x.onKeyUp(" ",()=>{t.value=!1}),x.onKeyDown("Shift",s=>{s.preventDefault(),r.value=!0}),x.onKeyUp("Shift",()=>{r.value=!1}),x.onKeyDown("Control",s=>{s.preventDefault(),o.value=!0}),x.onKeyUp("Control",()=>{o.value=!1}),{pressSpace:t,pressShift:r,pressCtrl:o}}function U(t){const{pressSpace:r}=B();let o=0,s=0;function i(m){var d;o=m.x,s=m.y,(d=m.dataTransfer)==null||d.setDragImage(document.createElement("div"),0,0)}function f(m){if(m.preventDefault(),!m.x||!m.y||!r.value)return;const d=m.x-o,h=m.y-s;o=m.x,s=m.y,t.value&&(t.value.scrollTop-=h,t.value.scrollLeft-=d)}function v(){r.value=!1}return{handleElementDragStart:i,handleElementDrag:f,handleElementDragEnd:v}}function K(t){const{pressCtrl:r,canvasScale:o,disabledZoom:s}=B();function i(f){if(!r.value||s.value)return;f.preventDefault();let v=0;f.deltaY<0?v=o.value+.05:v=o.value-.05,!(v>150||v<.5)&&(o.value=v)}return e.watch(()=>o.value,f=>{t.value&&!s.value&&(t.value.style.transform=`scale(${f})`)}),{handleZoom:i,canvasScale:o}}function H(t,r=16.66){let o;function s(){i(),o=window.setInterval(t,r)}function i(){window.clearInterval(o)}return{startTimedQuery:s,stopTimedQuery:i}}function L(t,r){let o=null;return(...s)=>{o&&clearTimeout(o),o=setTimeout(()=>{t.apply(this,s)},r)}}function O(){const t=e.ref(0),r=e.computed(()=>t.value===0);function o(){t.value++}function s(){t.value>0&&t.value--}return{isAllMounted:r,pendingCount:t,pop:s,push:o}}function I(){const t=e.ref({}),r=e.ref({}),o=e.ref(!1),s=e.ref([]),i=O();function f(a){return t.value[a]}function v(a,S){t.value[a]=S}function m(a){delete t.value[a]}function d(a,S=!1){const c=Object.entries(n.pluginManager.publicMethods).reduce((p,[b,_])=>(p[b]=_.handler,p),{});try{new Function(`const epic = this;${a}`).bind({...c,getComponent:f,find:f,defineExpose:h,publicMethods:c,pluginManager:n.pluginManager})()}catch(p){S&&console.error("[epic-desinger:自定义函数]异常:",p)}}function h(a){a!=null&&(r.value=a)}function M(a,...S){a==null||a.forEach(c=>{var p,b,_;if(c.type==="public"&&((p=n.pluginManager.publicMethods[c.methodName])==null||p.handler(...S)),c.type==="custom"&&((_=(b=r.value)[c.methodName])==null||_.call(b,...S)),c.type==="component"){(c.componentId!=null&&f(c.componentId))[c.methodName](...c.args?JSON.parse(c.args):S);return}})}function C(a=!0){o.value=a}function w(a){const S=n.findSchemas(a,()=>!0);s.value=S.map(c=>c.id)}return{componentInstances:t,funcs:r,isDesignMode:o,defaultComponentIds:s,getComponentInstance:f,find:f,addComponentInstance:v,removeComponentInstance:m,setMethods:d,doActions:M,setDesignMode:C,setDefaultComponentIds:w,mountMonitor:i}}const Z={key:0,class:"epic-loading-box"},z={class:"epic-builder-main"},Q={class:"epic-loading-box"},R=e.defineComponent({__name:"builder",props:{pageSchema:{},disabled:{type:Boolean}},emits:["ready"],setup(t,{expose:r,emit:o}){const s=n.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-Da6i5WD2.cjs"))),i=I(),f=o,v=e.useSlots(),m=e.ref({}),d=e.ref(!1),h=t,M=e.ref(0),C=e.reactive({schemas:[]});e.watch(()=>h.pageSchema,u=>{n.deepCompareAndModify(C,u),M.value++,d.value=!1},{immediate:!0,deep:!0}),e.watch(()=>C.script,u=>{u&&u!==""&&i.setMethods(u,!0)},{immediate:!0}),e.provide("slots",v),e.provide("pageManager",i),e.provide("forms",m),e.provide("pageSchema",C),e.provide("disabled",e.computed(()=>h.disabled));function w(u="default"){return new Promise(async(g,k)=>{var D;if(!d.value){const N=e.watch(d,async()=>{N(),g(await w(u))});return}const y=(D=m.value)==null?void 0:D[u];if(!y)return k(`表单 [name=${u}] 不存在`),!1;const E=n.deepClone(await y.getData());g(E)})}function a(u="default"){return new Promise(async(g,k)=>{var E;if(!d.value){const D=e.watch(d,async()=>{D(),g(await a(u))});return}const y=(E=m.value)==null?void 0:E[u];if(!y)return k(`表单 [name=${u}] 不存在`),!1;try{await y.validate();const D=await y.getData();g(D)}catch(D){k(D)}})}function S(u,g="default"){var y;if(!d.value){const E=e.watch(d,()=>{E(),S(u,g)});return}const k=(y=m.value)==null?void 0:y[g];if(!k)return console.error(`表单 [name=${g}] 不存在`),!1;k.setData(u)}function c(u="default"){return new Promise(async(g,k)=>{var E;if(!d.value){const D=e.watch(d,async()=>{D(),g(await c(u))});return}const y=(E=m.value)==null?void 0:E[u];if(!y)return k(`表单 [name=${u}] 不存在`),!1;g(y)})}const{proxy:p}=e.getCurrentInstance();function b(){const u=e.watch(()=>i.mountMonitor.isAllMounted.value,g=>{g&&(u&&u(),_())},{immediate:!0})}function _(){d.value=!0,f("ready",i),p&&i.addComponentInstance("builder",p)}return r({ready:d,getData:w,setData:S,validate:a,getFormInstance:c}),(u,g)=>{var k;return!e.unref(n.pluginManager).initialized.value||((k=C.schemas)==null?void 0:k.length)===0?(e.openBlock(),e.createElementBlock("div",Z)):(e.openBlock(),e.createBlock(e.Suspense,{key:M.value,onResolve:b},{default:e.withCtx(()=>[e.createElementVNode("div",z,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.schemas,(y,E)=>(e.openBlock(),e.createBlock(e.unref(x._sfc_main),{key:E,componentSchema:y},null,8,["componentSchema"]))),128))])]),fallback:e.withCtx(()=>[e.createElementVNode("div",Q,[e.createVNode(e.unref(s))])]),_:1}))}}}),X={class:"min-w-750px rounded"},Y={class:"h-full rounded"},j=e.defineComponent({__name:"index",setup(t,{expose:r}){const o=n.pluginManager.getComponent("monacoEditor"),s=n.pluginManager.getComponent("modal"),i=e.ref(null),f=e.ref(!1),v=e.ref(!1),m=e.ref({}),d=e.inject("pageSchema"),h=e.ref(null),M=e.ref("");function C(){v.value=!1}function w(){f.value=!1}function a(){f.value=!0,M.value=n.getUUID()}async function S(){try{const c=await h.value.validate();console.log("表单结果为:",c),m.value=JSON.stringify(c,null,2),e.nextTick(()=>{var p;(p=i.value)==null||p.setValue(m.value)}),v.value=!0}catch(c){typeof c=="string"&&alert(c+`\r
|
|
2
|
+
请添加表单组件后再尝试!`),console.error(c)}}return r({handleOpen:a}),(c,p)=>(e.openBlock(),e.createBlock(e.unref(s),{modelValue:f.value,"onUpdate:modelValue":p[1]||(p[1]=b=>f.value=b),title:"预览",class:"w-900px",width:"900px",onClose:w,onOk:S,okText:"输出结果"},{default:e.withCtx(()=>[e.createElementVNode("div",X,[(e.openBlock(),e.createBlock(e.unref(R),{key:M.value,ref_key:"kb",ref:h,"page-schema":e.unref(d)},null,8,["page-schema"])),e.createVNode(e.unref(s),{modelValue:v.value,"onUpdate:modelValue":p[0]||(p[0]=b=>v.value=b),title:"表单数据",class:"w-860px",width:"860px",onClose:C,onOk:C},{default:e.withCtx(()=>[e.createElementVNode("div",Y,[e.createVNode(e.unref(o),{ref_key:"monacoEditorRef",ref:i,autoToggleTheme:"",class:"h-full editor","model-value":m.value},null,8,["model-value"])])]),_:1},8,["modelValue"])])]),_:1},8,["modelValue"]))}}),J={key:0,class:"epic-loading-box"},G={class:"epic-designer-main"},W={class:"epic-header-container"},ee={class:"epic-loading-box"},te=e.defineComponent({__name:"designer",props:{disabledZoom:{type:Boolean,default:!1},hiddenHeader:{type:Boolean,default:!1},lockDefaultSchemaEdit:{type:Boolean,default:!1},title:{default:"EpicDesigner默认项目"},defaultSchema:{default:()=>({schemas:[{type:"page",id:"root",label:"页面",children:[],componentProps:{style:{padding:"16px"}}}],script:`const { defineExpose, find } = epic;
|
|
3
3
|
|
|
4
4
|
function test (){
|
|
5
5
|
console.log('test')
|
|
@@ -8,4 +8,4 @@ function test (){
|
|
|
8
8
|
// 通过defineExpose暴露的函数或者属性
|
|
9
9
|
defineExpose({
|
|
10
10
|
test
|
|
11
|
-
})`})}},emits:["ready","save","reset","toggleDeviceMode"],setup(t,{expose:r,emit:o}){const s=n.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-n2IR3pLH.cjs"))),i=n.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-fsDcHxrd.cjs"))),f=n.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-DdRtAylF.cjs"))),v=n.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-BsH-8kV3.cjs"))),m=n.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-Da6i5WD2.cjs"))),d=I(),h=t;d.setDesignMode(),d.setDefaultComponentIds(h.defaultSchema.schemas);const
|
|
11
|
+
})`})}},emits:["ready","save","reset","toggleDeviceMode"],setup(t,{expose:r,emit:o}){const s=n.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-n2IR3pLH.cjs"))),i=n.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-fsDcHxrd.cjs"))),f=n.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-DdRtAylF.cjs"))),v=n.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-BsH-8kV3.cjs"))),m=n.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-Da6i5WD2.cjs"))),d=I(),h=t;d.setDesignMode(),d.setDefaultComponentIds(h.defaultSchema.schemas);const M=o,C=e.ref(null),w=e.reactive({checkedNode:null,hoverNode:null,disableHover:!1,matched:[]}),a=e.reactive({schemas:[],script:h.defaultSchema.script}),{disabledZoom:S}=B();e.watch(()=>h.disabledZoom,l=>{S.value=l},{immediate:!0}),e.watch(()=>a.script,l=>{l&&l!==""&&d.setMethods(l)},{immediate:!0}),e.provide("pageSchema",a),e.provide("pageManager",d),e.provide("designerProps",e.computed(()=>h)),e.provide("designer",{setCheckedNode:p,setHoverNode:b,setDisableHover:u,handleToggleDeviceMode:D,reset:y,state:w});function c(){a.schemas=n.deepClone(h.defaultSchema.schemas),p(a.schemas[0]),n.revoke.push(a.schemas,"初始化撤销功能")}async function p(l=a.schemas[0]){w.checkedNode=l,w.matched=n.getMatchedById(a.schemas,l.id)}async function b(l=null){var V;if(!l||w.disableHover)return w.hoverNode=null,!1;if((l==null?void 0:l.id)===((V=w.hoverNode)==null?void 0:V.id))return!1;w.hoverNode=l}function _(){e.nextTick(()=>{M("ready",{pageManager:d})})}async function u(l=!1){w.disableHover=l}function g(l){n.deepCompareAndModify(a,l)}function k(){return e.toRaw(a)}function y(){n.deepEqual(a.schemas,h.defaultSchema.schemas)&&a.script===h.defaultSchema.script||(n.deepCompareAndModify(a.schemas,h.defaultSchema.schemas),a.script=h.defaultSchema.script,p(a.schemas[0]),n.revoke.push(a.schemas,"重置操作"),M("reset",a))}function E(){M("save",e.toRaw(a))}function D(l){M("toggleDeviceMode",l)}function N(){C.value.handleOpen()}return c(),r({setData:g,getData:k,reset:y,preview:N}),(l,V)=>e.unref(n.pluginManager).initialized.value?(e.openBlock(),e.createBlock(e.Suspense,{key:1,onResolve:_},{default:e.withCtx(()=>[e.createElementVNode("div",G,[e.createElementVNode("div",W,[e.renderSlot(l.$slots,"header",{},()=>[h.hiddenHeader?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(s),{key:0,onPreview:N,onSave:E},{header:e.withCtx(()=>[e.renderSlot(l.$slots,"header-prefix")]),prefix:e.withCtx(()=>[e.renderSlot(l.$slots,"header-prefix")]),title:e.withCtx(()=>[e.renderSlot(l.$slots,"header-title")]),"right-prefix":e.withCtx(()=>[e.renderSlot(l.$slots,"header-right-prefix")]),"right-action":e.withCtx(()=>[e.renderSlot(l.$slots,"header-right-action")]),"right-suffix":e.withCtx(()=>[e.renderSlot(l.$slots,"header-right-suffix")]),_:3}))])]),e.createElementVNode("div",{class:e.normalizeClass(["epic-split-view-container",{"hidden-header":l.hiddenHeader}])},[e.createVNode(e.unref(i)),e.createVNode(e.unref(f)),e.createVNode(e.unref(v))],2),e.createVNode(j,{ref_key:"previewRef",ref:C},null,512)])]),fallback:e.withCtx(()=>[e.createElementVNode("div",ee,[e.createVNode(e.unref(m))])]),_:3})):(e.openBlock(),e.createElementBlock("div",J))}});exports.ENode=x._sfc_main;exports.PluginManager=n.PluginManager;exports.capitalizeFirstLetter=n.capitalizeFirstLetter;exports.convertKFormData=n.convertKFormData;exports.deepClone=n.deepClone;exports.deepCompareAndModify=n.deepCompareAndModify;exports.deepEqual=n.deepEqual;exports.findSchemaById=n.findSchemaById;exports.findSchemaInfoById=n.findSchemaInfoById;exports.findSchemas=n.findSchemas;exports.generateNewSchema=n.generateNewSchema;exports.getAttributeValue=n.getAttributeValue;exports.getFormFields=n.getFormFields;exports.getFormSchemas=n.getFormSchemas;exports.getMatchedById=n.getMatchedById;exports.getUUID=n.getUUID;exports.loadAsyncComponent=n.loadAsyncComponent;exports.mapSchemas=n.mapSchemas;exports.pluginManager=n.pluginManager;exports.recursionConvertedNode=n.recursionConvertedNode;exports.revoke=n.revoke;exports.setAttributeValue=n.setAttributeValue;exports.useRevoke=n.useRevoke;exports.EBuilder=R;exports.EDesigner=te;exports.debounce=L;exports.getDarkState=P;exports.useDark=A;exports.useElementDrag=U;exports.useElementZoom=K;exports.useKeyPress=$;exports.usePageManager=I;exports.useShareStore=B;exports.useStore=T;exports.useTheme=F;exports.useTimedQuery=H;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { u as ee, c as te, o as O, a as U, _ as ae } from "./index-BnI1t3Q-.js";
|
|
2
|
-
import { ref as m, onMounted as ne, watch as x, onUnmounted as se, computed as q, defineComponent as Q, useSlots as oe, reactive as Z, provide as I, getCurrentInstance as le, unref as
|
|
2
|
+
import { ref as m, onMounted as ne, watch as x, onUnmounted as se, computed as q, defineComponent as Q, useSlots as oe, reactive as Z, provide as I, getCurrentInstance as le, unref as w, openBlock as $, createElementBlock as K, createBlock as P, Suspense as j, withCtx as C, createElementVNode as V, Fragment as re, renderList as ie, createVNode as N, inject as ce, nextTick as J, renderSlot as A, createCommentVNode as ue, normalizeClass as de, toRaw as X } from "vue";
|
|
3
3
|
import { p as B, f as fe, l as R, d as z, a as G, g as me, b as pe, c as he, r as Y } from "./revoke-iScTU0eW.js";
|
|
4
4
|
import { P as Ke, t as ze, o as qe, k as Qe, n as Xe, e as Ye, h as je, i as Je, j as Ge, m as We, q as et, s as tt, u as at } from "./revoke-iScTU0eW.js";
|
|
5
5
|
function Re() {
|
|
@@ -154,7 +154,7 @@ function W() {
|
|
|
154
154
|
function c(t, y = !1) {
|
|
155
155
|
const l = Object.entries(
|
|
156
156
|
B.publicMethods
|
|
157
|
-
).reduce((f, [
|
|
157
|
+
).reduce((f, [_, T]) => (f[_] = T.handler, f), {});
|
|
158
158
|
try {
|
|
159
159
|
new Function(`const epic = this;${t}`).bind({
|
|
160
160
|
...l,
|
|
@@ -171,10 +171,10 @@ function W() {
|
|
|
171
171
|
function p(t) {
|
|
172
172
|
t != null && (n.value = t);
|
|
173
173
|
}
|
|
174
|
-
function
|
|
174
|
+
function E(t, ...y) {
|
|
175
175
|
t == null || t.forEach((l) => {
|
|
176
|
-
var f,
|
|
177
|
-
if (l.type === "public" && ((f = B.publicMethods[l.methodName]) == null || f.handler(...y)), l.type === "custom" && ((T = (
|
|
176
|
+
var f, _, T;
|
|
177
|
+
if (l.type === "public" && ((f = B.publicMethods[l.methodName]) == null || f.handler(...y)), l.type === "custom" && ((T = (_ = n.value)[l.methodName]) == null || T.call(_, ...y)), l.type === "component") {
|
|
178
178
|
(l.componentId != null && u(l.componentId))[l.methodName](
|
|
179
179
|
...l.args ? JSON.parse(l.args) : y
|
|
180
180
|
);
|
|
@@ -182,7 +182,7 @@ function W() {
|
|
|
182
182
|
}
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function D(t = !0) {
|
|
186
186
|
a.value = t;
|
|
187
187
|
}
|
|
188
188
|
function S(t) {
|
|
@@ -200,8 +200,8 @@ function W() {
|
|
|
200
200
|
addComponentInstance: h,
|
|
201
201
|
removeComponentInstance: d,
|
|
202
202
|
setMethods: c,
|
|
203
|
-
doActions:
|
|
204
|
-
setDesignMode:
|
|
203
|
+
doActions: E,
|
|
204
|
+
setDesignMode: D,
|
|
205
205
|
setDefaultComponentIds: S,
|
|
206
206
|
mountMonitor: r
|
|
207
207
|
};
|
|
@@ -217,86 +217,86 @@ const De = {
|
|
|
217
217
|
},
|
|
218
218
|
emits: ["ready"],
|
|
219
219
|
setup(e, { expose: n, emit: a }) {
|
|
220
|
-
const s = R(() => import("./index-B4P9zbh-.js")), r = W(), u = a, h = oe(), d = m({}), c = m(!1), p = e,
|
|
220
|
+
const s = R(() => import("./index-B4P9zbh-.js")), r = W(), u = a, h = oe(), d = m({}), c = m(!1), p = e, E = m(0), D = Z({
|
|
221
221
|
schemas: []
|
|
222
222
|
});
|
|
223
223
|
x(() => p.pageSchema, (i) => {
|
|
224
|
-
z(
|
|
224
|
+
z(D, i), E.value++, c.value = !1;
|
|
225
225
|
}, {
|
|
226
226
|
immediate: !0,
|
|
227
227
|
deep: !0
|
|
228
|
-
}), x(() =>
|
|
228
|
+
}), x(() => D.script, (i) => {
|
|
229
229
|
i && i !== "" && r.setMethods(i, !0);
|
|
230
230
|
}, {
|
|
231
231
|
immediate: !0
|
|
232
|
-
}), I("slots", h), I("pageManager", r), I("forms", d), I("pageSchema",
|
|
232
|
+
}), I("slots", h), I("pageManager", r), I("forms", d), I("pageSchema", D), I("disabled", q(() => p.disabled));
|
|
233
233
|
function S(i = "default") {
|
|
234
|
-
return new Promise(async (v,
|
|
235
|
-
var
|
|
234
|
+
return new Promise(async (v, b) => {
|
|
235
|
+
var M;
|
|
236
236
|
if (!c.value) {
|
|
237
237
|
const H = x(c, async () => {
|
|
238
238
|
H(), v(await S(i));
|
|
239
239
|
});
|
|
240
240
|
return;
|
|
241
241
|
}
|
|
242
|
-
const g = (
|
|
242
|
+
const g = (M = d.value) == null ? void 0 : M[i];
|
|
243
243
|
if (!g)
|
|
244
|
-
return
|
|
245
|
-
const
|
|
246
|
-
v(
|
|
244
|
+
return b(`表单 [name=${i}] 不存在`), !1;
|
|
245
|
+
const k = G(await g.getData());
|
|
246
|
+
v(k);
|
|
247
247
|
});
|
|
248
248
|
}
|
|
249
249
|
function t(i = "default") {
|
|
250
|
-
return new Promise(async (v,
|
|
251
|
-
var
|
|
250
|
+
return new Promise(async (v, b) => {
|
|
251
|
+
var k;
|
|
252
252
|
if (!c.value) {
|
|
253
|
-
const
|
|
254
|
-
|
|
253
|
+
const M = x(c, async () => {
|
|
254
|
+
M(), v(await t(i));
|
|
255
255
|
});
|
|
256
256
|
return;
|
|
257
257
|
}
|
|
258
|
-
const g = (
|
|
258
|
+
const g = (k = d.value) == null ? void 0 : k[i];
|
|
259
259
|
if (!g)
|
|
260
|
-
return
|
|
260
|
+
return b(`表单 [name=${i}] 不存在`), !1;
|
|
261
261
|
try {
|
|
262
262
|
await g.validate();
|
|
263
|
-
const
|
|
264
|
-
v(
|
|
265
|
-
} catch (
|
|
266
|
-
|
|
263
|
+
const M = await g.getData();
|
|
264
|
+
v(M);
|
|
265
|
+
} catch (M) {
|
|
266
|
+
b(M);
|
|
267
267
|
}
|
|
268
268
|
});
|
|
269
269
|
}
|
|
270
270
|
function y(i, v = "default") {
|
|
271
271
|
var g;
|
|
272
272
|
if (!c.value) {
|
|
273
|
-
const
|
|
274
|
-
|
|
273
|
+
const k = x(c, () => {
|
|
274
|
+
k(), y(i, v);
|
|
275
275
|
});
|
|
276
276
|
return;
|
|
277
277
|
}
|
|
278
|
-
const
|
|
279
|
-
if (!
|
|
278
|
+
const b = (g = d.value) == null ? void 0 : g[v];
|
|
279
|
+
if (!b)
|
|
280
280
|
return console.error(`表单 [name=${v}] 不存在`), !1;
|
|
281
|
-
|
|
281
|
+
b.setData(i);
|
|
282
282
|
}
|
|
283
283
|
function l(i = "default") {
|
|
284
|
-
return new Promise(async (v,
|
|
285
|
-
var
|
|
284
|
+
return new Promise(async (v, b) => {
|
|
285
|
+
var k;
|
|
286
286
|
if (!c.value) {
|
|
287
|
-
const
|
|
288
|
-
|
|
287
|
+
const M = x(c, async () => {
|
|
288
|
+
M(), v(await l(i));
|
|
289
289
|
});
|
|
290
290
|
return;
|
|
291
291
|
}
|
|
292
|
-
const g = (
|
|
292
|
+
const g = (k = d.value) == null ? void 0 : k[i];
|
|
293
293
|
if (!g)
|
|
294
|
-
return
|
|
294
|
+
return b(`表单 [name=${i}] 不存在`), !1;
|
|
295
295
|
v(g);
|
|
296
296
|
});
|
|
297
297
|
}
|
|
298
298
|
const { proxy: f } = le();
|
|
299
|
-
function
|
|
299
|
+
function _() {
|
|
300
300
|
const i = x(
|
|
301
301
|
() => r.mountMonitor.isAllMounted.value,
|
|
302
302
|
(v) => {
|
|
@@ -314,38 +314,41 @@ const De = {
|
|
|
314
314
|
setData: y,
|
|
315
315
|
validate: t,
|
|
316
316
|
getFormInstance: l
|
|
317
|
-
}), (i, v) =>
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
317
|
+
}), (i, v) => {
|
|
318
|
+
var b;
|
|
319
|
+
return !w(B).initialized.value || ((b = D.schemas) == null ? void 0 : b.length) === 0 ? ($(), K("div", De)) : ($(), P(j, {
|
|
320
|
+
key: E.value,
|
|
321
|
+
onResolve: _
|
|
322
|
+
}, {
|
|
323
|
+
default: C(() => [
|
|
324
|
+
V("div", ke, [
|
|
325
|
+
($(!0), K(re, null, ie(D.schemas, (g, k) => ($(), P(w(ae), {
|
|
326
|
+
key: k,
|
|
327
|
+
componentSchema: g
|
|
328
|
+
}, null, 8, ["componentSchema"]))), 128))
|
|
329
|
+
])
|
|
330
|
+
]),
|
|
331
|
+
fallback: C(() => [
|
|
332
|
+
V("div", Ee, [
|
|
333
|
+
N(w(s))
|
|
334
|
+
])
|
|
335
|
+
]),
|
|
336
|
+
_: 1
|
|
337
|
+
}));
|
|
338
|
+
};
|
|
336
339
|
}
|
|
337
340
|
}), Me = { class: "min-w-750px rounded" }, Ce = { class: "h-full rounded" }, xe = /* @__PURE__ */ Q({
|
|
338
341
|
__name: "index",
|
|
339
342
|
setup(e, { expose: n }) {
|
|
340
|
-
const a = B.getComponent("monacoEditor"), s = B.getComponent("modal"), r = m(null), u = m(!1), h = m(!1), d = m({}), c = ce("pageSchema"), p = m(null),
|
|
341
|
-
function
|
|
343
|
+
const a = B.getComponent("monacoEditor"), s = B.getComponent("modal"), r = m(null), u = m(!1), h = m(!1), d = m({}), c = ce("pageSchema"), p = m(null), E = m("");
|
|
344
|
+
function D() {
|
|
342
345
|
h.value = !1;
|
|
343
346
|
}
|
|
344
347
|
function S() {
|
|
345
348
|
u.value = !1;
|
|
346
349
|
}
|
|
347
350
|
function t() {
|
|
348
|
-
u.value = !0,
|
|
351
|
+
u.value = !0, E.value = me();
|
|
349
352
|
}
|
|
350
353
|
async function y() {
|
|
351
354
|
try {
|
|
@@ -361,9 +364,9 @@ const De = {
|
|
|
361
364
|
}
|
|
362
365
|
return n({
|
|
363
366
|
handleOpen: t
|
|
364
|
-
}), (l, f) => ($(), P(
|
|
367
|
+
}), (l, f) => ($(), P(w(s), {
|
|
365
368
|
modelValue: u.value,
|
|
366
|
-
"onUpdate:modelValue": f[1] || (f[1] = (
|
|
369
|
+
"onUpdate:modelValue": f[1] || (f[1] = (_) => u.value = _),
|
|
367
370
|
title: "预览",
|
|
368
371
|
class: "w-900px",
|
|
369
372
|
width: "900px",
|
|
@@ -371,26 +374,26 @@ const De = {
|
|
|
371
374
|
onOk: y,
|
|
372
375
|
okText: "输出结果"
|
|
373
376
|
}, {
|
|
374
|
-
default:
|
|
377
|
+
default: C(() => [
|
|
375
378
|
V("div", Me, [
|
|
376
|
-
($(), P(
|
|
377
|
-
key:
|
|
379
|
+
($(), P(w(_e), {
|
|
380
|
+
key: E.value,
|
|
378
381
|
ref_key: "kb",
|
|
379
382
|
ref: p,
|
|
380
|
-
"page-schema":
|
|
383
|
+
"page-schema": w(c)
|
|
381
384
|
}, null, 8, ["page-schema"])),
|
|
382
|
-
N(
|
|
385
|
+
N(w(s), {
|
|
383
386
|
modelValue: h.value,
|
|
384
|
-
"onUpdate:modelValue": f[0] || (f[0] = (
|
|
387
|
+
"onUpdate:modelValue": f[0] || (f[0] = (_) => h.value = _),
|
|
385
388
|
title: "表单数据",
|
|
386
389
|
class: "w-860px",
|
|
387
390
|
width: "860px",
|
|
388
|
-
onClose:
|
|
389
|
-
onOk:
|
|
391
|
+
onClose: D,
|
|
392
|
+
onOk: D
|
|
390
393
|
}, {
|
|
391
|
-
default:
|
|
394
|
+
default: C(() => [
|
|
392
395
|
V("div", Ce, [
|
|
393
|
-
N(
|
|
396
|
+
N(w(a), {
|
|
394
397
|
ref_key: "monacoEditorRef",
|
|
395
398
|
ref: r,
|
|
396
399
|
autoToggleTheme: "",
|
|
@@ -444,7 +447,7 @@ defineExpose({
|
|
|
444
447
|
setup(e, { expose: n, emit: a }) {
|
|
445
448
|
const s = R(() => import("./index-DHI4gLFF.js")), r = R(() => import("./index-H4zzFoVP.js")), u = R(() => import("./index-CrlfGxIp.js")), h = R(() => import("./index-DWCjsALD.js")), d = R(() => import("./index-B4P9zbh-.js")), c = W(), p = e;
|
|
446
449
|
c.setDesignMode(), c.setDefaultComponentIds(p.defaultSchema.schemas);
|
|
447
|
-
const
|
|
450
|
+
const E = a, D = m(null), S = Z({
|
|
448
451
|
checkedNode: null,
|
|
449
452
|
hoverNode: null,
|
|
450
453
|
disableHover: !1,
|
|
@@ -463,9 +466,9 @@ defineExpose({
|
|
|
463
466
|
immediate: !0
|
|
464
467
|
}), I("pageSchema", t), I("pageManager", c), I("designerProps", q(() => p)), I("designer", {
|
|
465
468
|
setCheckedNode: f,
|
|
466
|
-
setHoverNode:
|
|
469
|
+
setHoverNode: _,
|
|
467
470
|
setDisableHover: i,
|
|
468
|
-
handleToggleDeviceMode:
|
|
471
|
+
handleToggleDeviceMode: M,
|
|
469
472
|
reset: g,
|
|
470
473
|
state: S
|
|
471
474
|
});
|
|
@@ -475,7 +478,7 @@ defineExpose({
|
|
|
475
478
|
async function f(o = t.schemas[0]) {
|
|
476
479
|
S.checkedNode = o, S.matched = pe(t.schemas, o.id);
|
|
477
480
|
}
|
|
478
|
-
async function
|
|
481
|
+
async function _(o = null) {
|
|
479
482
|
var L;
|
|
480
483
|
if (!o || S.disableHover)
|
|
481
484
|
return S.hoverNode = null, !1;
|
|
@@ -485,7 +488,7 @@ defineExpose({
|
|
|
485
488
|
}
|
|
486
489
|
function T() {
|
|
487
490
|
J(() => {
|
|
488
|
-
|
|
491
|
+
E("ready", { pageManager: c });
|
|
489
492
|
});
|
|
490
493
|
}
|
|
491
494
|
async function i(o = !1) {
|
|
@@ -494,55 +497,55 @@ defineExpose({
|
|
|
494
497
|
function v(o) {
|
|
495
498
|
z(t, o);
|
|
496
499
|
}
|
|
497
|
-
function
|
|
500
|
+
function b() {
|
|
498
501
|
return X(t);
|
|
499
502
|
}
|
|
500
503
|
function g() {
|
|
501
|
-
he(t.schemas, p.defaultSchema.schemas) && t.script === p.defaultSchema.script || (z(t.schemas, p.defaultSchema.schemas), t.script = p.defaultSchema.script, f(t.schemas[0]), Y.push(t.schemas, "重置操作"),
|
|
504
|
+
he(t.schemas, p.defaultSchema.schemas) && t.script === p.defaultSchema.script || (z(t.schemas, p.defaultSchema.schemas), t.script = p.defaultSchema.script, f(t.schemas[0]), Y.push(t.schemas, "重置操作"), E("reset", t));
|
|
502
505
|
}
|
|
503
|
-
function
|
|
504
|
-
|
|
506
|
+
function k() {
|
|
507
|
+
E("save", X(t));
|
|
505
508
|
}
|
|
506
|
-
function
|
|
507
|
-
|
|
509
|
+
function M(o) {
|
|
510
|
+
E("toggleDeviceMode", o);
|
|
508
511
|
}
|
|
509
512
|
function H() {
|
|
510
|
-
|
|
513
|
+
D.value.handleOpen();
|
|
511
514
|
}
|
|
512
515
|
return l(), n({
|
|
513
516
|
setData: v,
|
|
514
|
-
getData:
|
|
517
|
+
getData: b,
|
|
515
518
|
reset: g,
|
|
516
519
|
preview: H
|
|
517
|
-
}), (o, L) =>
|
|
520
|
+
}), (o, L) => w(B).initialized.value ? ($(), P(j, {
|
|
518
521
|
key: 1,
|
|
519
522
|
onResolve: T
|
|
520
523
|
}, {
|
|
521
|
-
default:
|
|
524
|
+
default: C(() => [
|
|
522
525
|
V("div", $e, [
|
|
523
526
|
V("div", Te, [
|
|
524
527
|
A(o.$slots, "header", {}, () => [
|
|
525
|
-
p.hiddenHeader ? ue("", !0) : ($(), P(
|
|
528
|
+
p.hiddenHeader ? ue("", !0) : ($(), P(w(s), {
|
|
526
529
|
key: 0,
|
|
527
530
|
onPreview: H,
|
|
528
|
-
onSave:
|
|
531
|
+
onSave: k
|
|
529
532
|
}, {
|
|
530
|
-
header:
|
|
533
|
+
header: C(() => [
|
|
531
534
|
A(o.$slots, "header-prefix")
|
|
532
535
|
]),
|
|
533
|
-
prefix:
|
|
536
|
+
prefix: C(() => [
|
|
534
537
|
A(o.$slots, "header-prefix")
|
|
535
538
|
]),
|
|
536
|
-
title:
|
|
539
|
+
title: C(() => [
|
|
537
540
|
A(o.$slots, "header-title")
|
|
538
541
|
]),
|
|
539
|
-
"right-prefix":
|
|
542
|
+
"right-prefix": C(() => [
|
|
540
543
|
A(o.$slots, "header-right-prefix")
|
|
541
544
|
]),
|
|
542
|
-
"right-action":
|
|
545
|
+
"right-action": C(() => [
|
|
543
546
|
A(o.$slots, "header-right-action")
|
|
544
547
|
]),
|
|
545
|
-
"right-suffix":
|
|
548
|
+
"right-suffix": C(() => [
|
|
546
549
|
A(o.$slots, "header-right-suffix")
|
|
547
550
|
]),
|
|
548
551
|
_: 3
|
|
@@ -552,19 +555,19 @@ defineExpose({
|
|
|
552
555
|
V("div", {
|
|
553
556
|
class: de(["epic-split-view-container", { "hidden-header": o.hiddenHeader }])
|
|
554
557
|
}, [
|
|
555
|
-
N(
|
|
556
|
-
N(
|
|
557
|
-
N(
|
|
558
|
+
N(w(r)),
|
|
559
|
+
N(w(u)),
|
|
560
|
+
N(w(h))
|
|
558
561
|
], 2),
|
|
559
562
|
N(xe, {
|
|
560
563
|
ref_key: "previewRef",
|
|
561
|
-
ref:
|
|
564
|
+
ref: D
|
|
562
565
|
}, null, 512)
|
|
563
566
|
])
|
|
564
567
|
]),
|
|
565
|
-
fallback:
|
|
568
|
+
fallback: C(() => [
|
|
566
569
|
V("div", Ne, [
|
|
567
|
-
N(
|
|
570
|
+
N(w(d))
|
|
568
571
|
])
|
|
569
572
|
]),
|
|
570
573
|
_: 3
|