@vtj/renderer 0.8.4 → 0.8.5
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 +5 -5
- package/dist/index.mjs +223 -220
- package/package.json +6 -6
- package/types/version.d.ts +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("@vtj/core"),u=require("@vtj/utils"),j=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("@vtj/core"),u=require("@vtj/utils"),j=require("vue"),te=require("vue-router"),T=require("element-plus"),D=require("mockjs"),we=require("@vueuse/core"),je=require("@vtj/ui");function $e(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const A=$e(j);/**!
|
|
2
2
|
* Copyright (c) 2024, VTJ.PRO All rights reserved.
|
|
3
3
|
* @name @vtj/renderer
|
|
4
4
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
5
|
-
* @version 0.8.
|
|
5
|
+
* @version 0.8.5
|
|
6
6
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
7
|
-
*/const F="0.8.
|
|
8
|
-
`)+o;const a=`with(${t?"{}":"$scope || {}"}) { ${o} }`;return new Function("$scope",a)(e)}catch(s){if(u.logger.error("parseExpression.error",s,n,e?.__self??e),r)throw s}}function
|
|
7
|
+
*/const F="0.8.5";var S=(n=>(n.Runtime="Runtime",n.Design="Design",n.Raw="Raw",n.VNode="VNode",n))(S||{});const J=["$el","$emit","$nextTick","$parent","$root","$attrs","$slots","$watch","$props","$options","$forceUpdate"],Ce=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeUnmount","unmounted","errorCaptured","renderTracked","renderTriggered","activated","deactivated"],re=["vIf","vShow","vModel","vFor","vBind"],ne={String,Number,Boolean,Array,Object,Function,Date};function I(n,e){return n.map(t=>u.isUrl(t)?t:`${e}${t}`)}function B(n){return/\.css$/.test(n)}function N(n){return/\.js$/.test(n)}function se(n){return/\.json$/.test(n)}function Ee(n){return n.map(e=>`<script src="${u.url.append(e,{v:F})}"><\/script>`).join("")}function Pe(n=[]){return n.map(e=>`<link rel="stylesheet" href="${u.url.append(e,{v:F})}" />`).join("")}function oe(n,e){const t=n.filter(d=>!!d.enabled),r=[],s=[],o=[],a=[],i={},l={},c=[],m={};return t.forEach(({urls:d,assetsUrl:f,library:v,assetsLibrary:h,localeLibrary:g})=>{d?.forEach(p=>{N(p)&&r.push(p),B(p)&&s.push(p)}),v&&(a.push(v),i[v]=I(d||[],e),g&&(l[v]=g)),f&&o.push(f),h&&c.push(h),v&&h&&(m[h]=v)}),{scripts:I(r,e),css:I(s,e),materials:I(o,e),libraryExports:a,materialExports:u.dedupArray(c),materialMapLibrary:m,libraryMap:i,libraryLocaleMap:l}}function ie(n,e){const{name:t,parent:r,alias:s}=n;return r?e[r]?.[s||t]:e[s||t]}function V(n){return u.isString(n)?n:JSON.stringify(n)}function Y(n,e,t){const r=n.CSSStyleSheet;if(r.prototype.replaceSync){const s=new r;s.id=e,s.replaceSync(t);const o=n.document,a=o.adoptedStyleSheets,i=Array.from(a).filter(l=>l.id!==e);o.adoptedStyleSheets=[...i,s]}else{const s=n.document;let o=s.getElementById(e);o?o.innerHTML=t:(o=s.createElement("style"),o.id=e,o.innerHTML=t,s.head.appendChild(o))}}async function ae(n,e){const t=await window.fetch(e).then(r=>r.text()).catch(()=>"");t&&Y(window,n,t)}function K(n,e=window){const t=e.document,r=e.document.head;for(const s of n)if(!t.getElementById(s)){const a=t.createElement("link");a.rel="stylesheet",a.id=s,a.href=s,r.appendChild(a)}}async function ce(n,e,t=window){const r=t.document,s=t.document.head;let o=t[e];return o?o.default||o:new Promise((a,i)=>{for(const l of n){const c=r.createElement("script");c.src=l,c.onload=()=>{o=t[e],o&&a(o.default||o)},c.onerror=m=>{i(m)},s.appendChild(c)}})}function le(n){return u.isFunction(n)||u.isFunction(n?.install)}function R(n,e,t=!1,r=!1){try{const s=['"use strict";',"var __self = arguments[0];"];s.push("return ");let o=(n.value||"").trim();o=o.replace(/this(\W|$)/g,(i,l)=>`__self${l}`),o=s.join(`
|
|
8
|
+
`)+o;const a=`with(${t?"{}":"$scope || {}"}) { ${o} }`;return new Function("$scope",a)(e)}catch(s){if(u.logger.error("parseExpression.error",s,n,e?.__self??e),r)throw s}}function L(n,e,t=!1,r=!1){const s=R(n,e,t,r);if(typeof s!="function"&&(u.logger.error("parseFunction.error","not a function",n,e?.__self??e),r))throw new Error(`"${n.value}" not a function`);return s}function w(n){return n&&n.type==="JSExpression"}function O(n){return typeof n=="object"&&n&&n.type==="JSFunction"}function ue(n){return w(n)||O(n)}function be(n){return ue(n)?n.value:JSON.stringify(n)}let b=null;const Fe=u.createRequest({settings:{type:"form",validSuccess:!0,originResponse:!1,loading:!0,validate:n=>n.data?.code===0||!!n.data?.success,failMessage:!0,showError:n=>{T.ElNotification.error({message:n||"未知错误"})},showLoading:()=>{b&&b.close(),b=T.ElLoading.service({lock:!0,text:"Loading",background:"rgba(0, 0, 0, 0.05)"})},hideLoading:()=>{b&&(b.close(),b=null)}}});function pe(n,e){const{jsonp:t,request:r}=e;if(n.method==="jsonp")return(s={})=>t(n.url,{...n.jsonpOptions,query:s});{const s=n.headers?R(n.headers,{},!0):void 0,o={url:n.url,method:n.method,settings:{...n.settings,headers:s}};return(a,i)=>r.send(u.merge(o,i||{},{data:a}))}}function de(n=[],e){return n.reduce((t,r)=>(t[r.id]=pe(r,e),t),{})}function fe(n=[]){D.setup({timeout:"50-500"}),X(),n.forEach(e=>me(e))}function me(n){if(!n.mock)return;const{url:e,mockTemplate:t}=n;if(e&&t){const r=u.pathToRegexp(`${e}(.*)`),s=u.pathToRegexpMatch(e,{decode:decodeURIComponent}),o=R(t,{},!0);D.mock(r,a=>{const i=u.url.parse(a.url)||{},l=a.body instanceof FormData?u.formDataToJson(a.body):a.body,c=s(a.url)?.params;return Object.assign(a,{data:l,params:i,query:c}),D.mock(o(a))})}}function X(){D._mocked={}}class he{__id=null;__mode;__instance=null;__contextRefs={};__refs={};context={};state={};props={};$props={};$refs={};$el=null;$emit=null;$nextTick=null;$parent=null;$root=null;$attrs=null;$slots=null;$watch=null;$options=null;$forceUpdate=null;$components={};$libs={};$apis={};__transform={};constructor(e){const{mode:t,dsl:r,attrs:s}=e;this.__mode=t,r&&(this.__id=r.id||null,this.__transform=r.transform||{}),s&&Object.assign(this,s)}setup(e,t=A){const r=t.getCurrentInstance();if(!r)return;this.__instance=r.proxy;const s=r.appContext.config.globalProperties;Object.assign(this,s),Object.assign(this,e||{}),this.__proxy(),t.onMounted(()=>{this.__proxy()}),t.onUnmounted(()=>{this.__cleanup()})}__proxy(){this.__instance&&J.forEach(e=>{this[e]=this.__instance?.[e]})}__cleanup(){J.forEach(e=>{this[e]=null})}__parseFunction(e){if(e)if(this.__mode===S.Runtime){const{id:t,type:r}=e,s=t?this.__transform[t]??e.value:e.value;return L({type:r,value:s},this)}else return L(e,this)}__parseExpression(e){if(e)if(this.__mode===S.Runtime){const{id:t,type:r}=e,s=t?this.__transform[t]??e.value:e.value;return R({type:r,value:s},this)}else return R(e,this)}__ref(e=null,t){if(this.__mode!==S.VNode)return e&&e!==this.__id&&(this.__contextRefs[e]=this),r=>{let s=r?.$vtjEl||r?.$el||r;if(!s){typeof t=="string"&&(delete this.$refs[t],e&&delete this.__refs[e]);return}if(s.nodeType===3&&s.nextSibling&&(s=s.nextSibling),s.__vtj__=e,S.Design===this.__mode&&(s.__context__=this),e&&(this.__refs[e]=r),typeof t=="function")t(r);else if(t){const o=this.$refs[t];if(o){const a=new Set([].concat(o,r));this.$refs[t]=Array.from(a)}else this.$refs[t]=r}return r}}__clone(e={}){const t={...this.context,...e},r={...t,context:t};return r.context.__proto__=this.context,r.__proto__=this,r}}function x(n){const{Vue:e=A,mode:t=S.Runtime,components:r={},libs:s={},apis:o={},loader:a}=n,i=e.computed(()=>n.dsl),l={$components:r,$libs:s,$apis:o},c=new he({mode:t,dsl:i.value,attrs:l}),m=e.defineComponent({name:i.value.name,props:{...Re(i.value.props??[],c)},setup(d){c.$props=d,c.props=d,i.value.id&&Y(n.window||window,i.value.id,i.value.css||""),c.state=Ie(e,i.value.state??{},c);const f=He(e,i.value.computed??{},c),v=Oe(i.value.methods??{},c),h=Me(e,i.value.inject,c),g=ve(i.value.dataSources||{},c),p={...h,...f,...v,...g};return c.setup(p,e),Te(e,i.value.watch??[],c),{vtj:c}},emits:[...i.value.emits??[]],expose:["vtj"],render(){if(!i.value.nodes)return null;const d=i.value.nodes||[];return d.length===1?H(d[0],c,e,a):d.map(f=>H(f,c,e,a))},...De(i.value.lifeCycles??{},c)});return{renderer:e.markRaw(m),context:c}}function Re(n=[],e){const t=r=>r?(Array.isArray(r)?r:[r]).map(o=>ne[o]):void 0;return n.map(r=>u.isString(r)?{name:r}:{name:r.name,type:r.type,required:r.required,default:w(r.default)?e.__parseExpression(r.default):r.default}).reduce((r,s)=>(r[s.name]={type:t(s.type),required:s.required,default:s.default},r),{})}function Ie(n,e,t){return n.reactive(Object.keys(e||{}).reduce((r,s)=>{let o=e[s];return w(o)?o=t.__parseExpression(o):O(o)&&(o=t.__parseFunction(o)),r[s]=o,r},{}))}function He(n,e,t){return Object.entries(e??{}).reduce((r,[s,o])=>(r[s]=n.computed(t.__parseFunction(o)),r),{})}function Oe(n,e){return Object.entries(n??{}).reduce((t,[r,s])=>(t[r]=e.__parseFunction(s),t),{})}function Me(n,e=[],t){return e.reduce((r,s)=>{const{name:o,from:a}=s||{};s.default;const i=w(a)?t.__parseExpression(a)||o:a??o,l=w(s.default)?t.__parseExpression(s.default):s.default??null;return r[o]=n.inject(i,l),r},{})}function ve(n,e){return Object.keys(n).reduce((t,r)=>{const s=n[r],o=e.$apis[s.ref],a=O(s.transform)?s.transform.value?e.__parseFunction(s.transform):void 0:s.transform;return t[r]=async(...i)=>{const l=await o.apply(e,i);return a?a(l):l},t},{})}function Te(n,e=[],t){e.forEach(r=>{n.watch(t.__parseExpression(r.source),t.__parseFunction(r.handler),{deep:r.deep,immediate:r.immediate})})}function De(n,e){return Object.entries(n??{}).reduce((t,[r,s])=>(t[r]=e.__parseFunction(s),t),{})}let q=[];const ge=n=>n;async function W(n,e=window){const{urls:t=[],library:r}=n,s=t.filter(l=>N(l));if(s.length===0||!r)return null;const o=t.filter(l=>B(l));let a;const i=await ce(s,r,e).catch(()=>null);return i?.plugin&&(a=i.plugin),a?{component:a,css:o}:null}function k(n){const{getDsl:e,getDslByUrl:t,options:r}=n;return r.window&&(q.forEach(s=>{delete r.window[s]}),q=[]),(s,o,a=A)=>!o||typeof o=="string"?s:o.type==="Schema"&&o.id?a.defineAsyncComponent(async()=>{const i=await e(o.id);return i&&(i.name=s),i?x({...r,Vue:a,dsl:i,mode:S.Runtime,loader:k(n)}).renderer:null}):o.type==="UrlSchema"&&o.url?a.defineAsyncComponent(async()=>{const i=await t(o.url);return i&&(i.name=s),i?x({...r,Vue:a,dsl:i,mode:S.Runtime,loader:k(n)}).renderer:null}):o.type==="Plugin"?(o.library&&q.push(o.library),a.defineAsyncComponent(async()=>{const i=await W(o,r.window);return i?(K(i.css,r.window),i.component):null})):s}function H(n,e,t=A,r=ge){if(!n||!n.name||n.invisible)return null;const{id:s=null,directives:o=[]}=n,{vIf:a,vFor:i,vShow:l,vModels:c,vBind:m}=xe(o);if(a&&!ke(a,e))return null;const d=f=>{const v=f.$components,h=(()=>{if(n.name==="component")return Ae(f,n.props?.is);if(n.name==="slot")return n.name;const _=r(n.name,n.from,t);return u.isString(_)?v[_]??_:_})(),g=Be(s,n.props??{},f),p=Ne(t,n.events??{},f);if(n.name==="slot")return Ue(t,n,g,f,r);m&&Object.assign(g,f.__parseExpression(m.value)),l&&(g.style=Object.assign(g.style??{},Je(l,f))),c.forEach(_=>{Object.assign(g,Le(t,_,f))});const $=Ve(t,n.children??[],f,r,n);return t.createVNode(h,{...g,...p},$)};return i?Xe(i,d,e):d(e)}function xe(n=[]){const e=n.find(i=>u.camelCase(i.name)==="vIf"),t=n.find(i=>u.camelCase(i.name)==="vFor"),r=n.find(i=>u.camelCase(i.name)==="vShow"),s=n.find(i=>u.camelCase(i.name)==="vBind"),o=n.filter(i=>u.camelCase(i.name)==="vModel"),a=n.filter(i=>!re.includes(u.camelCase(i.name)));return{vIf:e,vFor:t,vShow:r,vModels:o,vBind:s,others:a}}function ke(n,e){return!!e.__parseExpression(n.value)}function Ae(n,e){return e?w(e)?n.__parseExpression(e):e:"div"}function Be(n,e,t){const r=Object.keys(e||{}).reduce((s,o)=>{let a=e[o];return w(a)?a=t.__parseExpression(a):O(a)&&(a=t.__parseFunction(a)),s[o]=a,s},{});return r.ref=t.__ref(n,r.ref),r}function Ne(n,e,t){const r=["passive","capture","once"],s={capture:"Capture",once:"Once",passive:"OnceCapture"};return Object.keys(e||{}).reduce((o,a)=>{const i=e[a],l=z(i.modifiers),c=l.find(f=>r.includes(f)),m="on"+u.upperFirst(a)+(c&&s[c]||""),d=t.__parseFunction(i.handler);return d&&(o[m]=n.withModifiers(d,l)),o},{})}function z(n={},e=!1){const t=Object.keys(n);return e?t.map(r=>"."+r):t}function Ue(n,e,t,r,s){const{children:o}=e,a=qe(e,r),i=r.$slots?.[a.name];return i?i(t):o?u.isString(o)?n.createTextVNode(o):w(o)?n.createTextVNode(V(r.__parseExpression(o))):Array.isArray(o)?o.map(l=>H(l,r,n,s)):null:null}function qe(n,e){const{props:t}=n,r=t?.name||"default";return{name:w(r)?e.__parseExpression(r):r,params:[]}}function Je(n,e){return e.__parseExpression(n.value)?{}:{display:"none"}}function Le(n,e,t){const r={type:"JSFunction",value:e.value?.value?`(v) => {
|
|
9
9
|
${e.value.value} = v;
|
|
10
|
-
}`:"(v) => {}"},s=t.__parseFunction(r),o=W(e.modifiers),a=w(e.arg)?t.__parseExpression(e.arg):e.arg||"modelValue";return{[a]:t.__parseExpression(e.value),[`onUpdate:${a}`]:o.length&&s?n.withModifiers(s,o):s}}function Le(n,e,t,r,s){if(!e)return null;if(u.isString(e))return{default:()=>e};if(w(e))return{default:()=>L(t.__parseExpression(e))};if(Array.isArray(e)&&e.length>0){const o=Ve(e),a=i=>!i||!s?{}:s?.id&&Object.keys(i).length?{[`scope_${s.id}`]:i}:{};return Object.entries(o).reduce((i,[l,{nodes:c,params:m}])=>(i[l]=d=>{const f=m.length?u.pick(d??{},m):a(d);return c.map(v=>H(v,t.__clone(f),n,r))},i),{})}return null}function Ve(n){const e={default:{params:[],nodes:[]}};for(const t of n){const r=Ye(t.slot),s=r.name;e[s]?(e[s].nodes.push(t),e[s].params=e[s].params.concat(r.params)):e[s]={nodes:[t],params:r.params}}return e}function Ye(n="default"){return u.isString(n)?{name:n,params:[]}:{params:[],...n}}function Ke(n,e,t){const{value:r,iterator:s}=n,{item:o="item",index:a="index"}=s||{};let i=t.__parseExpression(r)||[];return Number.isInteger(i)&&(i=new Array(i).fill(!0).map((l,c)=>c+1)),Array.isArray(i)?i.map((l,c)=>e(t.__clone({[o]:l,[a]:c}))):(console.warn("[vForRender]:",`${r?.value} is not a Arrary`),[])}const Z=j.defineComponent({name:"VtjPageContainer",async setup(){const n=G(),e=ee.useRoute(),t=e.params.id,r=t?n.getPage(t):n.getHomepage(),s=r?await n.getRenderComponent(r.id):null;return r&&Se.useTitle(r.title||"VTJ"),{provider:n,component:s,file:r,query:e.query}},render(){return this.component?j.h(this.component,this.query):j.h("div","页面不存在")}}),Xe=j.defineComponent({name:"VtjStartupContainer",render(){return j.h(we.XStartup)}}),z=Symbol("Provider");class ge extends C.Base{mode;globals={};modules={};adapter={request:be,jsonp:u.jsonp};apis={};dependencies={};materials={};library={};service;project=null;components={};nodeEnv="development";router=null;materialPath="./";urlDslCaches={};constructor(e){super();const{service:t,mode:r=S.Raw,dependencies:s,materials:o,project:a={},adapter:i={},globals:l={},modules:c={},router:m=null,materialPath:d="./",nodeEnv:f="development"}=e;this.mode=r,this.modules=c,this.service=t,this.router=m,this.materialPath=d,this.nodeEnv=f,s&&(this.dependencies=s),o&&(this.materials=o),Object.assign(this.globals,l),Object.assign(this.adapter,i),r!==S.Design&&this.load(a)}async load(e){const t=this.modules[`.vtj/projects/${e.id}.json`];if(this.project=t?await t():await this.service.init(e),!this.project)throw new Error("project is null");const{dependencies:r=[],apis:s}=this.project,{dependencies:o,library:a,components:i,materialPath:l}=this,{libraryExports:c,libraryMap:m,materials:d,materialExports:f,materialMapLibrary:v}=se(r,l),h=window;h.CKEDITOR_VERSION=void 0;for(const p of c){const $=o[p],_=h[p];if(_)a[p]=_;else if($)h[p]=a[p]=await $();else{const P=m[p]||[];for(const E of P)B(E)&&await ie(p,u.url.append(E,{v:F})),N(E)&&await u.loadScript(u.url.append(E,{v:F})),a[p]=h[p]}}for(const p of d)await u.loadScript(u.url.append(p,{v:F}));const g=this.materials||{};for(const p of f){const $=h[v[p]],_=C.BUILT_IN_COMPONENTS[p];if(_)$&&_.forEach(P=>{i[P]=$[P]});else{const P=g[p]?(await g[p]()).default:h[p];P&&$&&(P.components||[]).forEach(E=>{i[E.name]=oe(E,$)})}}s&&(this.apis=pe(s,this.adapter),K(),this.project.config?.mock&&de(s)),this.initRouter(),this.triggerReady()}initRouter(){const{router:e,project:t}=this;e&&(e.addRoute({path:"/page/:id",name:"VtjPage",component:Z}),e.addRoute({path:"/",name:"VtjHomepage",component:t?.homepage?Z:Xe}))}install(e){const t=e.config.globalProperties.installed||{};for(const[r,s]of Object.entries(this.library))!t[r]&&ce(s)&&(e.use(s),t[r]=!0);e.provide(z,this),e.config.globalProperties.installed=t}getFile(e){const{blocks:t=[]}=this.project||{};return this.getPage(e)||t.find(r=>r.id===e)||null}getPage(e){const{pages:t=[]}=this.project||{},r=(s,o=[])=>{for(const a of o){if(a.id===s)return a;if(a.children&&a.children.length){const i=r(s,a.children);if(i)return i}}};return r(e,t)||null}getHomepage(){const{homepage:e}=this.project||{};return e?this.getPage(e):null}async getDsl(e){const t=this.modules[`.vtj/files/${e}.json`];return t?await t():this.service.getFile(e).catch(()=>null)}async getDslByUrl(e){const t=this.urlDslCaches[e];return t||(this.urlDslCaches[e]=this.adapter.request.send({url:e,method:"get",settings:{validSuccess:!1,originResponse:!0}}).then(r=>r.data).catch(()=>null))}createDslRenderer(e,t={}){const{library:r,components:s,mode:o,apis:a}=this,i={mode:o,Vue:r.Vue,components:s,libs:r,apis:a,window,...t},l=k({getDsl:async c=>await this.getDsl(c)||null,getDslByUrl:async c=>await this.getDslByUrl(c)||null,options:i});return x({...i,dsl:e,loader:l})}async getRenderComponent(e){const t=this.getFile(e);if(!t)return u.logger.warn(`Can not find file: ${e}`),null;const r=`.vtj/vue/${e}.vue`,s=this.modules[r];if(s)return(await s())?.default;const o=await this.getDsl(t.id);return o?this.createDslRenderer(o).renderer:(u.logger.warn(`Can not find dsl: ${e}`),null)}defineUrlSchemaComponent(e,t){return j.defineAsyncComponent(async()=>{const r=await this.getDslByUrl(e);return r?(r.name=t||r.name,this.createDslRenderer(r).renderer):null})}definePluginComponent(e){return j.defineAsyncComponent(async()=>{const t=await X(e,window);return t?(Y(t.css),t.component):null})}}function We(n){const e=new ge(n);return{provider:e,onReady:r=>e.ready(r)}}function G(n={}){const e=j.inject(z);if(!e)throw new Error("Can not find provider");if(e.mode===S.Raw&&e.nodeEnv==="development"){const{id:t,version:r}=n;t&&r&&(async()=>{const s=await e.getDsl(t);s?.__VERSION__!==r&&T.ElNotification.warning({title:s?.name,message:"当前组件源码版本与运行时版本不一致,请重新发布组件"})})()}return e}const Q=new u.Request({settings:{type:"json",validSuccess:!0,originResponse:!1,failMessage:!0,validate:n=>n.data?.code===0,showError:n=>{T.ElNotification.error({message:n||"未知错误"})}}}),ze=(n="/vtj/local/repository/${type}.json")=>(e,t)=>Q.send({url:n,method:"post",query:{type:e},data:{type:e,data:t}}),Ge=(n="/vtj/local/repository/uploader.json")=>async(e,t)=>await Q.send({url:n,method:"post",data:{files:e,projectId:t},settings:{type:"data"}}).then(r=>r&&r[0]?r[0]:null).catch(()=>null);class U{api;pluginCaches={};uploader;constructor(){this.api=ze(),this.uploader=Ge()}async init(e){return console.log("BaseService.init",e),{}}async saveProject(e){return!!await this.api("saveProject",e).catch(()=>!1)}async saveMaterials(e,t){return console.log("BaseService.saveMaterials",e,t),!1}async saveFile(e){return console.log("BaseService.saveFile",e),!1}async getFile(e){return console.log("BaseService.getFile",e),{}}async removeFile(e){return console.log("BaseService.removeFile",e),!1}async saveHistory(e){return console.log("BaseService.saveHistory",e),!1}async removeHistory(e){return console.log("BaseService.removeHistory",e),!1}async getHistory(e){return console.log("BaseService.getHistory",e),{}}async getHistoryItem(e,t){return console.log("BaseService.getHistoryItem",e,t),{}}async saveHistoryItem(e,t){return console.log("BaseService.saveHistoryItem",e,t),!1}async removeHistoryItem(e,t){return console.log("BaseService.removeHistoryItem",e,t),!1}async publish(e){return!!await this.api("publish",e).catch(()=>!1)}async publishFile(e,t){return!!await this.api("publishFile",{project:e,file:t}).catch(()=>!1)}async genVueContent(e,t){return await this.api("genVueContent",{project:e,dsl:t}).catch(()=>"")}async createRawPage(e){return await this.api("createRawPage",e).catch(()=>"")}async removeRawPage(e){return await this.api("removeRawPage",e).catch(()=>"")}async uploadStaticFile(e,t){return await this.uploader(e,t).catch(()=>null)}async getStaticFiles(e){return await this.api("getStaticFiles",e).catch(()=>[])}async removeStaticFile(e,t){return await this.api("removeStaticFile",{name:e,projectId:t}).catch(()=>"")}async clearStaticFiles(e){return await this.api("clearStaticFiles",e).catch(()=>"")}async getPluginMaterial(e){const{urls:t=[]}=e,r=t.filter(o=>ne(o))[0];if(!r)return null;const s=this.pluginCaches[r];return s||(this.pluginCaches[r]=Q.send({url:r,method:"get",settings:{validSuccess:!1,originResponse:!0}}).then(o=>o.data).catch(()=>null))}}const y=new u.Storage({type:"local",expired:0,prefix:"__VTJ_"});class Qe extends U{init(e){const t=new C.ProjectModel(e),r=y.get(`project_${t.id}`),s=Object.assign(t.toDsl(),r||{});return y.save(`project_${t.id}`,s),Promise.resolve(s)}saveProject(e){const t=new C.ProjectModel(e);return y.save(`project_${t.id}`,t.toDsl()),Promise.resolve(!0)}saveMaterials(e,t){return y.save(`materials_${e.id}`,u.mapToObject(t)),Promise.resolve(!0)}saveFile(e){return y.save(`file_${e.id}`,e),Promise.resolve(!0)}getFile(e){const t=y.get(`file_${e}`);return t?Promise.resolve(t):Promise.reject(null)}removeFile(e){return y.remove(`file_${e}`),Promise.resolve(!0)}saveHistory(e){return y.save(`history_${e.id}`,e),Promise.resolve(!0)}removeHistory(e){const t=y.get(`history_${e}`);if(t){const s=(t.items||[]).map(o=>o.id);this.removeHistoryItem(e,s),y.remove(`history_${e}`)}return Promise.resolve(!0)}getHistory(e){const t=y.get(`history_${e}`),r=new C.HistoryModel(t||{id:e});return Promise.resolve(r.toDsl())}getHistoryItem(e,t){const r=y.get(`history_${e}_${t}`);return Promise.resolve(r)}saveHistoryItem(e,t){return y.save(`history_${e}_${t.id}`,t),Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(r=>{y.remove(`history_${e}_${r}`)}),Promise.resolve(!0)}}class ye extends U{projects={};materials={};files={};histories={};historyItems={};init(e){const t=new C.ProjectModel(e),r=this.projects[t.id]||{},s=Object.assign(t.toDsl(),r);return this.projects[s.id]=s,Promise.resolve(s)}saveProject(e){const t=new C.ProjectModel(e);return this.projects[t.id]=t.toDsl(),Promise.resolve(!0)}saveMaterials(e,t){return e.id&&(this.materials[e.id]=u.mapToObject(t)),Promise.resolve(!0)}saveFile(e){return this.files[e.id]=e,Promise.resolve(!0)}getFile(e){const t=this.files[e];return t?Promise.resolve(t):Promise.reject(null)}removeFile(e){return delete this.files[e],Promise.resolve(!0)}saveHistory(e){return this.histories[e.id]=e,Promise.resolve(!0)}removeHistory(e){const t=this.histories[e];if(t){const s=(t.items||[]).map(o=>o.id);this.removeHistoryItem(e,s),delete this.historyItems[e]}return Promise.resolve(!0)}getHistory(e){const t=this.histories[e],r=new C.HistoryModel(t||{id:e});return Promise.resolve(r)}getHistoryItem(e,t){const r=`${e}_${t}`,s=this.historyItems[r]||{};return Promise.resolve(s)}saveHistoryItem(e,t){const r=`${e}_${t.id}`;return this.historyItems[r]=t,Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(r=>{const s=`${e}_${r}`;delete this.historyItems[s]}),Promise.resolve(!0)}}let M=null;function Ze(){return M||(M=new ye,M)}class et extends U{getFileCaches={};async init(e){return await this.api("init",e).catch(()=>null)||{}}async saveProject(e){return!!await this.api("saveProject",e).catch(()=>!1)}async saveMaterials(e,t){return!!await this.api("saveMaterials",{project:e,materials:u.mapToObject(t)}).catch(()=>!1)}async saveFile(e){return!!await this.api("saveFile",e).catch(()=>!1)}async getFile(e){const t=this.getFileCaches[e];return t||(this.getFileCaches[e]=this.api("getFile",e).catch(()=>null)).finally(()=>{delete this.getFileCaches[e]})}async removeFile(e){return!!await this.api("removeFile",e).catch(()=>!1)}async saveHistory(e){return!!await this.api("saveHistory",e).catch(()=>!1)}async removeHistory(e){return!!await this.api("removeHistory",e).catch(()=>!1)}async getHistory(e){return await this.api("getHistory",e).catch(()=>null)||{}}async getHistoryItem(e,t){return await this.api("getHistoryItem",{fId:e,id:t}).catch(()=>null)||{}}async saveHistoryItem(e,t){return!!await this.api("saveHistoryItem",{fId:e,item:t}).catch(()=>!1)}async removeHistoryItem(e,t){return!!await this.api("removeHistoryItem",{fId:e,ids:t}).catch(()=>!1)}}function _e(n=[]){return n.map(e=>{const{id:t,title:r,icon:s,children:o,hidden:a}=e;return{id:t,title:r,icon:s,hidden:a,url:`/page/${t}`,children:o&&o.length?_e(o):void 0}})}function tt(){const n=G(),e=ee.useRoute(),t=j.ref(!1),r=n.project;j.watchEffect(()=>{const{name:a,params:i,meta:l}=e;if(a==="VtjPage"){const c=n.getPage(i.id);t.value=!c?.mask}else if(a==="VtjHomepage"){const c=n.getHomepage();t.value=!c?.mask}else t.value=!l.mask});const s=_e(r?.pages),o=r?.config;return{disabled:t,logo:o?.logo,themeSwitchable:o?.themeSwitchable,title:o?.title||r?.description||r?.name||"VTJ App",menus:s}}exports.BUILT_IN_DIRECTIVES=te;exports.BaseService=U;exports.CONTEXT_HOST=q;exports.Context=me;exports.ContextMode=S;exports.DATA_TYPES=re;exports.JSCodeToString=Ee;exports.LIFE_CYCLES_LIST=$e;exports.LocalService=et;exports.MemoryService=ye;exports.Provider=ge;exports.StorageService=Qe;exports.VTJ_RENDERER_VERSION=F;exports.adoptedStyleSheets=V;exports.createAssetScripts=Ce;exports.createAssetsCss=Pe;exports.createDataSources=he;exports.createLoader=k;exports.createMemoryService=Ze;exports.createProvider=We;exports.createRenderer=x;exports.createSchemaApi=ue;exports.createSchemaApis=pe;exports.defaultLoader=ve;exports.fillBasePath=I;exports.getModifiers=W;exports.getPlugin=X;exports.getRawComponent=oe;exports.isCSSUrl=B;exports.isJSCode=le;exports.isJSExpression=w;exports.isJSFunction=O;exports.isJSON=ne;exports.isJSUrl=N;exports.isVuePlugin=ce;exports.loadCss=ie;exports.loadCssUrl=Y;exports.loadScriptUrl=ae;exports.mockApi=fe;exports.mockApis=de;exports.mockCleanup=K;exports.nodeRender=H;exports.parseDeps=se;exports.parseExpression=R;exports.parseFunction=J;exports.providerKey=z;exports.toString=L;exports.useMask=tt;exports.useProvider=G;
|
|
10
|
+
}`:"(v) => {}"},s=t.__parseFunction(r),o=z(e.modifiers),a=w(e.arg)?t.__parseExpression(e.arg):e.arg||"modelValue";return{[a]:t.__parseExpression(e.value),[`onUpdate:${a}`]:o.length&&s?n.withModifiers(s,o):s}}function Ve(n,e,t,r,s){if(!e)return null;if(u.isString(e))return{default:()=>e};if(w(e))return{default:()=>V(t.__parseExpression(e))};if(Array.isArray(e)&&e.length>0){const o=Ye(e),a=i=>!i||!s?{}:s?.id&&Object.keys(i).length?{[`scope_${s.id}`]:i}:{};return Object.entries(o).reduce((i,[l,{nodes:c,params:m}])=>(i[l]=d=>{const f=m.length?u.pick(d??{},m):a(d);return c.map(v=>H(v,t.__clone(f),n,r))},i),{})}return null}function Ye(n){const e={default:{params:[],nodes:[]}};for(const t of n){const r=Ke(t.slot),s=r.name;e[s]?(e[s].nodes.push(t),e[s].params=e[s].params.concat(r.params)):e[s]={nodes:[t],params:r.params}}return e}function Ke(n="default"){return u.isString(n)?{name:n,params:[]}:{params:[],...n}}function Xe(n,e,t){const{value:r,iterator:s}=n,{item:o="item",index:a="index"}=s||{};let i=t.__parseExpression(r)||[];return Number.isInteger(i)&&(i=new Array(i).fill(!0).map((l,c)=>c+1)),Array.isArray(i)?i.map((l,c)=>e(t.__clone({[o]:l,[a]:c}))):(console.warn("[vForRender]:",`${r?.value} is not a Arrary`),[])}const ee=j.defineComponent({name:"VtjPageContainer",async setup(){const n=Q(),e=te.useRoute(),t=e.params.id,r=t?n.getPage(t):n.getHomepage(),s=r?await n.getRenderComponent(r.id):null;return r&&we.useTitle(r.title||"VTJ"),{provider:n,component:s,file:r,query:e.query}},render(){return this.component?j.h(this.component,this.query):j.h("div","页面不存在")}}),We=j.defineComponent({name:"VtjStartupContainer",render(){return j.h(je.XStartup)}}),G=Symbol("Provider");class ye extends C.Base{mode;globals={};modules={};adapter={request:Fe,jsonp:u.jsonp};apis={};dependencies={};materials={};library={};service;project=null;components={};nodeEnv="development";router=null;materialPath="./";urlDslCaches={};constructor(e){super();const{service:t,mode:r=S.Raw,dependencies:s,materials:o,project:a={},adapter:i={},globals:l={},modules:c={},router:m=null,materialPath:d="./",nodeEnv:f="development"}=e;this.mode=r,this.modules=c,this.service=t,this.router=m,this.materialPath=d,this.nodeEnv=f,s&&(this.dependencies=s),o&&(this.materials=o),Object.assign(this.globals,l),Object.assign(this.adapter,i),r!==S.Design&&this.load(a)}async load(e){const t=this.modules[`.vtj/projects/${e.id}.json`];if(this.project=t?await t():await this.service.init(e),!this.project)throw new Error("project is null");const{dependencies:r=[],apis:s}=this.project,{dependencies:o,library:a,components:i,materialPath:l}=this,{libraryExports:c,libraryMap:m,materials:d,materialExports:f,materialMapLibrary:v}=oe(r,l),h=window;h.CKEDITOR_VERSION=void 0;for(const p of c){const $=o[p],_=h[p];if(_)a[p]=_;else if($)h[p]=a[p]=await $();else{const E=m[p]||[];for(const P of E)B(P)&&await ae(p,u.url.append(P,{v:F})),N(P)&&await u.loadScript(u.url.append(P,{v:F})),a[p]=h[p]}}for(const p of d)await u.loadScript(u.url.append(p,{v:F}));const g=this.materials||{};for(const p of f){const $=h[v[p]],_=C.BUILT_IN_COMPONENTS[p];if(_)$&&_.forEach(E=>{i[E]=$[E]});else{const E=g[p]?(await g[p]()).default:h[p];E&&$&&(E.components||[]).forEach(P=>{i[P.name]=ie(P,$)})}}s&&(this.apis=de(s,this.adapter),X(),this.project.config?.mock&&fe(s)),this.initRouter(),this.triggerReady()}initRouter(){const{router:e,project:t}=this;e&&(e.addRoute({path:"/page/:id",name:"VtjPage",component:ee}),e.addRoute({path:"/",name:"VtjHomepage",component:t?.homepage?ee:We}))}install(e){const t=e.config.globalProperties.installed||{};for(const[r,s]of Object.entries(this.library))!t[r]&&le(s)&&(e.use(s),t[r]=!0);e.provide(G,this),e.config.globalProperties.installed=t}getFile(e){const{blocks:t=[]}=this.project||{};return this.getPage(e)||t.find(r=>r.id===e)||null}getPage(e){const{pages:t=[]}=this.project||{},r=(s,o=[])=>{for(const a of o){if(a.id===s)return a;if(a.children&&a.children.length){const i=r(s,a.children);if(i)return i}}};return r(e,t)||null}getHomepage(){const{homepage:e}=this.project||{};return e?this.getPage(e):null}async getDsl(e){const t=this.modules[`.vtj/files/${e}.json`];return t?await t():this.service.getFile(e).catch(()=>null)}async getDslByUrl(e){const t=this.urlDslCaches[e];return t||(this.urlDslCaches[e]=this.adapter.request.send({url:e,method:"get",settings:{validSuccess:!1,originResponse:!0}}).then(r=>r.data).catch(()=>null))}createDslRenderer(e,t={}){const{library:r,components:s,mode:o,apis:a}=this,i={mode:o,Vue:r.Vue,components:s,libs:r,apis:a,window,...t},l=k({getDsl:async c=>await this.getDsl(c)||null,getDslByUrl:async c=>await this.getDslByUrl(c)||null,options:i});return x({...i,dsl:e,loader:l})}async getRenderComponent(e){const t=this.getFile(e);if(!t)return u.logger.warn(`Can not find file: ${e}`),null;const r=`.vtj/vue/${e}.vue`,s=this.modules[r];if(s)return(await s())?.default;const o=await this.getDsl(t.id);return o?this.createDslRenderer(o).renderer:(u.logger.warn(`Can not find dsl: ${e}`),null)}defineUrlSchemaComponent(e,t){return j.defineAsyncComponent(async()=>{const r=await this.getDslByUrl(e);return r?(r.name=t||r.name,this.createDslRenderer(r).renderer):null})}definePluginComponent(e){return j.defineAsyncComponent(async()=>{const t=await W(e,window);return t?(K(t.css),t.component):null})}}function ze(n){const e=new ye(n);return{provider:e,onReady:r=>e.ready(r)}}function Q(n={}){const e=j.inject(G);if(!e)throw new Error("Can not find provider");if(e.mode===S.Raw&&e.nodeEnv==="development"){const{id:t,version:r}=n;t&&r&&(async()=>{const s=await e.getDsl(t);s?.__VERSION__!==r&&T.ElNotification.warning({title:s?.name,message:"当前组件源码版本与运行时版本不一致,请重新发布组件"})})()}return e}const Z=new u.Request({settings:{type:"json",validSuccess:!0,originResponse:!1,failMessage:!0,validate:n=>n.data?.code===0,showError:n=>{T.ElNotification.error({message:n||"未知错误"})}}}),Ge=(n="/vtj/local/repository/${type}.json")=>(e,t)=>Z.send({url:n,method:"post",query:{type:e},data:{type:e,data:t}}),Qe=(n="/vtj/local/repository/uploader.json")=>async(e,t)=>await Z.send({url:n,method:"post",data:{files:e,projectId:t},settings:{type:"data"}}).then(r=>r&&r[0]?r[0]:null).catch(()=>null);class U{api;pluginCaches={};uploader;constructor(){this.api=Ge(),this.uploader=Qe()}async init(e){return console.log("BaseService.init",e),{}}async saveProject(e){return!!await this.api("saveProject",e).catch(()=>!1)}async saveMaterials(e,t){return console.log("BaseService.saveMaterials",e,t),!1}async saveFile(e){return console.log("BaseService.saveFile",e),!1}async getFile(e){return console.log("BaseService.getFile",e),{}}async removeFile(e){return console.log("BaseService.removeFile",e),!1}async saveHistory(e){return console.log("BaseService.saveHistory",e),!1}async removeHistory(e){return console.log("BaseService.removeHistory",e),!1}async getHistory(e){return console.log("BaseService.getHistory",e),{}}async getHistoryItem(e,t){return console.log("BaseService.getHistoryItem",e,t),{}}async saveHistoryItem(e,t){return console.log("BaseService.saveHistoryItem",e,t),!1}async removeHistoryItem(e,t){return console.log("BaseService.removeHistoryItem",e,t),!1}async publish(e){return!!await this.api("publish",e).catch(()=>!1)}async publishFile(e,t){return!!await this.api("publishFile",{project:e,file:t}).catch(()=>!1)}async genVueContent(e,t){return await this.api("genVueContent",{project:e,dsl:t}).catch(()=>"")}async createRawPage(e){return await this.api("createRawPage",e).catch(()=>"")}async removeRawPage(e){return await this.api("removeRawPage",e).catch(()=>"")}async uploadStaticFile(e,t){return await this.uploader(e,t).catch(()=>null)}async getStaticFiles(e){return await this.api("getStaticFiles",e).catch(()=>[])}async removeStaticFile(e,t){return await this.api("removeStaticFile",{name:e,projectId:t}).catch(()=>"")}async clearStaticFiles(e){return await this.api("clearStaticFiles",e).catch(()=>"")}async getPluginMaterial(e){const{urls:t=[]}=e,r=t.filter(o=>se(o))[0];if(!r)return null;const s=this.pluginCaches[r];return s||(this.pluginCaches[r]=Z.send({url:r,method:"get",settings:{validSuccess:!1,originResponse:!0}}).then(o=>o.data).catch(()=>null))}}const y=new u.Storage({type:"local",expired:0,prefix:"__VTJ_"});class Ze extends U{init(e){const t=new C.ProjectModel(e),r=y.get(`project_${t.id}`),s=Object.assign(t.toDsl(),r||{});return y.save(`project_${t.id}`,s),Promise.resolve(s)}saveProject(e){const t=new C.ProjectModel(e);return y.save(`project_${t.id}`,t.toDsl()),Promise.resolve(!0)}saveMaterials(e,t){return y.save(`materials_${e.id}`,u.mapToObject(t)),Promise.resolve(!0)}saveFile(e){return y.save(`file_${e.id}`,e),Promise.resolve(!0)}getFile(e){const t=y.get(`file_${e}`);return t?Promise.resolve(t):Promise.reject(null)}removeFile(e){return y.remove(`file_${e}`),Promise.resolve(!0)}saveHistory(e){return y.save(`history_${e.id}`,e),Promise.resolve(!0)}removeHistory(e){const t=y.get(`history_${e}`);if(t){const s=(t.items||[]).map(o=>o.id);this.removeHistoryItem(e,s),y.remove(`history_${e}`)}return Promise.resolve(!0)}getHistory(e){const t=y.get(`history_${e}`),r=new C.HistoryModel(t||{id:e});return Promise.resolve(r.toDsl())}getHistoryItem(e,t){const r=y.get(`history_${e}_${t}`);return Promise.resolve(r)}saveHistoryItem(e,t){return y.save(`history_${e}_${t.id}`,t),Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(r=>{y.remove(`history_${e}_${r}`)}),Promise.resolve(!0)}}class _e extends U{projects={};materials={};files={};histories={};historyItems={};init(e){const t=new C.ProjectModel(e),r=this.projects[t.id]||{},s=Object.assign(t.toDsl(),r);return this.projects[s.id]=s,Promise.resolve(s)}saveProject(e){const t=new C.ProjectModel(e);return this.projects[t.id]=t.toDsl(),Promise.resolve(!0)}saveMaterials(e,t){return e.id&&(this.materials[e.id]=u.mapToObject(t)),Promise.resolve(!0)}saveFile(e){return this.files[e.id]=e,Promise.resolve(!0)}getFile(e){const t=this.files[e];return t?Promise.resolve(t):Promise.reject(null)}removeFile(e){return delete this.files[e],Promise.resolve(!0)}saveHistory(e){return this.histories[e.id]=e,Promise.resolve(!0)}removeHistory(e){const t=this.histories[e];if(t){const s=(t.items||[]).map(o=>o.id);this.removeHistoryItem(e,s),delete this.historyItems[e]}return Promise.resolve(!0)}getHistory(e){const t=this.histories[e],r=new C.HistoryModel(t||{id:e});return Promise.resolve(r)}getHistoryItem(e,t){const r=`${e}_${t}`,s=this.historyItems[r]||{};return Promise.resolve(s)}saveHistoryItem(e,t){const r=`${e}_${t.id}`;return this.historyItems[r]=t,Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(r=>{const s=`${e}_${r}`;delete this.historyItems[s]}),Promise.resolve(!0)}}let M=null;function et(){return M||(M=new _e,M)}class tt extends U{getFileCaches={};async init(e){return await this.api("init",e).catch(()=>null)||{}}async saveProject(e){return!!await this.api("saveProject",e).catch(()=>!1)}async saveMaterials(e,t){return!!await this.api("saveMaterials",{project:e,materials:u.mapToObject(t)}).catch(()=>!1)}async saveFile(e){return!!await this.api("saveFile",e).catch(()=>!1)}async getFile(e){const t=this.getFileCaches[e];return t||(this.getFileCaches[e]=this.api("getFile",e).catch(()=>null)).finally(()=>{delete this.getFileCaches[e]})}async removeFile(e){return!!await this.api("removeFile",e).catch(()=>!1)}async saveHistory(e){return!!await this.api("saveHistory",e).catch(()=>!1)}async removeHistory(e){return!!await this.api("removeHistory",e).catch(()=>!1)}async getHistory(e){return await this.api("getHistory",e).catch(()=>null)||{}}async getHistoryItem(e,t){return await this.api("getHistoryItem",{fId:e,id:t}).catch(()=>null)||{}}async saveHistoryItem(e,t){return!!await this.api("saveHistoryItem",{fId:e,item:t}).catch(()=>!1)}async removeHistoryItem(e,t){return!!await this.api("removeHistoryItem",{fId:e,ids:t}).catch(()=>!1)}}function Se(n=[]){return n.map(e=>{const{id:t,title:r,icon:s,children:o,hidden:a}=e;return{id:t,title:r,icon:s,hidden:a,url:`/page/${t}`,children:o&&o.length?Se(o):void 0}})}function rt(){const n=Q(),e=te.useRoute(),t=j.ref(!1),r=n.project;j.watchEffect(()=>{const{name:a,params:i,meta:l}=e;if(a==="VtjPage"){const c=n.getPage(i.id);t.value=!c?.mask}else if(a==="VtjHomepage"){const c=n.getHomepage();t.value=!c?.mask}else t.value=!l.mask});const s=Se(r?.pages),o=r?.config;return{disabled:t,logo:o?.logo,themeSwitchable:o?.themeSwitchable,title:o?.title||r?.description||r?.name||"VTJ App",menus:s}}exports.BUILT_IN_DIRECTIVES=re;exports.BaseService=U;exports.CONTEXT_HOST=J;exports.Context=he;exports.ContextMode=S;exports.DATA_TYPES=ne;exports.JSCodeToString=be;exports.LIFE_CYCLES_LIST=Ce;exports.LocalService=tt;exports.MemoryService=_e;exports.Provider=ye;exports.StorageService=Ze;exports.VTJ_RENDERER_VERSION=F;exports.adoptedStyleSheets=Y;exports.createAssetScripts=Ee;exports.createAssetsCss=Pe;exports.createDataSources=ve;exports.createLoader=k;exports.createMemoryService=et;exports.createProvider=ze;exports.createRenderer=x;exports.createSchemaApi=pe;exports.createSchemaApis=de;exports.defaultLoader=ge;exports.fillBasePath=I;exports.getModifiers=z;exports.getPlugin=W;exports.getRawComponent=ie;exports.isCSSUrl=B;exports.isJSCode=ue;exports.isJSExpression=w;exports.isJSFunction=O;exports.isJSON=se;exports.isJSUrl=N;exports.isVuePlugin=le;exports.loadCss=ae;exports.loadCssUrl=K;exports.loadScriptUrl=ce;exports.mockApi=me;exports.mockApis=fe;exports.mockCleanup=X;exports.nodeRender=H;exports.parseDeps=oe;exports.parseExpression=R;exports.parseFunction=L;exports.providerKey=G;exports.toString=V;exports.useMask=rt;exports.useProvider=Q;
|
package/dist/index.mjs
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { Base as
|
|
2
|
-
import { isUrl as
|
|
1
|
+
import { Base as fe, BUILT_IN_COMPONENTS as de, ProjectModel as x, HistoryModel as ee } from "@vtj/core";
|
|
2
|
+
import { isUrl as me, url as F, dedupArray as he, isString as b, isFunction as X, logger as O, createRequest as ve, merge as ye, pathToRegexp as ge, pathToRegexpMatch as _e, formDataToJson as we, camelCase as E, upperFirst as Se, pick as $e, jsonp as je, loadScript as Y, Request as Ee, Storage as Pe, mapToObject as q } from "@vtj/utils";
|
|
3
3
|
import * as k from "vue";
|
|
4
|
-
import { defineComponent as
|
|
5
|
-
import { useRoute as
|
|
6
|
-
import { ElNotification as
|
|
4
|
+
import { defineComponent as te, h as B, inject as Fe, defineAsyncComponent as z, ref as be, watchEffect as Ce } from "vue";
|
|
5
|
+
import { useRoute as re } from "vue-router";
|
|
6
|
+
import { ElNotification as J, ElLoading as Re } from "element-plus";
|
|
7
7
|
import D from "mockjs";
|
|
8
|
-
import { useTitle as
|
|
9
|
-
import { XStartup as
|
|
8
|
+
import { useTitle as Ie } from "@vueuse/core";
|
|
9
|
+
import { XStartup as He } from "@vtj/ui";
|
|
10
10
|
/**!
|
|
11
11
|
* Copyright (c) 2024, VTJ.PRO All rights reserved.
|
|
12
12
|
* @name @vtj/renderer
|
|
13
13
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
14
|
-
* @version 0.8.
|
|
14
|
+
* @version 0.8.5
|
|
15
15
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
16
16
|
*/
|
|
17
|
-
const
|
|
17
|
+
const C = "0.8.5";
|
|
18
18
|
var _ = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(_ || {});
|
|
19
|
-
const
|
|
19
|
+
const G = [
|
|
20
20
|
"$el",
|
|
21
21
|
"$emit",
|
|
22
22
|
"$nextTick",
|
|
@@ -42,7 +42,7 @@ const z = [
|
|
|
42
42
|
"renderTriggered",
|
|
43
43
|
"activated",
|
|
44
44
|
"deactivated"
|
|
45
|
-
],
|
|
45
|
+
], xe = ["vIf", "vShow", "vModel", "vFor", "vBind"], Oe = {
|
|
46
46
|
String,
|
|
47
47
|
Number,
|
|
48
48
|
Boolean,
|
|
@@ -52,33 +52,33 @@ const z = [
|
|
|
52
52
|
Date
|
|
53
53
|
};
|
|
54
54
|
function I(n, e) {
|
|
55
|
-
return n.map((t) =>
|
|
55
|
+
return n.map((t) => me(t) ? t : `${e}${t}`);
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function V(n) {
|
|
58
58
|
return /\.css$/.test(n);
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function L(n) {
|
|
61
61
|
return /\.js$/.test(n);
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function De(n) {
|
|
64
64
|
return /\.json$/.test(n);
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function Rt(n) {
|
|
67
67
|
return n.map(
|
|
68
|
-
(e) => `<script src="${F.append(e, { v:
|
|
68
|
+
(e) => `<script src="${F.append(e, { v: C })}"><\/script>`
|
|
69
69
|
).join("");
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function It(n = []) {
|
|
72
72
|
return n.map(
|
|
73
|
-
(e) => `<link rel="stylesheet" href="${F.append(e, { v:
|
|
73
|
+
(e) => `<link rel="stylesheet" href="${F.append(e, { v: C })}" />`
|
|
74
74
|
).join("");
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function Me(n, e) {
|
|
77
77
|
const t = n.filter((p) => !!p.enabled), r = [], s = [], o = [], a = [], i = {}, l = {}, c = [], d = {};
|
|
78
78
|
return t.forEach(
|
|
79
79
|
({ urls: p, assetsUrl: f, library: h, assetsLibrary: m, localeLibrary: v }) => {
|
|
80
80
|
p?.forEach((u) => {
|
|
81
|
-
|
|
81
|
+
L(u) && r.push(u), V(u) && s.push(u);
|
|
82
82
|
}), h && (a.push(h), i[h] = I(p || [], e), v && (l[h] = v)), f && o.push(f), m && c.push(m), h && m && (d[m] = h);
|
|
83
83
|
}
|
|
84
84
|
), {
|
|
@@ -86,20 +86,20 @@ function De(n, e) {
|
|
|
86
86
|
css: I(s, e),
|
|
87
87
|
materials: I(o, e),
|
|
88
88
|
libraryExports: a,
|
|
89
|
-
materialExports:
|
|
89
|
+
materialExports: he(c),
|
|
90
90
|
materialMapLibrary: d,
|
|
91
91
|
libraryMap: i,
|
|
92
92
|
libraryLocaleMap: l
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function ke(n, e) {
|
|
96
96
|
const { name: t, parent: r, alias: s } = n;
|
|
97
97
|
return r ? e[r]?.[s || t] : e[s || t];
|
|
98
98
|
}
|
|
99
|
-
function
|
|
100
|
-
return
|
|
99
|
+
function ne(n) {
|
|
100
|
+
return b(n) ? n : JSON.stringify(n);
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function se(n, e, t) {
|
|
103
103
|
const r = n.CSSStyleSheet;
|
|
104
104
|
if (r.prototype.replaceSync) {
|
|
105
105
|
const s = new r();
|
|
@@ -114,11 +114,11 @@ function ne(n, e, t) {
|
|
|
114
114
|
o ? o.innerHTML = t : (o = s.createElement("style"), o.id = e, o.innerHTML = t, s.head.appendChild(o));
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
async function
|
|
117
|
+
async function Te(n, e) {
|
|
118
118
|
const t = await window.fetch(e).then((r) => r.text()).catch(() => "");
|
|
119
|
-
t &&
|
|
119
|
+
t && se(window, n, t);
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function oe(n, e = window) {
|
|
122
122
|
const t = e.document, r = e.document.head;
|
|
123
123
|
for (const s of n)
|
|
124
124
|
if (!t.getElementById(s)) {
|
|
@@ -126,7 +126,7 @@ function se(n, e = window) {
|
|
|
126
126
|
a.rel = "stylesheet", a.id = s, a.href = s, r.appendChild(a);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
async function
|
|
129
|
+
async function Ae(n, e, t = window) {
|
|
130
130
|
const r = t.document, s = t.document.head;
|
|
131
131
|
let o = t[e];
|
|
132
132
|
return o ? o.default || o : new Promise((a, i) => {
|
|
@@ -140,8 +140,8 @@ async function Te(n, e, t = window) {
|
|
|
140
140
|
}
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
|
-
function
|
|
144
|
-
return
|
|
143
|
+
function Be(n) {
|
|
144
|
+
return X(n) || X(n?.install);
|
|
145
145
|
}
|
|
146
146
|
function R(n, e, t = !1, r = !1) {
|
|
147
147
|
try {
|
|
@@ -157,7 +157,7 @@ function R(n, e, t = !1, r = !1) {
|
|
|
157
157
|
throw s;
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function Q(n, e, t = !1, r = !1) {
|
|
161
161
|
const s = R(n, e, t, r);
|
|
162
162
|
if (typeof s != "function" && (O.error(
|
|
163
163
|
"parseFunction.error",
|
|
@@ -174,14 +174,14 @@ function w(n) {
|
|
|
174
174
|
function T(n) {
|
|
175
175
|
return typeof n == "object" && n && n.type === "JSFunction";
|
|
176
176
|
}
|
|
177
|
-
function
|
|
177
|
+
function Ne(n) {
|
|
178
178
|
return w(n) || T(n);
|
|
179
179
|
}
|
|
180
|
-
function
|
|
181
|
-
return
|
|
180
|
+
function Ht(n) {
|
|
181
|
+
return Ne(n) ? n.value : JSON.stringify(n);
|
|
182
182
|
}
|
|
183
183
|
let P = null;
|
|
184
|
-
const
|
|
184
|
+
const Ue = ve({
|
|
185
185
|
settings: {
|
|
186
186
|
type: "form",
|
|
187
187
|
validSuccess: !0,
|
|
@@ -190,12 +190,12 @@ const Ne = he({
|
|
|
190
190
|
validate: (n) => n.data?.code === 0 || !!n.data?.success,
|
|
191
191
|
failMessage: !0,
|
|
192
192
|
showError: (n) => {
|
|
193
|
-
|
|
193
|
+
J.error({
|
|
194
194
|
message: n || "未知错误"
|
|
195
195
|
});
|
|
196
196
|
},
|
|
197
197
|
showLoading: () => {
|
|
198
|
-
P && P.close(), P =
|
|
198
|
+
P && P.close(), P = Re.service({
|
|
199
199
|
lock: !0,
|
|
200
200
|
text: "Loading",
|
|
201
201
|
background: "rgba(0, 0, 0, 0.05)"
|
|
@@ -206,7 +206,7 @@ const Ne = he({
|
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
});
|
|
209
|
-
function
|
|
209
|
+
function qe(n, e) {
|
|
210
210
|
const { jsonp: t, request: r } = e;
|
|
211
211
|
if (n.method === "jsonp")
|
|
212
212
|
return (s = {}) => t(n.url, {
|
|
@@ -222,36 +222,36 @@ function Ue(n, e) {
|
|
|
222
222
|
headers: s
|
|
223
223
|
}
|
|
224
224
|
};
|
|
225
|
-
return (a, i) => r.send(
|
|
225
|
+
return (a, i) => r.send(ye(o, i || {}, { data: a }));
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function Je(n = [], e) {
|
|
229
229
|
return n.reduce(
|
|
230
|
-
(t, r) => (t[r.id] =
|
|
230
|
+
(t, r) => (t[r.id] = qe(r, e), t),
|
|
231
231
|
{}
|
|
232
232
|
);
|
|
233
233
|
}
|
|
234
|
-
function
|
|
234
|
+
function Ve(n = []) {
|
|
235
235
|
D.setup({
|
|
236
236
|
timeout: "50-500"
|
|
237
|
-
}),
|
|
237
|
+
}), ie(), n.forEach((e) => Le(e));
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function Le(n) {
|
|
240
240
|
if (!n.mock)
|
|
241
241
|
return;
|
|
242
242
|
const { url: e, mockTemplate: t } = n;
|
|
243
243
|
if (e && t) {
|
|
244
|
-
const r =
|
|
244
|
+
const r = ge(`${e}(.*)`), s = _e(e, { decode: decodeURIComponent }), o = R(t, {}, !0);
|
|
245
245
|
D.mock(r, (a) => {
|
|
246
|
-
const i = F.parse(a.url) || {}, l = a.body instanceof FormData ?
|
|
246
|
+
const i = F.parse(a.url) || {}, l = a.body instanceof FormData ? we(a.body) : a.body, c = s(a.url)?.params;
|
|
247
247
|
return Object.assign(a, { data: l, params: i, query: c }), D.mock(o(a));
|
|
248
248
|
});
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function ie() {
|
|
252
252
|
D._mocked = {};
|
|
253
253
|
}
|
|
254
|
-
class
|
|
254
|
+
class Ke {
|
|
255
255
|
__id = null;
|
|
256
256
|
__mode;
|
|
257
257
|
__instance = null;
|
|
@@ -293,12 +293,12 @@ class Le {
|
|
|
293
293
|
});
|
|
294
294
|
}
|
|
295
295
|
__proxy() {
|
|
296
|
-
this.__instance &&
|
|
296
|
+
this.__instance && G.forEach((e) => {
|
|
297
297
|
this[e] = this.__instance?.[e];
|
|
298
298
|
});
|
|
299
299
|
}
|
|
300
300
|
__cleanup() {
|
|
301
|
-
|
|
301
|
+
G.forEach((e) => {
|
|
302
302
|
this[e] = null;
|
|
303
303
|
});
|
|
304
304
|
}
|
|
@@ -306,9 +306,9 @@ class Le {
|
|
|
306
306
|
if (e)
|
|
307
307
|
if (this.__mode === _.Runtime) {
|
|
308
308
|
const { id: t, type: r } = e, s = t ? this.__transform[t] ?? e.value : e.value;
|
|
309
|
-
return
|
|
309
|
+
return Q({ type: r, value: s }, this);
|
|
310
310
|
} else
|
|
311
|
-
return
|
|
311
|
+
return Q(e, this);
|
|
312
312
|
}
|
|
313
313
|
__parseExpression(e) {
|
|
314
314
|
if (e)
|
|
@@ -347,7 +347,7 @@ class Le {
|
|
|
347
347
|
return r.context.__proto__ = this.context, r.__proto__ = this, r;
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
|
-
function
|
|
350
|
+
function N(n) {
|
|
351
351
|
const {
|
|
352
352
|
Vue: e = k,
|
|
353
353
|
mode: t = _.Runtime,
|
|
@@ -359,22 +359,22 @@ function B(n) {
|
|
|
359
359
|
$components: r,
|
|
360
360
|
$libs: s,
|
|
361
361
|
$apis: o
|
|
362
|
-
}, c = new
|
|
362
|
+
}, c = new Ke({
|
|
363
363
|
mode: t,
|
|
364
364
|
dsl: i.value,
|
|
365
365
|
attrs: l
|
|
366
366
|
}), d = e.defineComponent({
|
|
367
367
|
name: i.value.name,
|
|
368
368
|
props: {
|
|
369
|
-
...
|
|
369
|
+
...We(i.value.props ?? [], c)
|
|
370
370
|
},
|
|
371
371
|
setup(p) {
|
|
372
|
-
c.$props = p, c.props = p, i.value.id &&
|
|
372
|
+
c.$props = p, c.props = p, i.value.id && se(
|
|
373
373
|
n.window || window,
|
|
374
374
|
i.value.id,
|
|
375
375
|
i.value.css || ""
|
|
376
|
-
), c.state =
|
|
377
|
-
const f =
|
|
376
|
+
), c.state = Xe(e, i.value.state ?? {}, c);
|
|
377
|
+
const f = Ye(e, i.value.computed ?? {}, c), h = ze(i.value.methods ?? {}, c), m = Ge(e, i.value.inject, c), v = Qe(
|
|
378
378
|
i.value.dataSources || {},
|
|
379
379
|
c
|
|
380
380
|
), u = {
|
|
@@ -383,7 +383,7 @@ function B(n) {
|
|
|
383
383
|
...h,
|
|
384
384
|
...v
|
|
385
385
|
};
|
|
386
|
-
return c.setup(u, e),
|
|
386
|
+
return c.setup(u, e), Ze(e, i.value.watch ?? [], c), {
|
|
387
387
|
vtj: c
|
|
388
388
|
};
|
|
389
389
|
},
|
|
@@ -395,16 +395,16 @@ function B(n) {
|
|
|
395
395
|
const p = i.value.nodes || [];
|
|
396
396
|
return p.length === 1 ? M(p[0], c, e, a) : p.map((f) => M(f, c, e, a));
|
|
397
397
|
},
|
|
398
|
-
...
|
|
398
|
+
...et(i.value.lifeCycles ?? {}, c)
|
|
399
399
|
});
|
|
400
400
|
return {
|
|
401
401
|
renderer: e.markRaw(d),
|
|
402
402
|
context: c
|
|
403
403
|
};
|
|
404
404
|
}
|
|
405
|
-
function
|
|
406
|
-
const t = (r) => r ? (Array.isArray(r) ? r : [r]).map((o) =>
|
|
407
|
-
return n.map((r) =>
|
|
405
|
+
function We(n = [], e) {
|
|
406
|
+
const t = (r) => r ? (Array.isArray(r) ? r : [r]).map((o) => Oe[o]) : void 0;
|
|
407
|
+
return n.map((r) => b(r) ? {
|
|
408
408
|
name: r
|
|
409
409
|
} : {
|
|
410
410
|
name: r.name,
|
|
@@ -420,7 +420,7 @@ function Ke(n = [], e) {
|
|
|
420
420
|
{}
|
|
421
421
|
);
|
|
422
422
|
}
|
|
423
|
-
function
|
|
423
|
+
function Xe(n, e, t) {
|
|
424
424
|
return n.reactive(
|
|
425
425
|
Object.keys(e || {}).reduce(
|
|
426
426
|
(r, s) => {
|
|
@@ -431,19 +431,19 @@ function We(n, e, t) {
|
|
|
431
431
|
)
|
|
432
432
|
);
|
|
433
433
|
}
|
|
434
|
-
function
|
|
434
|
+
function Ye(n, e, t) {
|
|
435
435
|
return Object.entries(e ?? {}).reduce(
|
|
436
436
|
(r, [s, o]) => (r[s] = n.computed(t.__parseFunction(o)), r),
|
|
437
437
|
{}
|
|
438
438
|
);
|
|
439
439
|
}
|
|
440
|
-
function
|
|
440
|
+
function ze(n, e) {
|
|
441
441
|
return Object.entries(n ?? {}).reduce(
|
|
442
442
|
(t, [r, s]) => (t[r] = e.__parseFunction(s), t),
|
|
443
443
|
{}
|
|
444
444
|
);
|
|
445
445
|
}
|
|
446
|
-
function
|
|
446
|
+
function Ge(n, e = [], t) {
|
|
447
447
|
return e.reduce(
|
|
448
448
|
(r, s) => {
|
|
449
449
|
const { name: o, from: a } = s || {};
|
|
@@ -454,7 +454,7 @@ function ze(n, e = [], t) {
|
|
|
454
454
|
{}
|
|
455
455
|
);
|
|
456
456
|
}
|
|
457
|
-
function
|
|
457
|
+
function Qe(n, e) {
|
|
458
458
|
return Object.keys(n).reduce(
|
|
459
459
|
(t, r) => {
|
|
460
460
|
const s = n[r], o = e.$apis[s.ref], a = T(s.transform) ? s.transform.value ? e.__parseFunction(s.transform) : void 0 : s.transform;
|
|
@@ -466,7 +466,7 @@ function Ge(n, e) {
|
|
|
466
466
|
{}
|
|
467
467
|
);
|
|
468
468
|
}
|
|
469
|
-
function
|
|
469
|
+
function Ze(n, e = [], t) {
|
|
470
470
|
e.forEach((r) => {
|
|
471
471
|
n.watch(
|
|
472
472
|
t.__parseExpression(r.source),
|
|
@@ -478,20 +478,21 @@ function Qe(n, e = [], t) {
|
|
|
478
478
|
);
|
|
479
479
|
});
|
|
480
480
|
}
|
|
481
|
-
function
|
|
481
|
+
function et(n, e) {
|
|
482
482
|
return Object.entries(n ?? {}).reduce(
|
|
483
483
|
(t, [r, s]) => (t[r] = e.__parseFunction(s), t),
|
|
484
484
|
{}
|
|
485
485
|
);
|
|
486
486
|
}
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
487
|
+
let A = [];
|
|
488
|
+
const tt = (n) => n;
|
|
489
|
+
async function ae(n, e = window) {
|
|
490
|
+
const { urls: t = [], library: r } = n, s = t.filter((l) => L(l));
|
|
490
491
|
if (s.length === 0 || !r)
|
|
491
492
|
return null;
|
|
492
|
-
const o = t.filter((l) =>
|
|
493
|
+
const o = t.filter((l) => V(l));
|
|
493
494
|
let a;
|
|
494
|
-
const i = await
|
|
495
|
+
const i = await Ae(s, r, e).catch(
|
|
495
496
|
() => null
|
|
496
497
|
);
|
|
497
498
|
return i?.plugin && (a = i.plugin), a ? {
|
|
@@ -499,55 +500,57 @@ async function ie(n, e = window) {
|
|
|
499
500
|
css: o
|
|
500
501
|
} : null;
|
|
501
502
|
}
|
|
502
|
-
function
|
|
503
|
+
function U(n) {
|
|
503
504
|
const { getDsl: e, getDslByUrl: t, options: r } = n;
|
|
504
|
-
return
|
|
505
|
+
return r.window && (A.forEach((s) => {
|
|
506
|
+
delete r.window[s];
|
|
507
|
+
}), A = []), (s, o, a = k) => !o || typeof o == "string" ? s : o.type === "Schema" && o.id ? a.defineAsyncComponent(async () => {
|
|
505
508
|
const i = await e(o.id);
|
|
506
|
-
return i && (i.name = s), i ?
|
|
509
|
+
return i && (i.name = s), i ? N({
|
|
507
510
|
...r,
|
|
508
511
|
Vue: a,
|
|
509
512
|
dsl: i,
|
|
510
513
|
mode: _.Runtime,
|
|
511
|
-
loader:
|
|
514
|
+
loader: U(n)
|
|
512
515
|
}).renderer : null;
|
|
513
516
|
}) : o.type === "UrlSchema" && o.url ? a.defineAsyncComponent(async () => {
|
|
514
517
|
const i = await t(o.url);
|
|
515
|
-
return i && (i.name = s), i ?
|
|
518
|
+
return i && (i.name = s), i ? N({
|
|
516
519
|
...r,
|
|
517
520
|
Vue: a,
|
|
518
521
|
dsl: i,
|
|
519
522
|
mode: _.Runtime,
|
|
520
|
-
loader:
|
|
523
|
+
loader: U(n)
|
|
521
524
|
}).renderer : null;
|
|
522
|
-
}) : o.type === "Plugin" ? a.defineAsyncComponent(async () => {
|
|
523
|
-
const i = await
|
|
524
|
-
return i ? (
|
|
525
|
-
}) : s;
|
|
525
|
+
}) : o.type === "Plugin" ? (o.library && A.push(o.library), a.defineAsyncComponent(async () => {
|
|
526
|
+
const i = await ae(o, r.window);
|
|
527
|
+
return i ? (oe(i.css, r.window), i.component) : null;
|
|
528
|
+
})) : s;
|
|
526
529
|
}
|
|
527
|
-
function M(n, e, t = k, r =
|
|
530
|
+
function M(n, e, t = k, r = tt) {
|
|
528
531
|
if (!n || !n.name || n.invisible)
|
|
529
532
|
return null;
|
|
530
|
-
const { id: s = null, directives: o = [] } = n, { vIf: a, vFor: i, vShow: l, vModels: c, vBind: d } =
|
|
531
|
-
if (a && !
|
|
533
|
+
const { id: s = null, directives: o = [] } = n, { vIf: a, vFor: i, vShow: l, vModels: c, vBind: d } = rt(o);
|
|
534
|
+
if (a && !nt(a, e))
|
|
532
535
|
return null;
|
|
533
536
|
const p = (f) => {
|
|
534
537
|
const h = f.$components, m = (() => {
|
|
535
538
|
if (n.name === "component")
|
|
536
|
-
return
|
|
539
|
+
return st(f, n.props?.is);
|
|
537
540
|
if (n.name === "slot")
|
|
538
541
|
return n.name;
|
|
539
542
|
const g = r(n.name, n.from, t);
|
|
540
|
-
return
|
|
541
|
-
})(), v =
|
|
543
|
+
return b(g) ? h[g] ?? g : g;
|
|
544
|
+
})(), v = ot(s, n.props ?? {}, f), u = it(t, n.events ?? {}, f);
|
|
542
545
|
if (n.name === "slot")
|
|
543
|
-
return
|
|
546
|
+
return at(t, n, v, f, r);
|
|
544
547
|
d && Object.assign(v, f.__parseExpression(d.value)), l && (v.style = Object.assign(
|
|
545
548
|
v.style ?? {},
|
|
546
|
-
|
|
549
|
+
lt(l, f)
|
|
547
550
|
)), c.forEach((g) => {
|
|
548
|
-
Object.assign(v,
|
|
551
|
+
Object.assign(v, ut(t, g, f));
|
|
549
552
|
});
|
|
550
|
-
const S =
|
|
553
|
+
const S = pt(
|
|
551
554
|
t,
|
|
552
555
|
n.children ?? [],
|
|
553
556
|
f,
|
|
@@ -556,11 +559,11 @@ function M(n, e, t = k, r = et) {
|
|
|
556
559
|
);
|
|
557
560
|
return t.createVNode(m, { ...v, ...u }, S);
|
|
558
561
|
};
|
|
559
|
-
return i ?
|
|
562
|
+
return i ? mt(i, p, e) : p(e);
|
|
560
563
|
}
|
|
561
|
-
function
|
|
564
|
+
function rt(n = []) {
|
|
562
565
|
const e = n.find((i) => E(i.name) === "vIf"), t = n.find((i) => E(i.name) === "vFor"), r = n.find((i) => E(i.name) === "vShow"), s = n.find((i) => E(i.name) === "vBind"), o = n.filter((i) => E(i.name) === "vModel"), a = n.filter(
|
|
563
|
-
(i) => !
|
|
566
|
+
(i) => !xe.includes(E(i.name))
|
|
564
567
|
);
|
|
565
568
|
return {
|
|
566
569
|
vIf: e,
|
|
@@ -571,13 +574,13 @@ function tt(n = []) {
|
|
|
571
574
|
others: a
|
|
572
575
|
};
|
|
573
576
|
}
|
|
574
|
-
function
|
|
577
|
+
function nt(n, e) {
|
|
575
578
|
return !!e.__parseExpression(n.value);
|
|
576
579
|
}
|
|
577
|
-
function
|
|
580
|
+
function st(n, e) {
|
|
578
581
|
return e ? w(e) ? n.__parseExpression(e) : e : "div";
|
|
579
582
|
}
|
|
580
|
-
function
|
|
583
|
+
function ot(n, e, t) {
|
|
581
584
|
const r = Object.keys(e || {}).reduce(
|
|
582
585
|
(s, o) => {
|
|
583
586
|
let a = e[o];
|
|
@@ -587,7 +590,7 @@ function st(n, e, t) {
|
|
|
587
590
|
);
|
|
588
591
|
return r.ref = t.__ref(n, r.ref), r;
|
|
589
592
|
}
|
|
590
|
-
function
|
|
593
|
+
function it(n, e, t) {
|
|
591
594
|
const r = ["passive", "capture", "once"], s = {
|
|
592
595
|
capture: "Capture",
|
|
593
596
|
once: "Once",
|
|
@@ -595,63 +598,63 @@ function ot(n, e, t) {
|
|
|
595
598
|
};
|
|
596
599
|
return Object.keys(e || {}).reduce(
|
|
597
600
|
(o, a) => {
|
|
598
|
-
const i = e[a], l =
|
|
601
|
+
const i = e[a], l = ce(i.modifiers), c = l.find((f) => r.includes(f)), d = "on" + Se(a) + (c && s[c] || ""), p = t.__parseFunction(i.handler);
|
|
599
602
|
return p && (o[d] = n.withModifiers(p, l)), o;
|
|
600
603
|
},
|
|
601
604
|
{}
|
|
602
605
|
);
|
|
603
606
|
}
|
|
604
|
-
function
|
|
607
|
+
function ce(n = {}, e = !1) {
|
|
605
608
|
const t = Object.keys(n);
|
|
606
609
|
return e ? t.map((r) => "." + r) : t;
|
|
607
610
|
}
|
|
608
|
-
function
|
|
609
|
-
const { children: o } = e, a =
|
|
610
|
-
return i ? i(t) : o ?
|
|
611
|
-
|
|
611
|
+
function at(n, e, t, r, s) {
|
|
612
|
+
const { children: o } = e, a = ct(e, r), i = r.$slots?.[a.name];
|
|
613
|
+
return i ? i(t) : o ? b(o) ? n.createTextVNode(o) : w(o) ? n.createTextVNode(
|
|
614
|
+
ne(r.__parseExpression(o))
|
|
612
615
|
) : Array.isArray(o) ? o.map(
|
|
613
616
|
(l) => M(l, r, n, s)
|
|
614
617
|
) : null : null;
|
|
615
618
|
}
|
|
616
|
-
function
|
|
619
|
+
function ct(n, e) {
|
|
617
620
|
const { props: t } = n, r = t?.name || "default";
|
|
618
621
|
return {
|
|
619
622
|
name: w(r) ? e.__parseExpression(r) : r,
|
|
620
623
|
params: []
|
|
621
624
|
};
|
|
622
625
|
}
|
|
623
|
-
function
|
|
626
|
+
function lt(n, e) {
|
|
624
627
|
return e.__parseExpression(n.value) ? {} : {
|
|
625
628
|
display: "none"
|
|
626
629
|
};
|
|
627
630
|
}
|
|
628
|
-
function
|
|
631
|
+
function ut(n, e, t) {
|
|
629
632
|
const r = {
|
|
630
633
|
type: "JSFunction",
|
|
631
634
|
value: e.value?.value ? `(v) => {
|
|
632
635
|
${e.value.value} = v;
|
|
633
636
|
}` : "(v) => {}"
|
|
634
|
-
}, s = t.__parseFunction(r), o =
|
|
637
|
+
}, s = t.__parseFunction(r), o = ce(e.modifiers), a = w(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
|
635
638
|
return {
|
|
636
639
|
[a]: t.__parseExpression(e.value),
|
|
637
640
|
[`onUpdate:${a}`]: o.length && s ? n.withModifiers(s, o) : s
|
|
638
641
|
};
|
|
639
642
|
}
|
|
640
|
-
function
|
|
643
|
+
function pt(n, e, t, r, s) {
|
|
641
644
|
if (!e)
|
|
642
645
|
return null;
|
|
643
|
-
if (
|
|
646
|
+
if (b(e))
|
|
644
647
|
return { default: () => e };
|
|
645
648
|
if (w(e))
|
|
646
649
|
return {
|
|
647
|
-
default: () =>
|
|
650
|
+
default: () => ne(t.__parseExpression(e))
|
|
648
651
|
};
|
|
649
652
|
if (Array.isArray(e) && e.length > 0) {
|
|
650
|
-
const o =
|
|
653
|
+
const o = ft(e), a = (i) => !i || !s ? {} : s?.id && Object.keys(i).length ? {
|
|
651
654
|
[`scope_${s.id}`]: i
|
|
652
655
|
} : {};
|
|
653
656
|
return Object.entries(o).reduce((i, [l, { nodes: c, params: d }]) => (i[l] = (p) => {
|
|
654
|
-
const f = d.length ?
|
|
657
|
+
const f = d.length ? $e(p ?? {}, d) : a(p);
|
|
655
658
|
return c.map(
|
|
656
659
|
(h) => M(h, t.__clone(f), n, r)
|
|
657
660
|
);
|
|
@@ -659,7 +662,7 @@ function ut(n, e, t, r, s) {
|
|
|
659
662
|
}
|
|
660
663
|
return null;
|
|
661
664
|
}
|
|
662
|
-
function
|
|
665
|
+
function ft(n) {
|
|
663
666
|
const e = {
|
|
664
667
|
default: {
|
|
665
668
|
params: [],
|
|
@@ -667,7 +670,7 @@ function pt(n) {
|
|
|
667
670
|
}
|
|
668
671
|
};
|
|
669
672
|
for (const t of n) {
|
|
670
|
-
const r =
|
|
673
|
+
const r = dt(t.slot), s = r.name;
|
|
671
674
|
e[s] ? (e[s].nodes.push(t), e[s].params = e[s].params.concat(r.params)) : e[s] = {
|
|
672
675
|
nodes: [t],
|
|
673
676
|
params: r.params
|
|
@@ -675,19 +678,19 @@ function pt(n) {
|
|
|
675
678
|
}
|
|
676
679
|
return e;
|
|
677
680
|
}
|
|
678
|
-
function
|
|
679
|
-
return
|
|
681
|
+
function dt(n = "default") {
|
|
682
|
+
return b(n) ? { name: n, params: [] } : { params: [], ...n };
|
|
680
683
|
}
|
|
681
|
-
function
|
|
684
|
+
function mt(n, e, t) {
|
|
682
685
|
const { value: r, iterator: s } = n, { item: o = "item", index: a = "index" } = s || {};
|
|
683
686
|
let i = t.__parseExpression(r) || [];
|
|
684
687
|
return Number.isInteger(i) && (i = new Array(i).fill(!0).map((l, c) => c + 1)), Array.isArray(i) ? i.map((l, c) => e(t.__clone({ [o]: l, [a]: c }))) : (console.warn("[vForRender]:", `${r?.value} is not a Arrary`), []);
|
|
685
688
|
}
|
|
686
|
-
const
|
|
689
|
+
const Z = te({
|
|
687
690
|
name: "VtjPageContainer",
|
|
688
691
|
async setup() {
|
|
689
|
-
const n =
|
|
690
|
-
return r &&
|
|
692
|
+
const n = ue(), e = re(), t = e.params.id, r = t ? n.getPage(t) : n.getHomepage(), s = r ? await n.getRenderComponent(r.id) : null;
|
|
693
|
+
return r && Ie(r.title || "VTJ"), {
|
|
691
694
|
provider: n,
|
|
692
695
|
component: s,
|
|
693
696
|
file: r,
|
|
@@ -695,19 +698,19 @@ const Q = ee({
|
|
|
695
698
|
};
|
|
696
699
|
},
|
|
697
700
|
render() {
|
|
698
|
-
return this.component ?
|
|
701
|
+
return this.component ? B(this.component, this.query) : B("div", "页面不存在");
|
|
699
702
|
}
|
|
700
|
-
}),
|
|
703
|
+
}), ht = te({
|
|
701
704
|
name: "VtjStartupContainer",
|
|
702
705
|
render() {
|
|
703
|
-
return
|
|
706
|
+
return B(He);
|
|
704
707
|
}
|
|
705
|
-
}),
|
|
706
|
-
class
|
|
708
|
+
}), le = Symbol("Provider");
|
|
709
|
+
class vt extends fe {
|
|
707
710
|
mode;
|
|
708
711
|
globals = {};
|
|
709
712
|
modules = {};
|
|
710
|
-
adapter = { request:
|
|
713
|
+
adapter = { request: Ue, jsonp: je };
|
|
711
714
|
apis = {};
|
|
712
715
|
dependencies = {};
|
|
713
716
|
materials = {};
|
|
@@ -746,7 +749,7 @@ class ht extends pe {
|
|
|
746
749
|
materials: p,
|
|
747
750
|
materialExports: f,
|
|
748
751
|
materialMapLibrary: h
|
|
749
|
-
} =
|
|
752
|
+
} = Me(r, l), m = window;
|
|
750
753
|
m.CKEDITOR_VERSION = void 0;
|
|
751
754
|
for (const u of c) {
|
|
752
755
|
const S = o[u], g = m[u];
|
|
@@ -757,14 +760,14 @@ class ht extends pe {
|
|
|
757
760
|
else {
|
|
758
761
|
const $ = d[u] || [];
|
|
759
762
|
for (const j of $)
|
|
760
|
-
|
|
763
|
+
V(j) && await Te(u, F.append(j, { v: C })), L(j) && await Y(F.append(j, { v: C })), a[u] = m[u];
|
|
761
764
|
}
|
|
762
765
|
}
|
|
763
766
|
for (const u of p)
|
|
764
|
-
await
|
|
767
|
+
await Y(F.append(u, { v: C }));
|
|
765
768
|
const v = this.materials || {};
|
|
766
769
|
for (const u of f) {
|
|
767
|
-
const S = m[h[u]], g =
|
|
770
|
+
const S = m[h[u]], g = de[u];
|
|
768
771
|
if (g)
|
|
769
772
|
S && g.forEach(($) => {
|
|
770
773
|
i[$] = S[$];
|
|
@@ -772,29 +775,29 @@ class ht extends pe {
|
|
|
772
775
|
else {
|
|
773
776
|
const $ = v[u] ? (await v[u]()).default : m[u];
|
|
774
777
|
$ && S && ($.components || []).forEach((j) => {
|
|
775
|
-
i[j.name] =
|
|
778
|
+
i[j.name] = ke(j, S);
|
|
776
779
|
});
|
|
777
780
|
}
|
|
778
781
|
}
|
|
779
|
-
s && (this.apis =
|
|
782
|
+
s && (this.apis = Je(s, this.adapter), ie(), this.project.config?.mock && Ve(s)), this.initRouter(), this.triggerReady();
|
|
780
783
|
}
|
|
781
784
|
initRouter() {
|
|
782
785
|
const { router: e, project: t } = this;
|
|
783
786
|
e && (e.addRoute({
|
|
784
787
|
path: "/page/:id",
|
|
785
788
|
name: "VtjPage",
|
|
786
|
-
component:
|
|
789
|
+
component: Z
|
|
787
790
|
}), e.addRoute({
|
|
788
791
|
path: "/",
|
|
789
792
|
name: "VtjHomepage",
|
|
790
|
-
component: t?.homepage ?
|
|
793
|
+
component: t?.homepage ? Z : ht
|
|
791
794
|
}));
|
|
792
795
|
}
|
|
793
796
|
install(e) {
|
|
794
797
|
const t = e.config.globalProperties.installed || {};
|
|
795
798
|
for (const [r, s] of Object.entries(this.library))
|
|
796
|
-
!t[r] &&
|
|
797
|
-
e.provide(
|
|
799
|
+
!t[r] && Be(s) && (e.use(s), t[r] = !0);
|
|
800
|
+
e.provide(le, this), e.config.globalProperties.installed = t;
|
|
798
801
|
}
|
|
799
802
|
getFile(e) {
|
|
800
803
|
const { blocks: t = [] } = this.project || {};
|
|
@@ -842,12 +845,12 @@ class ht extends pe {
|
|
|
842
845
|
apis: a,
|
|
843
846
|
window,
|
|
844
847
|
...t
|
|
845
|
-
}, l =
|
|
848
|
+
}, l = U({
|
|
846
849
|
getDsl: async (c) => await this.getDsl(c) || null,
|
|
847
850
|
getDslByUrl: async (c) => await this.getDslByUrl(c) || null,
|
|
848
851
|
options: i
|
|
849
852
|
});
|
|
850
|
-
return
|
|
853
|
+
return N({
|
|
851
854
|
...i,
|
|
852
855
|
dsl: e,
|
|
853
856
|
loader: l
|
|
@@ -864,34 +867,34 @@ class ht extends pe {
|
|
|
864
867
|
return o ? this.createDslRenderer(o).renderer : (O.warn(`Can not find dsl: ${e}`), null);
|
|
865
868
|
}
|
|
866
869
|
defineUrlSchemaComponent(e, t) {
|
|
867
|
-
return
|
|
870
|
+
return z(async () => {
|
|
868
871
|
const r = await this.getDslByUrl(e);
|
|
869
872
|
return r ? (r.name = t || r.name, this.createDslRenderer(r).renderer) : null;
|
|
870
873
|
});
|
|
871
874
|
}
|
|
872
875
|
definePluginComponent(e) {
|
|
873
|
-
return
|
|
874
|
-
const t = await
|
|
875
|
-
return t ? (
|
|
876
|
+
return z(async () => {
|
|
877
|
+
const t = await ae(e, window);
|
|
878
|
+
return t ? (oe(t.css), t.component) : null;
|
|
876
879
|
});
|
|
877
880
|
}
|
|
878
881
|
}
|
|
879
|
-
function
|
|
880
|
-
const e = new
|
|
882
|
+
function xt(n) {
|
|
883
|
+
const e = new vt(n);
|
|
881
884
|
return {
|
|
882
885
|
provider: e,
|
|
883
886
|
onReady: (r) => e.ready(r)
|
|
884
887
|
};
|
|
885
888
|
}
|
|
886
|
-
function
|
|
887
|
-
const e =
|
|
889
|
+
function ue(n = {}) {
|
|
890
|
+
const e = Fe(le);
|
|
888
891
|
if (!e)
|
|
889
892
|
throw new Error("Can not find provider");
|
|
890
893
|
if (e.mode === _.Raw && e.nodeEnv === "development") {
|
|
891
894
|
const { id: t, version: r } = n;
|
|
892
895
|
t && r && (async () => {
|
|
893
896
|
const s = await e.getDsl(t);
|
|
894
|
-
s?.__VERSION__ !== r &&
|
|
897
|
+
s?.__VERSION__ !== r && J.warning({
|
|
895
898
|
title: s?.name,
|
|
896
899
|
message: "当前组件源码版本与运行时版本不一致,请重新发布组件"
|
|
897
900
|
});
|
|
@@ -899,7 +902,7 @@ function le(n = {}) {
|
|
|
899
902
|
}
|
|
900
903
|
return e;
|
|
901
904
|
}
|
|
902
|
-
const
|
|
905
|
+
const K = new Ee({
|
|
903
906
|
settings: {
|
|
904
907
|
type: "json",
|
|
905
908
|
validSuccess: !0,
|
|
@@ -907,12 +910,12 @@ const L = new je({
|
|
|
907
910
|
failMessage: !0,
|
|
908
911
|
validate: (n) => n.data?.code === 0,
|
|
909
912
|
showError: (n) => {
|
|
910
|
-
|
|
913
|
+
J.error({
|
|
911
914
|
message: n || "未知错误"
|
|
912
915
|
});
|
|
913
916
|
}
|
|
914
917
|
}
|
|
915
|
-
}),
|
|
918
|
+
}), yt = (n = "/vtj/local/repository/${type}.json") => (e, t) => K.send({
|
|
916
919
|
url: n,
|
|
917
920
|
method: "post",
|
|
918
921
|
query: { type: e },
|
|
@@ -920,7 +923,7 @@ const L = new je({
|
|
|
920
923
|
type: e,
|
|
921
924
|
data: t
|
|
922
925
|
}
|
|
923
|
-
}),
|
|
926
|
+
}), gt = (n = "/vtj/local/repository/uploader.json") => async (e, t) => await K.send({
|
|
924
927
|
url: n,
|
|
925
928
|
method: "post",
|
|
926
929
|
data: {
|
|
@@ -931,12 +934,12 @@ const L = new je({
|
|
|
931
934
|
type: "data"
|
|
932
935
|
}
|
|
933
936
|
}).then((r) => r && r[0] ? r[0] : null).catch(() => null);
|
|
934
|
-
class
|
|
937
|
+
class W {
|
|
935
938
|
api;
|
|
936
939
|
pluginCaches = {};
|
|
937
940
|
uploader;
|
|
938
941
|
constructor() {
|
|
939
|
-
this.api =
|
|
942
|
+
this.api = yt(), this.uploader = gt();
|
|
940
943
|
}
|
|
941
944
|
async init(e) {
|
|
942
945
|
return console.log("BaseService.init", e), {};
|
|
@@ -1006,11 +1009,11 @@ class K {
|
|
|
1006
1009
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
|
1007
1010
|
}
|
|
1008
1011
|
async getPluginMaterial(e) {
|
|
1009
|
-
const { urls: t = [] } = e, r = t.filter((o) =>
|
|
1012
|
+
const { urls: t = [] } = e, r = t.filter((o) => De(o))[0];
|
|
1010
1013
|
if (!r)
|
|
1011
1014
|
return null;
|
|
1012
1015
|
const s = this.pluginCaches[r];
|
|
1013
|
-
return s || (this.pluginCaches[r] =
|
|
1016
|
+
return s || (this.pluginCaches[r] = K.send({
|
|
1014
1017
|
url: r,
|
|
1015
1018
|
method: "get",
|
|
1016
1019
|
settings: {
|
|
@@ -1020,12 +1023,12 @@ class K {
|
|
|
1020
1023
|
}).then((o) => o.data).catch(() => null));
|
|
1021
1024
|
}
|
|
1022
1025
|
}
|
|
1023
|
-
const y = new
|
|
1026
|
+
const y = new Pe({
|
|
1024
1027
|
type: "local",
|
|
1025
1028
|
expired: 0,
|
|
1026
1029
|
prefix: "__VTJ_"
|
|
1027
1030
|
});
|
|
1028
|
-
class
|
|
1031
|
+
class Ot extends W {
|
|
1029
1032
|
init(e) {
|
|
1030
1033
|
const t = new x(e), r = y.get(`project_${t.id}`), s = Object.assign(t.toDsl(), r || {});
|
|
1031
1034
|
return y.save(`project_${t.id}`, s), Promise.resolve(s);
|
|
@@ -1035,7 +1038,7 @@ class xt extends K {
|
|
|
1035
1038
|
return y.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
|
|
1036
1039
|
}
|
|
1037
1040
|
saveMaterials(e, t) {
|
|
1038
|
-
return y.save(`materials_${e.id}`,
|
|
1041
|
+
return y.save(`materials_${e.id}`, q(t)), Promise.resolve(!0);
|
|
1039
1042
|
}
|
|
1040
1043
|
saveFile(e) {
|
|
1041
1044
|
return y.save(`file_${e.id}`, e), Promise.resolve(!0);
|
|
@@ -1059,7 +1062,7 @@ class xt extends K {
|
|
|
1059
1062
|
return Promise.resolve(!0);
|
|
1060
1063
|
}
|
|
1061
1064
|
getHistory(e) {
|
|
1062
|
-
const t = y.get(`history_${e}`), r = new
|
|
1065
|
+
const t = y.get(`history_${e}`), r = new ee(t || { id: e });
|
|
1063
1066
|
return Promise.resolve(r.toDsl());
|
|
1064
1067
|
}
|
|
1065
1068
|
getHistoryItem(e, t) {
|
|
@@ -1075,7 +1078,7 @@ class xt extends K {
|
|
|
1075
1078
|
}), Promise.resolve(!0);
|
|
1076
1079
|
}
|
|
1077
1080
|
}
|
|
1078
|
-
class
|
|
1081
|
+
class _t extends W {
|
|
1079
1082
|
projects = {};
|
|
1080
1083
|
materials = {};
|
|
1081
1084
|
files = {};
|
|
@@ -1090,7 +1093,7 @@ class gt extends K {
|
|
|
1090
1093
|
return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
|
|
1091
1094
|
}
|
|
1092
1095
|
saveMaterials(e, t) {
|
|
1093
|
-
return e.id && (this.materials[e.id] =
|
|
1096
|
+
return e.id && (this.materials[e.id] = q(t)), Promise.resolve(!0);
|
|
1094
1097
|
}
|
|
1095
1098
|
saveFile(e) {
|
|
1096
1099
|
return this.files[e.id] = e, Promise.resolve(!0);
|
|
@@ -1114,7 +1117,7 @@ class gt extends K {
|
|
|
1114
1117
|
return Promise.resolve(!0);
|
|
1115
1118
|
}
|
|
1116
1119
|
getHistory(e) {
|
|
1117
|
-
const t = this.histories[e], r = new
|
|
1120
|
+
const t = this.histories[e], r = new ee(t || { id: e });
|
|
1118
1121
|
return Promise.resolve(r);
|
|
1119
1122
|
}
|
|
1120
1123
|
getHistoryItem(e, t) {
|
|
@@ -1133,10 +1136,10 @@ class gt extends K {
|
|
|
1133
1136
|
}
|
|
1134
1137
|
}
|
|
1135
1138
|
let H = null;
|
|
1136
|
-
function
|
|
1137
|
-
return H || (H = new
|
|
1139
|
+
function Dt() {
|
|
1140
|
+
return H || (H = new _t(), H);
|
|
1138
1141
|
}
|
|
1139
|
-
class
|
|
1142
|
+
class Mt extends W {
|
|
1140
1143
|
getFileCaches = {};
|
|
1141
1144
|
async init(e) {
|
|
1142
1145
|
return await this.api("init", e).catch(() => null) || {};
|
|
@@ -1147,7 +1150,7 @@ class Dt extends K {
|
|
|
1147
1150
|
async saveMaterials(e, t) {
|
|
1148
1151
|
return !!await this.api("saveMaterials", {
|
|
1149
1152
|
project: e,
|
|
1150
|
-
materials:
|
|
1153
|
+
materials: q(t)
|
|
1151
1154
|
}).catch(() => !1);
|
|
1152
1155
|
}
|
|
1153
1156
|
async saveFile(e) {
|
|
@@ -1187,7 +1190,7 @@ class Dt extends K {
|
|
|
1187
1190
|
);
|
|
1188
1191
|
}
|
|
1189
1192
|
}
|
|
1190
|
-
function
|
|
1193
|
+
function pe(n = []) {
|
|
1191
1194
|
return n.map((e) => {
|
|
1192
1195
|
const { id: t, title: r, icon: s, children: o, hidden: a } = e;
|
|
1193
1196
|
return {
|
|
@@ -1196,12 +1199,12 @@ function ue(n = []) {
|
|
|
1196
1199
|
icon: s,
|
|
1197
1200
|
hidden: a,
|
|
1198
1201
|
url: `/page/${t}`,
|
|
1199
|
-
children: o && o.length ?
|
|
1202
|
+
children: o && o.length ? pe(o) : void 0
|
|
1200
1203
|
};
|
|
1201
1204
|
});
|
|
1202
1205
|
}
|
|
1203
|
-
function
|
|
1204
|
-
const n =
|
|
1206
|
+
function kt() {
|
|
1207
|
+
const n = ue(), e = re(), t = be(!1), r = n.project;
|
|
1205
1208
|
Ce(() => {
|
|
1206
1209
|
const { name: a, params: i, meta: l } = e;
|
|
1207
1210
|
if (a === "VtjPage") {
|
|
@@ -1213,7 +1216,7 @@ function Mt() {
|
|
|
1213
1216
|
} else
|
|
1214
1217
|
t.value = !l.mask;
|
|
1215
1218
|
});
|
|
1216
|
-
const s =
|
|
1219
|
+
const s = pe(r?.pages), o = r?.config;
|
|
1217
1220
|
return {
|
|
1218
1221
|
disabled: t,
|
|
1219
1222
|
logo: o?.logo,
|
|
@@ -1223,53 +1226,53 @@ function Mt() {
|
|
|
1223
1226
|
};
|
|
1224
1227
|
}
|
|
1225
1228
|
export {
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1229
|
+
xe as BUILT_IN_DIRECTIVES,
|
|
1230
|
+
W as BaseService,
|
|
1231
|
+
G as CONTEXT_HOST,
|
|
1232
|
+
Ke as Context,
|
|
1230
1233
|
_ as ContextMode,
|
|
1231
|
-
|
|
1232
|
-
|
|
1234
|
+
Oe as DATA_TYPES,
|
|
1235
|
+
Ht as JSCodeToString,
|
|
1233
1236
|
Ct as LIFE_CYCLES_LIST,
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1237
|
+
Mt as LocalService,
|
|
1238
|
+
_t as MemoryService,
|
|
1239
|
+
vt as Provider,
|
|
1240
|
+
Ot as StorageService,
|
|
1241
|
+
C as VTJ_RENDERER_VERSION,
|
|
1242
|
+
se as adoptedStyleSheets,
|
|
1243
|
+
Rt as createAssetScripts,
|
|
1244
|
+
It as createAssetsCss,
|
|
1245
|
+
Qe as createDataSources,
|
|
1246
|
+
U as createLoader,
|
|
1247
|
+
Dt as createMemoryService,
|
|
1248
|
+
xt as createProvider,
|
|
1249
|
+
N as createRenderer,
|
|
1250
|
+
qe as createSchemaApi,
|
|
1251
|
+
Je as createSchemaApis,
|
|
1252
|
+
tt as defaultLoader,
|
|
1250
1253
|
I as fillBasePath,
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1254
|
+
ce as getModifiers,
|
|
1255
|
+
ae as getPlugin,
|
|
1256
|
+
ke as getRawComponent,
|
|
1257
|
+
V as isCSSUrl,
|
|
1258
|
+
Ne as isJSCode,
|
|
1256
1259
|
w as isJSExpression,
|
|
1257
1260
|
T as isJSFunction,
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1261
|
+
De as isJSON,
|
|
1262
|
+
L as isJSUrl,
|
|
1263
|
+
Be as isVuePlugin,
|
|
1264
|
+
Te as loadCss,
|
|
1265
|
+
oe as loadCssUrl,
|
|
1266
|
+
Ae as loadScriptUrl,
|
|
1267
|
+
Le as mockApi,
|
|
1268
|
+
Ve as mockApis,
|
|
1269
|
+
ie as mockCleanup,
|
|
1267
1270
|
M as nodeRender,
|
|
1268
|
-
|
|
1271
|
+
Me as parseDeps,
|
|
1269
1272
|
R as parseExpression,
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1273
|
+
Q as parseFunction,
|
|
1274
|
+
le as providerKey,
|
|
1275
|
+
ne as toString,
|
|
1276
|
+
kt as useMask,
|
|
1277
|
+
ue as useProvider
|
|
1275
1278
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vtj/renderer",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "vue-tsc && vite build",
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
"coverage": "vitest run --coverage"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@vtj/core": "^0.8.
|
|
14
|
-
"@vtj/icons": "^0.8.
|
|
15
|
-
"@vtj/ui": "^0.8.
|
|
16
|
-
"@vtj/utils": "^0.8.
|
|
13
|
+
"@vtj/core": "^0.8.5",
|
|
14
|
+
"@vtj/icons": "^0.8.5",
|
|
15
|
+
"@vtj/ui": "^0.8.5",
|
|
16
|
+
"@vtj/utils": "^0.8.5",
|
|
17
17
|
"mockjs": "~1.1.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dist",
|
|
36
36
|
"types"
|
|
37
37
|
],
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "905b8b33d7726da4a952c8350c26197abc5af22d",
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
41
41
|
}
|
package/types/version.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) 2024, VTJ.PRO All rights reserved.
|
|
3
3
|
* @name @vtj/renderer
|
|
4
4
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
5
|
-
* @version 0.8.
|
|
5
|
+
* @version 0.8.4
|
|
6
6
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
7
7
|
*/
|
|
8
|
-
export declare const version = "0.8.
|
|
8
|
+
export declare const version = "0.8.4";
|