@vtj/renderer 0.8.61 → 0.8.63
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 +4 -4
- package/dist/index.mjs +171 -179
- package/package.json +7 -7
- package/types/render/context.d.ts +1 -1
- package/types/version.d.ts +2 -2
package/dist/index.cjs
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
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.63
|
|
6
6
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
7
|
-
*/const P="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 q(n,e,t=!1,r=!1){const s=b(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 S(n){return n&&n.type==="JSExpression"}function I(n){return typeof n=="object"&&n&&n.type==="JSFunction"}function le(n){return S(n)||I(n)}function be(n){return le(n)?n.value:JSON.stringify(n)}let C=null;const Re=u.createRequest({settings:{type:"form",validSuccess:!0,originResponse:!1,loading:!0,validate:n=>n.data?.code===0||!!n.data?.success,failMessage:!0,showError:n=>{O.ElNotification.error({message:n||"未知错误"})},showLoading:()=>{C&&C.close(),C=O.ElLoading.service({lock:!0,text:"Loading",background:"rgba(0, 0, 0, 0.05)"})},hideLoading:()=>{C&&(C.close(),C=null)}}});function ue(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?b(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
|
|
7
|
+
*/const P="0.8.63";var w=(n=>(n.Runtime="Runtime",n.Design="Design",n.Raw="Raw",n.VNode="VNode",n))(w||{});const U=["$el","$emit","$nextTick","$parent","$root","$attrs","$slots","$watch","$props","$options","$forceUpdate"],Ee=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeUnmount","unmounted","errorCaptured","renderTracked","renderTriggered","activated","deactivated"],te=["vIf","vShow","vModel","vFor","vBind"],ne={String,Number,Boolean,Array,Object,Function,Date};function R(n,e){return n.map(t=>u.isUrl(t)?t:`${e}${t}`)}function A(n){return/\.css$/.test(n)}function k(n){return/\.js$/.test(n)}function re(n){return/\.json$/.test(n)}function Ce(n){return n.map(e=>`<script src="${u.url.append(e,{v:P})}"><\/script>`).join("")}function Pe(n=[]){return n.map(e=>`<link rel="stylesheet" href="${u.url.append(e,{v:P})}" />`).join("")}function se(n,e){const t=n.filter(d=>!!d.enabled),r=[],s=[],o=[],a=[],i={},l={},c=[],h={};return t.forEach(({urls:d,assetsUrl:f,library:p,assetsLibrary:g,localeLibrary:v})=>{d?.forEach(y=>{k(y)&&r.push(y),A(y)&&s.push(y)}),p&&(a.push(p),i[p]=R(d||[],e),v&&(l[p]=v)),f&&o.push(f),g&&c.push(g),p&&g&&(h[g]=p)}),{scripts:R(r,e),css:R(s,e),materials:R(o,e),libraryExports:a,materialExports:u.dedupArray(c),materialMapLibrary:h,libraryMap:i,libraryLocaleMap:l}}function oe(n,e){const{name:t,parent:r,alias:s}=n;return r?e[r]?.[s||t]:e[s||t]}function L(n){return u.isString(n)?n:JSON.stringify(n)}function J(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 ie(n,e){const t=await window.fetch(e).then(r=>r.text()).catch(()=>"");t&&J(window,n,t)}function V(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 ae(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):i(null)},c.onerror=h=>{i(h)},s.appendChild(c)}})}function ce(n){return u.isFunction(n)||u.isFunction(n?.install)}function b(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 q(n,e,t=!1,r=!1){const s=b(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 S(n){return n&&n.type==="JSExpression"}function I(n){return typeof n=="object"&&n&&n.type==="JSFunction"}function le(n){return S(n)||I(n)}function be(n){return le(n)?n.value:JSON.stringify(n)}let C=null;const Re=u.createRequest({settings:{type:"form",validSuccess:!0,originResponse:!1,loading:!0,validate:n=>n.data?.code===0||!!n.data?.success,failMessage:!0,showError:n=>{O.ElNotification.error({message:n||"未知错误"})},showLoading:()=>{C&&C.close(),C=O.ElLoading.service({lock:!0,text:"Loading",background:"rgba(0, 0, 0, 0.05)"})},hideLoading:()=>{C&&(C.close(),C=null)}}});function ue(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?b(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){const{metaQuery:t}=e;if(!t)return;const{code:r,queryCode:s}=n;return(o,a)=>{if(!t){console.warn("adapter.metaQuery is not defined!");return}return t(r,s,o,a)}}function fe(n=[],e=[],t){const r={};for(const s of n)r[s.id]=ue(s,t);for(const s of e)r[s.id]=de(s,t);return r}function pe(n=[]){x.setup({timeout:"50-500"}),W(),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=b(t,{},!0);x.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}),x.mock(o(a))})}}function W(){x._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=D){const r=t.getCurrentInstance();if(!r)return;this.__refs={},this.$refs={},this.context={},this.__contextRefs={},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()}),t.onBeforeUpdate(()=>{this.__refs={},this.$refs={},this.__contextRefs={},this.context={}})}__proxy(){this.__instance&&U.forEach(e=>{this[e]=this.__instance?.[e]})}__cleanup(){U.forEach(e=>{this[e]=null})}__parseFunction(e){if(e)if(this.__mode===w.Runtime){const{id:t,type:r}=e,s=t?this.__transform[t]??e.value:e.value;return q({type:r,value:s},this)}else return q(e,this)}__parseExpression(e){if(e)if(this.__mode===w.Runtime){const{id:t,type:r}=e,s=t?this.__transform[t]??e.value:e.value;return b({type:r,value:s},this)}else return b(e,this)}__ref(e=null,t){if(this.__mode!==w.VNode)return e&&e!==this.__id&&(this.__contextRefs[e]=this),async r=>{await u.delay(0);let s=r?.$vtjEl||r?.$el||r?._?.vnode?.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,w.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 T(n){const{Vue:e=D,mode:t=w.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}),h=e.defineComponent({name:i.value.name,props:{...Ie(i.value.props??[],c)},setup(d){c.$props=d,c.props=d,i.value.id&&J(n.window||window,i.value.id,i.value.css||""),c.state=Me(e,i.value.state??{},c);const f=Oe(e,i.value.computed??{},c),p=xe(i.value.methods??{},c),g=Te(e,i.value.inject,c),v=ve(i.value.dataSources||{},c),y={...g,...f,...p,...v};return c.setup(y,e),He(e,i.value.watch??[],c),{vtj:c}},emits:Fe(i.value.emits),expose:["vtj"],render(){if(!i.value.nodes)return null;const d=i.value.nodes||[];return d.length===1?F(d[0],c,e,a):d.map(f=>F(f,c,e,a))},...De(i.value.lifeCycles??{},c)});return{renderer:e.markRaw(h),context:c}}function Fe(n=[]){return n.map(e=>u.isString(e)?e:e.name)}function Ie(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:S(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 Me(n,e,t){return n.reactive(Object.keys(e||{}).reduce((r,s)=>{let o=e[s];return S(o)?o=t.__parseExpression(o):I(o)&&(o=t.__parseFunction(o)),r[s]=o,r},{}))}function Oe(n,e,t){return Object.entries(e??{}).reduce((r,[s,o])=>(r[s]=n.computed(t.__parseFunction(o)),r),{})}function xe(n,e){return Object.entries(n??{}).reduce((t,[r,s])=>(t[r]=e.__parseFunction(s),t),{})}function Te(n,e=[],t){return e.reduce((r,s)=>{const{name:o,from:a}=s||{};s.default;const i=S(a)?t.__parseExpression(a)||o:a??o,l=S(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=I(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 He(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 N=[];const ge=n=>n;async function Y(n,e=window){const{urls:t=[],library:r}=n,s=t.filter(i=>k(i));if(s.length===0||!r)return null;const o=t.filter(i=>A(i)),a=await ae(s,r,e).catch(i=>(console.warn("loadScriptUrl error",s,r,i),null));return a?{component:a,css:o}:null}function H(n){const{getDsl:e,getDslByUrl:t,options:r}=n;return r.window&&(N.forEach(s=>{delete r.window[s]}),N=[]),(s,o,a=D)=>!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?T({...r,Vue:a,dsl:i,mode:w.Runtime,loader:H(n)}).renderer:null}):o.type==="UrlSchema"&&o.url?a.defineAsyncComponent(async()=>{const i=await t(o.url);return i&&(i.name=s),i?T({...r,Vue:a,dsl:i,mode:w.Runtime,loader:H(n)}).renderer:null}):o.type==="Plugin"?(o.library&&N.push(o.library),a.defineAsyncComponent(async()=>{const i=await Y(o,r.window);return i?(V(i.css,r.window),i.component):(console.warn("getPlugin result is null",o),null)})):s}function F(n,e,t=D,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:h}=Ae(o);if(a&&!ke(a,e))return null;const d=f=>{const p=f.$components,g=(()=>{if(n.name==="component")return Be(f,n.props?.is);if(n.name==="slot")return n.name;const E=r(n.name,n.from,t);return u.isString(E)?p[E]??E:E})(),v=Ne(s,n.props??{},f),y=Ue(t,n.events??{},f);if(n.name==="slot")return qe(t,n,v,f,r);h&&Object.assign(v,f.__parseExpression(h.value)),l&&(v.style=Object.assign(v.style??{},Je(l,f))),c.forEach(E=>{Object.assign(v,Ve(t,E,f))});const j=We(t,n.children??[],f,r,n);return t.createVNode(g,{...v,...y},j)};return i?Xe(i,d,e):d(e)}function Ae(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=>!te.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 Be(n,e){return e?S(e)?n.__parseExpression(e):e:"div"}function Ne(n,e,t){const r=Object.keys(e||{}).reduce((s,o)=>{let a=e[o];return S(a)?a=t.__parseExpression(a):I(a)&&(a=t.__parseFunction(a)),s[o]=a,s},{});return r.ref=t.__ref(n,r.ref),r}function Ue(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=K(i.modifiers),c=l.find(f=>r.includes(f)),h="on"+u.upperFirst(a)+(c&&s[c]||""),d=t.__parseFunction(i.handler);return d&&(o[h]=n.withModifiers(d,l)),o},{})}function K(n={},e=!1){const t=Object.keys(n);return e?t.map(r=>"."+r):t}function qe(n,e,t,r,s){const{children:o}=e,a=Le(e,r),i=r.$slots?.[a.name];return i?i(t):o?u.isString(o)?n.createTextVNode(o):S(o)?n.createTextVNode(L(r.__parseExpression(o))):Array.isArray(o)?o.map(l=>F(l,r,n,s)):null:null}function Le(n,e){const{props:t}=n,r=t?.name||"default";return{name:S(r)?e.__parseExpression(r):r,params:[]}}function Je(n,e){return e.__parseExpression(n.value)?{}:{display:"none"}}function Ve(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=K(e.modifiers),a=S(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 We(n,e,t,r,s){if(!e)return null;if(u.isString(e))return{default:()=>e};if(S(e))return{default:()=>L(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:h}])=>(i[l]=f=>{const p=h.length?u.pick(f??{},h):a(f);return c.map(d=>F(d,t.__clone(p),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`),[])}function ze(n){return m.getCurrentScope()?(m.onScopeDispose(n),!0):!1}function X(n){return typeof n=="function"?n():m.unref(n)}const ye=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Ge=n=>n!=null,Qe=()=>{};function Ze(n){return m.getCurrentInstance()}function et(...n){if(n.length!==1)return m.toRef(...n);const e=n[0];return typeof e=="function"?m.readonly(m.customRef(()=>({get:e,set:Qe}))):m.ref(e)}function tt(n,e){Ze()&&m.onBeforeUnmount(n,e)}function nt(n){var e;const t=X(n);return(e=t?.$el)!=null?e:t}const rt=ye?window:void 0,st=ye?window.document:void 0;function ot(){const n=m.ref(!1),e=m.getCurrentInstance();return e&&m.onMounted(()=>{n.value=!0},e),n}function it(n){const e=ot();return m.computed(()=>(e.value,!!n()))}function at(n,e,t={}){const{window:r=rt,...s}=t;let o;const a=it(()=>r&&"MutationObserver"in r),i=()=>{o&&(o.disconnect(),o=void 0)},l=m.computed(()=>{const p=X(n),d=(Array.isArray(p)?p:[p]).map(nt).filter(Ge);return new Set(d)}),c=m.watch(()=>l.value,p=>{i(),a.value&&p.size&&(o=new MutationObserver(e),p.forEach(d=>o.observe(d,s)))},{immediate:!0,flush:"post"}),h=()=>o?.takeRecords(),f=()=>{i(),c()};return ze(f),{isSupported:a,stop:f,takeRecords:h}}function ct(n=null,e={}){var t,r,s;const{document:o=st,restoreOnUnmount:a=f=>f}=e,i=(t=o?.title)!=null?t:"",l=et((r=n??o?.title)!=null?r:null),c=n&&typeof n=="function";function h(f){if(!("titleTemplate"in e))return f;const p=e.titleTemplate||"%s";return typeof p=="function"?p(f):X(p).replace(/%s/g,f)}return m.watch(l,(f,p)=>{f!==p&&o&&(o.title=h(typeof f=="string"?f:""))},{immediate:!0}),e.observe&&!e.titleTemplate&&o&&!c&&at((s=o.head)==null?void 0:s.querySelector("title"),()=>{o&&o.title!==l.value&&(l.value=h(o.title))},{childList:!0}),tt(()=>{if(a){const f=a(i,l.value||"");f!=null&&o&&(o.title=f)}}),l}const Z=m.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&&ct(r.title||"VTJ"),{provider:n,component:s,file:r,query:e.query}},render(){return this.component?m.h(this.component,this.query):m.h("div","页面不存在")}}),lt=m.defineComponent({name:"VtjStartupContainer",render(){return m.h(je.XStartup)}}),z=Symbol("Provider");class _e extends $.Base{constructor(e){super(),this.options=e;const{service:t,mode:r=w.Raw,dependencies:s,materials:o,project:a={},adapter:i={},globals:l={},modules:c={},router:h=null,materialPath:f="./",nodeEnv:p="development"}=e;this.mode=r,this.modules=c,this.service=t,this.router=h,this.materialPath=f,this.nodeEnv=p,s&&(this.dependencies=s),o&&(this.materials=o),Object.assign(this.globals,l),Object.assign(this.adapter,i),r!==w.Design&&this.load(a)}mode;globals={};modules={};adapter={request:Re,jsonp:u.jsonp};apis={};dependencies={};materials={};library={};service;project=null;components={};nodeEnv="development";router=null;materialPath="./";urlDslCaches={};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{apis:r=[],meta:s=[]}=this.project,o=window;o.CKEDITOR_VERSION=void 0,this.nodeEnv!=="production"&&await this.loadAssets(o),this.apis=pe(r,s,this.adapter),W(),this.project.config?.mock&&de(r),this.initRouter(),this.triggerReady()}async loadAssets(e){const{dependencies:t=[]}=this.project,{dependencies:r,library:s,components:o,materialPath:a}=this,{libraryExports:i,libraryMap:l,materials:c,materialExports:h,materialMapLibrary:f}=se(t,a);for(const d of i){const g=r[d],v=e[d];if(v)s[d]=v;else if(g)e[d]=s[d]=await g();else{const y=l[d]||[];for(const j of y)A(j)&&await ie(d,u.url.append(j,{v:P})),k(j)&&await u.loadScript(u.url.append(j,{v:P}));s[d]=e[d]}}for(const d of c)await u.loadScript(u.url.append(d,{v:P}));const p=this.materials||{};for(const d of h){const g=e[f[d]],v=$.BUILT_IN_COMPONENTS[d];if(v)g&&v.forEach(y=>{o[y]=g[y]});else{const y=p[d]?(await p[d]()).default:e[d];y&&g&&(y.components||[]).forEach(j=>{o[j.name]=oe(j,g)})}}}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:lt}))}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);this.options.install&&e.use(this.options.install),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=H({getDsl:async c=>await this.getDsl(c)||null,getDslByUrl:async c=>await this.getDslByUrl(c)||null,options:i});return T({...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 m.defineAsyncComponent(async()=>{const r=await this.getDslByUrl(e);return r?(r.name=t||r.name,this.createDslRenderer(r).renderer):null})}definePluginComponent(e){return m.defineAsyncComponent(async()=>{const t=await Y(e,window);return t?(V(t.css),t.component):null})}}function ut(n){const e=new _e(n);return{provider:e,onReady:r=>e.ready(r)}}function G(n={}){const e=m.inject(z);if(!e)throw new Error("Can not find provider");if(e.nodeEnv==="development"){const{id:t,version:r}=n;t&&r&&(async()=>{const s=await e.getDsl(t);s?.__VERSION__!==r&&O.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=>{O.ElNotification.error({message:n||"未知错误"})}}}),ft=(n="/vtj/local/repository/${type}.json")=>(e,t)=>Q.send({url:n,method:"post",query:{type:e},data:{type:e,data:t}}),pt=(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 B{api;pluginCaches={};uploader;constructor(){this.api=ft(),this.uploader=pt()}async getExtension(){console.log("BaseService.getExtension")}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=>re(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 _=new u.Storage({type:"local",expired:0,prefix:"__VTJ_"});class dt extends B{init(e){const t=new $.ProjectModel(e),r=_.get(`project_${t.id}`),s=Object.assign(t.toDsl(),r||{});return _.save(`project_${t.id}`,s),Promise.resolve(s)}saveProject(e){const t=new $.ProjectModel(e);return _.save(`project_${t.id}`,t.toDsl()),Promise.resolve(!0)}saveMaterials(e,t){return _.save(`materials_${e.id}`,u.mapToObject(t)),Promise.resolve(!0)}saveFile(e){return _.save(`file_${e.id}`,e),Promise.resolve(!0)}getFile(e){const t=_.get(`file_${e}`);return t?Promise.resolve(t):Promise.reject(null)}removeFile(e){return _.remove(`file_${e}`),Promise.resolve(!0)}saveHistory(e){return _.save(`history_${e.id}`,e),Promise.resolve(!0)}removeHistory(e){const t=_.get(`history_${e}`);if(t){const s=(t.items||[]).map(o=>o.id);this.removeHistoryItem(e,s),_.remove(`history_${e}`)}return Promise.resolve(!0)}getHistory(e){const t=_.get(`history_${e}`),r=new $.HistoryModel(t||{id:e});return Promise.resolve(r.toDsl())}getHistoryItem(e,t){const r=_.get(`history_${e}_${t}`);return Promise.resolve(r)}saveHistoryItem(e,t){return _.save(`history_${e}_${t.id}`,t),Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(r=>{_.remove(`history_${e}_${r}`)}),Promise.resolve(!0)}}class Se extends B{projects={};materials={};files={};histories={};historyItems={};init(e){const t=new $.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 $.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 $.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 mt(){return M||(M=new Se,M)}class ht extends B{getFileCaches={};async getExtension(){return await this.api("getExtension",{}).catch(()=>{})}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 we(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?we(o):void 0}})}function vt(){const n=G(),e=ee.useRoute(),t=m.ref(!1),r=n.project;m.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=we(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=B;exports.CONTEXT_HOST=U;exports.Context=he;exports.ContextMode=w;exports.DATA_TYPES=ne;exports.JSCodeToString=be;exports.LIFE_CYCLES_LIST=Ee;exports.LocalService=ht;exports.MemoryService=Se;exports.Provider=_e;exports.StorageService=dt;exports.VTJ_RENDERER_VERSION=P;exports.adoptedStyleSheets=J;exports.createAssetScripts=Ce;exports.createAssetsCss=Pe;exports.createDataSources=ve;exports.createLoader=H;exports.createMemoryService=mt;exports.createMetaApi=fe;exports.createProvider=ut;exports.createRenderer=T;exports.createSchemaApi=ue;exports.createSchemaApis=pe;exports.defaultLoader=ge;exports.fillBasePath=R;exports.getModifiers=K;exports.getPlugin=Y;exports.getRawComponent=oe;exports.isCSSUrl=A;exports.isJSCode=le;exports.isJSExpression=S;exports.isJSFunction=I;exports.isJSON=re;exports.isJSUrl=k;exports.isVuePlugin=ce;exports.loadCss=ie;exports.loadCssUrl=V;exports.loadScriptUrl=ae;exports.mockApi=me;exports.mockApis=de;exports.mockCleanup=W;exports.nodeRender=F;exports.parseDeps=se;exports.parseExpression=b;exports.parseFunction=q;exports.providerKey=z;exports.toString=L;exports.useMask=vt;exports.useProvider=G;
|
|
10
|
+
}`:"(v) => {}"},s=t.__parseFunction(r),o=K(e.modifiers),a=S(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 We(n,e,t,r,s){if(!e)return null;if(u.isString(e))return{default:()=>e};if(S(e))return{default:()=>L(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:h}])=>(i[l]=d=>{const f=h.length?u.pick(d??{},h):a(d);return c.map(p=>F(p,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`),[])}function ze(n){return m.getCurrentScope()?(m.onScopeDispose(n),!0):!1}function X(n){return typeof n=="function"?n():m.unref(n)}const ye=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Ge=n=>n!=null,Qe=()=>{};function Ze(n){return m.getCurrentInstance()}function et(...n){if(n.length!==1)return m.toRef(...n);const e=n[0];return typeof e=="function"?m.readonly(m.customRef(()=>({get:e,set:Qe}))):m.ref(e)}function tt(n,e){Ze()&&m.onBeforeUnmount(n,e)}function nt(n){var e;const t=X(n);return(e=t?.$el)!=null?e:t}const rt=ye?window:void 0,st=ye?window.document:void 0;function ot(){const n=m.ref(!1),e=m.getCurrentInstance();return e&&m.onMounted(()=>{n.value=!0},e),n}function it(n){const e=ot();return m.computed(()=>(e.value,!!n()))}function at(n,e,t={}){const{window:r=rt,...s}=t;let o;const a=it(()=>r&&"MutationObserver"in r),i=()=>{o&&(o.disconnect(),o=void 0)},l=m.computed(()=>{const f=X(n),p=(Array.isArray(f)?f:[f]).map(nt).filter(Ge);return new Set(p)}),c=m.watch(()=>l.value,f=>{i(),a.value&&f.size&&(o=new MutationObserver(e),f.forEach(p=>o.observe(p,s)))},{immediate:!0,flush:"post"}),h=()=>o?.takeRecords(),d=()=>{i(),c()};return ze(d),{isSupported:a,stop:d,takeRecords:h}}function ct(n=null,e={}){var t,r,s;const{document:o=st,restoreOnUnmount:a=d=>d}=e,i=(t=o?.title)!=null?t:"",l=et((r=n??o?.title)!=null?r:null),c=n&&typeof n=="function";function h(d){if(!("titleTemplate"in e))return d;const f=e.titleTemplate||"%s";return typeof f=="function"?f(d):X(f).replace(/%s/g,d)}return m.watch(l,(d,f)=>{d!==f&&o&&(o.title=h(typeof d=="string"?d:""))},{immediate:!0}),e.observe&&!e.titleTemplate&&o&&!c&&at((s=o.head)==null?void 0:s.querySelector("title"),()=>{o&&o.title!==l.value&&(l.value=h(o.title))},{childList:!0}),tt(()=>{if(a){const d=a(i,l.value||"");d!=null&&o&&(o.title=d)}}),l}const Z=m.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&&ct(r.title||"VTJ"),{provider:n,component:s,file:r,query:e.query}},render(){return this.component?m.h(this.component,this.query):m.h("div","页面不存在")}}),lt=m.defineComponent({name:"VtjStartupContainer",render(){return m.h(je.XStartup)}}),z=Symbol("Provider");class _e extends $.Base{constructor(e){super(),this.options=e;const{service:t,mode:r=w.Raw,dependencies:s,materials:o,project:a={},adapter:i={},globals:l={},modules:c={},router:h=null,materialPath:d="./",nodeEnv:f="development"}=e;this.mode=r,this.modules=c,this.service=t,this.router=h,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!==w.Design&&this.load(a)}mode;globals={};modules={};adapter={request:Re,jsonp:u.jsonp};apis={};dependencies={};materials={};library={};service;project=null;components={};nodeEnv="development";router=null;materialPath="./";urlDslCaches={};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{apis:r=[],meta:s=[]}=this.project,o=window;o.CKEDITOR_VERSION=void 0,this.nodeEnv!=="production"&&await this.loadAssets(o),this.apis=fe(r,s,this.adapter),W(),this.project.config?.mock&&pe(r),this.initRouter(),this.triggerReady()}async loadAssets(e){const{dependencies:t=[]}=this.project,{dependencies:r,library:s,components:o,materialPath:a}=this,{libraryExports:i,libraryMap:l,materials:c,materialExports:h,materialMapLibrary:d}=se(t,a);for(const p of i){const g=r[p],v=e[p];if(v)s[p]=v;else if(g)e[p]=s[p]=await g();else{const y=l[p]||[];for(const j of y)A(j)&&await ie(p,u.url.append(j,{v:P})),k(j)&&await u.loadScript(u.url.append(j,{v:P}));s[p]=e[p]}}for(const p of c)await u.loadScript(u.url.append(p,{v:P}));const f=this.materials||{};for(const p of h){const g=e[d[p]],v=$.BUILT_IN_COMPONENTS[p];if(v)g&&v.forEach(y=>{o[y]=g[y]});else{const y=f[p]?(await f[p]()).default:e[p];y&&g&&(y.components||[]).forEach(j=>{o[j.name]=oe(j,g)})}}}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:lt}))}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);this.options.install&&e.use(this.options.install),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=H({getDsl:async c=>await this.getDsl(c)||null,getDslByUrl:async c=>await this.getDslByUrl(c)||null,options:i});return T({...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 m.defineAsyncComponent(async()=>{const r=await this.getDslByUrl(e);return r?(r.name=t||r.name,this.createDslRenderer(r).renderer):null})}definePluginComponent(e){return m.defineAsyncComponent(async()=>{const t=await Y(e,window);return t?(V(t.css),t.component):null})}}function ut(n){const e=new _e(n);return{provider:e,onReady:r=>e.ready(r)}}function G(n={}){const e=m.inject(z);if(!e)throw new Error("Can not find provider");if(e.nodeEnv==="development"){const{id:t,version:r}=n;t&&r&&(async()=>{const s=await e.getDsl(t);s?.__VERSION__!==r&&O.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=>{O.ElNotification.error({message:n||"未知错误"})}}}),dt=(n="/vtj/local/repository/${type}.json")=>(e,t)=>Q.send({url:n,method:"post",query:{type:e},data:{type:e,data:t}}),ft=(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 B{api;pluginCaches={};uploader;constructor(){this.api=dt(),this.uploader=ft()}async getExtension(){console.log("BaseService.getExtension")}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=>re(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 _=new u.Storage({type:"local",expired:0,prefix:"__VTJ_"});class pt extends B{init(e){const t=new $.ProjectModel(e),r=_.get(`project_${t.id}`),s=Object.assign(t.toDsl(),r||{});return _.save(`project_${t.id}`,s),Promise.resolve(s)}saveProject(e){const t=new $.ProjectModel(e);return _.save(`project_${t.id}`,t.toDsl()),Promise.resolve(!0)}saveMaterials(e,t){return _.save(`materials_${e.id}`,u.mapToObject(t)),Promise.resolve(!0)}saveFile(e){return _.save(`file_${e.id}`,e),Promise.resolve(!0)}getFile(e){const t=_.get(`file_${e}`);return t?Promise.resolve(t):Promise.reject(null)}removeFile(e){return _.remove(`file_${e}`),Promise.resolve(!0)}saveHistory(e){return _.save(`history_${e.id}`,e),Promise.resolve(!0)}removeHistory(e){const t=_.get(`history_${e}`);if(t){const s=(t.items||[]).map(o=>o.id);this.removeHistoryItem(e,s),_.remove(`history_${e}`)}return Promise.resolve(!0)}getHistory(e){const t=_.get(`history_${e}`),r=new $.HistoryModel(t||{id:e});return Promise.resolve(r.toDsl())}getHistoryItem(e,t){const r=_.get(`history_${e}_${t}`);return Promise.resolve(r)}saveHistoryItem(e,t){return _.save(`history_${e}_${t.id}`,t),Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(r=>{_.remove(`history_${e}_${r}`)}),Promise.resolve(!0)}}class Se extends B{projects={};materials={};files={};histories={};historyItems={};init(e){const t=new $.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 $.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 $.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 mt(){return M||(M=new Se,M)}class ht extends B{getFileCaches={};async getExtension(){return await this.api("getExtension",{}).catch(()=>{})}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 we(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?we(o):void 0}})}function vt(){const n=G(),e=ee.useRoute(),t=m.ref(!1),r=n.project;m.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=we(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=B;exports.CONTEXT_HOST=U;exports.Context=he;exports.ContextMode=w;exports.DATA_TYPES=ne;exports.JSCodeToString=be;exports.LIFE_CYCLES_LIST=Ee;exports.LocalService=ht;exports.MemoryService=Se;exports.Provider=_e;exports.StorageService=pt;exports.VTJ_RENDERER_VERSION=P;exports.adoptedStyleSheets=J;exports.createAssetScripts=Ce;exports.createAssetsCss=Pe;exports.createDataSources=ve;exports.createLoader=H;exports.createMemoryService=mt;exports.createMetaApi=de;exports.createProvider=ut;exports.createRenderer=T;exports.createSchemaApi=ue;exports.createSchemaApis=fe;exports.defaultLoader=ge;exports.fillBasePath=R;exports.getModifiers=K;exports.getPlugin=Y;exports.getRawComponent=oe;exports.isCSSUrl=A;exports.isJSCode=le;exports.isJSExpression=S;exports.isJSFunction=I;exports.isJSON=re;exports.isJSUrl=k;exports.isVuePlugin=ce;exports.loadCss=ie;exports.loadCssUrl=V;exports.loadScriptUrl=ae;exports.mockApi=me;exports.mockApis=pe;exports.mockCleanup=W;exports.nodeRender=F;exports.parseDeps=se;exports.parseExpression=b;exports.parseFunction=q;exports.providerKey=z;exports.toString=L;exports.useMask=vt;exports.useProvider=G;
|
package/dist/index.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { Base as ve, BUILT_IN_COMPONENTS as ye, ProjectModel as I, HistoryModel as ee } from "@vtj/core";
|
|
2
|
-
import { isUrl as ge, url as b, dedupArray as _e, isString as S, isFunction as K, logger as x, createRequest as we, merge as Se, pathToRegexp as $e, pathToRegexpMatch as je, formDataToJson as Ee, camelCase as j, upperFirst as
|
|
2
|
+
import { isUrl as ge, url as b, dedupArray as _e, isString as S, isFunction as K, logger as x, createRequest as we, merge as Se, pathToRegexp as $e, pathToRegexpMatch as je, formDataToJson as Ee, delay as be, camelCase as j, upperFirst as Pe, pick as Ce, jsonp as Re, loadScript as Q, Request as Fe, Storage as Ie, mapToObject as U } from "@vtj/utils";
|
|
3
3
|
import * as O from "vue";
|
|
4
|
-
import { toRef as
|
|
4
|
+
import { toRef as xe, readonly as He, customRef as Me, ref as N, onBeforeUnmount as Oe, getCurrentScope as De, onScopeDispose as ke, unref as Te, getCurrentInstance as te, watch as ne, computed as re, onMounted as Ae, defineComponent as se, h as T, inject as Be, defineAsyncComponent as X, watchEffect as Ue } from "vue";
|
|
5
5
|
import { useRoute as oe } from "vue-router";
|
|
6
|
-
import { ElNotification as q, ElLoading as
|
|
6
|
+
import { ElNotification as q, ElLoading as Ne } from "element-plus";
|
|
7
7
|
import H from "mockjs";
|
|
8
|
-
import { XStartup as
|
|
8
|
+
import { XStartup as qe } from "@vtj/ui";
|
|
9
9
|
/**!
|
|
10
10
|
* Copyright (c) 2024, VTJ.PRO All rights reserved.
|
|
11
11
|
* @name @vtj/renderer
|
|
12
12
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
13
|
-
* @version 0.8.
|
|
13
|
+
* @version 0.8.63
|
|
14
14
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
15
15
|
*/
|
|
16
|
-
const P = "0.8.
|
|
16
|
+
const P = "0.8.63";
|
|
17
17
|
var _ = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(_ || {});
|
|
18
18
|
const Y = [
|
|
19
19
|
"$el",
|
|
@@ -27,7 +27,7 @@ const Y = [
|
|
|
27
27
|
"$props",
|
|
28
28
|
"$options",
|
|
29
29
|
"$forceUpdate"
|
|
30
|
-
],
|
|
30
|
+
], Zt = [
|
|
31
31
|
"beforeCreate",
|
|
32
32
|
"created",
|
|
33
33
|
"beforeMount",
|
|
@@ -41,7 +41,7 @@ const Y = [
|
|
|
41
41
|
"renderTriggered",
|
|
42
42
|
"activated",
|
|
43
43
|
"deactivated"
|
|
44
|
-
],
|
|
44
|
+
], Je = ["vIf", "vShow", "vModel", "vFor", "vBind"], Le = {
|
|
45
45
|
String,
|
|
46
46
|
Number,
|
|
47
47
|
Boolean,
|
|
@@ -59,20 +59,20 @@ function J(n) {
|
|
|
59
59
|
function L(n) {
|
|
60
60
|
return /\.js$/.test(n);
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function Ve(n) {
|
|
63
63
|
return /\.json$/.test(n);
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function en(n) {
|
|
66
66
|
return n.map(
|
|
67
67
|
(e) => `<script src="${b.append(e, { v: P })}"><\/script>`
|
|
68
68
|
).join("");
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function tn(n = []) {
|
|
71
71
|
return n.map(
|
|
72
72
|
(e) => `<link rel="stylesheet" href="${b.append(e, { v: P })}" />`
|
|
73
73
|
).join("");
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function We(n, e) {
|
|
76
76
|
const t = n.filter((u) => !!u.enabled), r = [], s = [], o = [], a = [], i = {}, l = {}, c = [], d = {};
|
|
77
77
|
return t.forEach(
|
|
78
78
|
({ urls: u, assetsUrl: f, library: p, assetsLibrary: h, localeLibrary: m }) => {
|
|
@@ -91,7 +91,7 @@ function Ve(n, e) {
|
|
|
91
91
|
libraryLocaleMap: l
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function Ge(n, e) {
|
|
95
95
|
const { name: t, parent: r, alias: s } = n;
|
|
96
96
|
return r ? e[r]?.[s || t] : e[s || t];
|
|
97
97
|
}
|
|
@@ -113,7 +113,7 @@ function ae(n, e, t) {
|
|
|
113
113
|
o ? o.innerHTML = t : (o = s.createElement("style"), o.id = e, o.innerHTML = t, s.head.appendChild(o));
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
async function
|
|
116
|
+
async function Ke(n, e) {
|
|
117
117
|
const t = await window.fetch(e).then((r) => r.text()).catch(() => "");
|
|
118
118
|
t && ae(window, n, t);
|
|
119
119
|
}
|
|
@@ -125,7 +125,7 @@ function ce(n, e = window) {
|
|
|
125
125
|
a.rel = "stylesheet", a.id = s, a.href = s, r.appendChild(a);
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
async function
|
|
128
|
+
async function Qe(n, e, t = window) {
|
|
129
129
|
const r = t.document, s = t.document.head;
|
|
130
130
|
let o = t[e];
|
|
131
131
|
return o ? o.default || o : new Promise((a, i) => {
|
|
@@ -139,7 +139,7 @@ async function Ke(n, e, t = window) {
|
|
|
139
139
|
}
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function Xe(n) {
|
|
143
143
|
return K(n) || K(n?.install);
|
|
144
144
|
}
|
|
145
145
|
function C(n, e, t = !1, r = !1) {
|
|
@@ -173,14 +173,14 @@ function g(n) {
|
|
|
173
173
|
function D(n) {
|
|
174
174
|
return typeof n == "object" && n && n.type === "JSFunction";
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function Ye(n) {
|
|
177
177
|
return g(n) || D(n);
|
|
178
178
|
}
|
|
179
|
-
function
|
|
180
|
-
return
|
|
179
|
+
function nn(n) {
|
|
180
|
+
return Ye(n) ? n.value : JSON.stringify(n);
|
|
181
181
|
}
|
|
182
182
|
let E = null;
|
|
183
|
-
const
|
|
183
|
+
const ze = we({
|
|
184
184
|
settings: {
|
|
185
185
|
type: "form",
|
|
186
186
|
validSuccess: !0,
|
|
@@ -194,7 +194,7 @@ const Ye = we({
|
|
|
194
194
|
});
|
|
195
195
|
},
|
|
196
196
|
showLoading: () => {
|
|
197
|
-
E && E.close(), E =
|
|
197
|
+
E && E.close(), E = Ne.service({
|
|
198
198
|
lock: !0,
|
|
199
199
|
text: "Loading",
|
|
200
200
|
background: "rgba(0, 0, 0, 0.05)"
|
|
@@ -205,7 +205,7 @@ const Ye = we({
|
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
});
|
|
208
|
-
function
|
|
208
|
+
function Ze(n, e) {
|
|
209
209
|
const { jsonp: t, request: r } = e;
|
|
210
210
|
if (n.method === "jsonp")
|
|
211
211
|
return (s = {}) => t(n.url, {
|
|
@@ -224,10 +224,9 @@ function ze(n, e) {
|
|
|
224
224
|
return (a, i) => r.send(Se(o, i || {}, { data: a }));
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function et(n, e) {
|
|
228
228
|
const { metaQuery: t } = e;
|
|
229
|
-
if (!t)
|
|
230
|
-
return;
|
|
229
|
+
if (!t) return;
|
|
231
230
|
const { code: r, queryCode: s } = n;
|
|
232
231
|
return (o, a) => {
|
|
233
232
|
if (!t) {
|
|
@@ -237,22 +236,21 @@ function Ze(n, e) {
|
|
|
237
236
|
return t(r, s, o, a);
|
|
238
237
|
};
|
|
239
238
|
}
|
|
240
|
-
function
|
|
239
|
+
function tt(n = [], e = [], t) {
|
|
241
240
|
const r = {};
|
|
242
241
|
for (const s of n)
|
|
243
|
-
r[s.id] = ze(s, t);
|
|
244
|
-
for (const s of e)
|
|
245
242
|
r[s.id] = Ze(s, t);
|
|
243
|
+
for (const s of e)
|
|
244
|
+
r[s.id] = et(s, t);
|
|
246
245
|
return r;
|
|
247
246
|
}
|
|
248
|
-
function
|
|
247
|
+
function nt(n = []) {
|
|
249
248
|
H.setup({
|
|
250
249
|
timeout: "50-500"
|
|
251
|
-
}), le(), n.forEach((e) =>
|
|
250
|
+
}), le(), n.forEach((e) => rt(e));
|
|
252
251
|
}
|
|
253
|
-
function
|
|
254
|
-
if (!n.mock)
|
|
255
|
-
return;
|
|
252
|
+
function rt(n) {
|
|
253
|
+
if (!n.mock) return;
|
|
256
254
|
const { url: e, mockTemplate: t } = n;
|
|
257
255
|
if (e && t) {
|
|
258
256
|
const r = $e(`${e}(.*)`), s = je(e, { decode: decodeURIComponent }), o = C(t, {}, !0);
|
|
@@ -265,7 +263,7 @@ function nt(n) {
|
|
|
265
263
|
function le() {
|
|
266
264
|
H._mocked = {};
|
|
267
265
|
}
|
|
268
|
-
class
|
|
266
|
+
class st {
|
|
269
267
|
__id = null;
|
|
270
268
|
__mode;
|
|
271
269
|
__instance = null;
|
|
@@ -296,8 +294,7 @@ class rt {
|
|
|
296
294
|
}
|
|
297
295
|
setup(e, t = O) {
|
|
298
296
|
const r = t.getCurrentInstance();
|
|
299
|
-
if (!r)
|
|
300
|
-
return;
|
|
297
|
+
if (!r) return;
|
|
301
298
|
this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance = r.proxy;
|
|
302
299
|
const s = r.appContext.config.globalProperties;
|
|
303
300
|
Object.assign(this, s), Object.assign(this, e || {}), this.__proxy(), t.onMounted(() => {
|
|
@@ -336,8 +333,9 @@ class rt {
|
|
|
336
333
|
}
|
|
337
334
|
__ref(e = null, t) {
|
|
338
335
|
if (this.__mode !== _.VNode)
|
|
339
|
-
return e && e !== this.__id && (this.__contextRefs[e] = this), (r) => {
|
|
340
|
-
|
|
336
|
+
return e && e !== this.__id && (this.__contextRefs[e] = this), async (r) => {
|
|
337
|
+
await be(0);
|
|
338
|
+
let s = r?.$vtjEl || r?.$el || r?._?.vnode?.el || r;
|
|
341
339
|
if (!s) {
|
|
342
340
|
typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
|
|
343
341
|
return;
|
|
@@ -375,22 +373,22 @@ function A(n) {
|
|
|
375
373
|
$components: r,
|
|
376
374
|
$libs: s,
|
|
377
375
|
$apis: o
|
|
378
|
-
}, c = new
|
|
376
|
+
}, c = new st({
|
|
379
377
|
mode: t,
|
|
380
378
|
dsl: i.value,
|
|
381
379
|
attrs: l
|
|
382
380
|
}), d = e.defineComponent({
|
|
383
381
|
name: i.value.name,
|
|
384
382
|
props: {
|
|
385
|
-
...
|
|
383
|
+
...it(i.value.props ?? [], c)
|
|
386
384
|
},
|
|
387
385
|
setup(u) {
|
|
388
386
|
c.$props = u, c.props = u, i.value.id && ae(
|
|
389
387
|
n.window || window,
|
|
390
388
|
i.value.id,
|
|
391
389
|
i.value.css || ""
|
|
392
|
-
), c.state =
|
|
393
|
-
const f =
|
|
390
|
+
), c.state = at(e, i.value.state ?? {}, c);
|
|
391
|
+
const f = ct(e, i.value.computed ?? {}, c), p = lt(i.value.methods ?? {}, c), h = ut(e, i.value.inject, c), m = ft(
|
|
394
392
|
i.value.dataSources || {},
|
|
395
393
|
c
|
|
396
394
|
), v = {
|
|
@@ -399,30 +397,29 @@ function A(n) {
|
|
|
399
397
|
...p,
|
|
400
398
|
...m
|
|
401
399
|
};
|
|
402
|
-
return c.setup(v, e),
|
|
400
|
+
return c.setup(v, e), pt(e, i.value.watch ?? [], c), {
|
|
403
401
|
vtj: c
|
|
404
402
|
};
|
|
405
403
|
},
|
|
406
|
-
emits:
|
|
404
|
+
emits: ot(i.value.emits),
|
|
407
405
|
expose: ["vtj"],
|
|
408
406
|
render() {
|
|
409
|
-
if (!i.value.nodes)
|
|
410
|
-
return null;
|
|
407
|
+
if (!i.value.nodes) return null;
|
|
411
408
|
const u = i.value.nodes || [];
|
|
412
409
|
return u.length === 1 ? M(u[0], c, e, a) : u.map((f) => M(f, c, e, a));
|
|
413
410
|
},
|
|
414
|
-
...
|
|
411
|
+
...dt(i.value.lifeCycles ?? {}, c)
|
|
415
412
|
});
|
|
416
413
|
return {
|
|
417
414
|
renderer: e.markRaw(d),
|
|
418
415
|
context: c
|
|
419
416
|
};
|
|
420
417
|
}
|
|
421
|
-
function
|
|
418
|
+
function ot(n = []) {
|
|
422
419
|
return n.map((e) => S(e) ? e : e.name);
|
|
423
420
|
}
|
|
424
|
-
function
|
|
425
|
-
const t = (r) => r ? (Array.isArray(r) ? r : [r]).map((o) =>
|
|
421
|
+
function it(n = [], e) {
|
|
422
|
+
const t = (r) => r ? (Array.isArray(r) ? r : [r]).map((o) => Le[o]) : void 0;
|
|
426
423
|
return n.map((r) => S(r) ? {
|
|
427
424
|
name: r
|
|
428
425
|
} : {
|
|
@@ -439,7 +436,7 @@ function ot(n = [], e) {
|
|
|
439
436
|
{}
|
|
440
437
|
);
|
|
441
438
|
}
|
|
442
|
-
function
|
|
439
|
+
function at(n, e, t) {
|
|
443
440
|
return n.reactive(
|
|
444
441
|
Object.keys(e || {}).reduce(
|
|
445
442
|
(r, s) => {
|
|
@@ -450,19 +447,19 @@ function it(n, e, t) {
|
|
|
450
447
|
)
|
|
451
448
|
);
|
|
452
449
|
}
|
|
453
|
-
function
|
|
450
|
+
function ct(n, e, t) {
|
|
454
451
|
return Object.entries(e ?? {}).reduce(
|
|
455
452
|
(r, [s, o]) => (r[s] = n.computed(t.__parseFunction(o)), r),
|
|
456
453
|
{}
|
|
457
454
|
);
|
|
458
455
|
}
|
|
459
|
-
function
|
|
456
|
+
function lt(n, e) {
|
|
460
457
|
return Object.entries(n ?? {}).reduce(
|
|
461
458
|
(t, [r, s]) => (t[r] = e.__parseFunction(s), t),
|
|
462
459
|
{}
|
|
463
460
|
);
|
|
464
461
|
}
|
|
465
|
-
function
|
|
462
|
+
function ut(n, e = [], t) {
|
|
466
463
|
return e.reduce(
|
|
467
464
|
(r, s) => {
|
|
468
465
|
const { name: o, from: a } = s || {};
|
|
@@ -473,7 +470,7 @@ function lt(n, e = [], t) {
|
|
|
473
470
|
{}
|
|
474
471
|
);
|
|
475
472
|
}
|
|
476
|
-
function
|
|
473
|
+
function ft(n, e) {
|
|
477
474
|
return Object.keys(n).reduce(
|
|
478
475
|
(t, r) => {
|
|
479
476
|
const s = n[r], o = e.$apis[s.ref], a = D(s.transform) ? s.transform.value ? e.__parseFunction(s.transform) : void 0 : s.transform;
|
|
@@ -485,7 +482,7 @@ function ut(n, e) {
|
|
|
485
482
|
{}
|
|
486
483
|
);
|
|
487
484
|
}
|
|
488
|
-
function
|
|
485
|
+
function pt(n, e = [], t) {
|
|
489
486
|
e.forEach((r) => {
|
|
490
487
|
n.watch(
|
|
491
488
|
t.__parseExpression(r.source),
|
|
@@ -497,19 +494,18 @@ function ft(n, e = [], t) {
|
|
|
497
494
|
);
|
|
498
495
|
});
|
|
499
496
|
}
|
|
500
|
-
function
|
|
497
|
+
function dt(n, e) {
|
|
501
498
|
return Object.entries(n ?? {}).reduce(
|
|
502
499
|
(t, [r, s]) => (t[r] = e.__parseFunction(s), t),
|
|
503
500
|
{}
|
|
504
501
|
);
|
|
505
502
|
}
|
|
506
503
|
let k = [];
|
|
507
|
-
const
|
|
504
|
+
const mt = (n) => n;
|
|
508
505
|
async function ue(n, e = window) {
|
|
509
506
|
const { urls: t = [], library: r } = n, s = t.filter((i) => L(i));
|
|
510
|
-
if (s.length === 0 || !r)
|
|
511
|
-
|
|
512
|
-
const o = t.filter((i) => J(i)), a = await Ke(s, r, e).catch(
|
|
507
|
+
if (s.length === 0 || !r) return null;
|
|
508
|
+
const o = t.filter((i) => J(i)), a = await Qe(s, r, e).catch(
|
|
513
509
|
(i) => (console.warn("loadScriptUrl error", s, r, i), null)
|
|
514
510
|
);
|
|
515
511
|
return a ? {
|
|
@@ -544,30 +540,28 @@ function B(n) {
|
|
|
544
540
|
return i ? (ce(i.css, r.window), i.component) : (console.warn("getPlugin result is null", o), null);
|
|
545
541
|
})) : s;
|
|
546
542
|
}
|
|
547
|
-
function M(n, e, t = O, r =
|
|
548
|
-
if (!n || !n.name || n.invisible)
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
if (a && !ht(a, e))
|
|
543
|
+
function M(n, e, t = O, r = mt) {
|
|
544
|
+
if (!n || !n.name || n.invisible) return null;
|
|
545
|
+
const { id: s = null, directives: o = [] } = n, { vIf: a, vFor: i, vShow: l, vModels: c, vBind: d } = ht(o);
|
|
546
|
+
if (a && !vt(a, e))
|
|
552
547
|
return null;
|
|
553
548
|
const u = (f) => {
|
|
554
549
|
const p = f.$components, h = (() => {
|
|
555
550
|
if (n.name === "component")
|
|
556
|
-
return
|
|
557
|
-
if (n.name === "slot")
|
|
558
|
-
return n.name;
|
|
551
|
+
return yt(f, n.props?.is);
|
|
552
|
+
if (n.name === "slot") return n.name;
|
|
559
553
|
const $ = r(n.name, n.from, t);
|
|
560
554
|
return S($) ? p[$] ?? $ : $;
|
|
561
|
-
})(), m =
|
|
555
|
+
})(), m = gt(s, n.props ?? {}, f), v = _t(t, n.events ?? {}, f);
|
|
562
556
|
if (n.name === "slot")
|
|
563
|
-
return
|
|
557
|
+
return wt(t, n, m, f, r);
|
|
564
558
|
d && Object.assign(m, f.__parseExpression(d.value)), l && (m.style = Object.assign(
|
|
565
559
|
m.style ?? {},
|
|
566
|
-
|
|
560
|
+
$t(l, f)
|
|
567
561
|
)), c.forEach(($) => {
|
|
568
|
-
Object.assign(m,
|
|
562
|
+
Object.assign(m, jt(t, $, f));
|
|
569
563
|
});
|
|
570
|
-
const w =
|
|
564
|
+
const w = Et(
|
|
571
565
|
t,
|
|
572
566
|
n.children ?? [],
|
|
573
567
|
f,
|
|
@@ -576,11 +570,11 @@ function M(n, e, t = O, r = dt) {
|
|
|
576
570
|
);
|
|
577
571
|
return t.createVNode(h, { ...m, ...v }, w);
|
|
578
572
|
};
|
|
579
|
-
return i ?
|
|
573
|
+
return i ? Ct(i, u, e) : u(e);
|
|
580
574
|
}
|
|
581
|
-
function
|
|
575
|
+
function ht(n = []) {
|
|
582
576
|
const e = n.find((i) => j(i.name) === "vIf"), t = n.find((i) => j(i.name) === "vFor"), r = n.find((i) => j(i.name) === "vShow"), s = n.find((i) => j(i.name) === "vBind"), o = n.filter((i) => j(i.name) === "vModel"), a = n.filter(
|
|
583
|
-
(i) => !
|
|
577
|
+
(i) => !Je.includes(j(i.name))
|
|
584
578
|
);
|
|
585
579
|
return {
|
|
586
580
|
vIf: e,
|
|
@@ -591,13 +585,13 @@ function mt(n = []) {
|
|
|
591
585
|
others: a
|
|
592
586
|
};
|
|
593
587
|
}
|
|
594
|
-
function
|
|
588
|
+
function vt(n, e) {
|
|
595
589
|
return !!e.__parseExpression(n.value);
|
|
596
590
|
}
|
|
597
|
-
function
|
|
591
|
+
function yt(n, e) {
|
|
598
592
|
return e ? g(e) ? n.__parseExpression(e) : e : "div";
|
|
599
593
|
}
|
|
600
|
-
function
|
|
594
|
+
function gt(n, e, t) {
|
|
601
595
|
const r = Object.keys(e || {}).reduce(
|
|
602
596
|
(s, o) => {
|
|
603
597
|
let a = e[o];
|
|
@@ -607,7 +601,7 @@ function yt(n, e, t) {
|
|
|
607
601
|
);
|
|
608
602
|
return r.ref = t.__ref(n, r.ref), r;
|
|
609
603
|
}
|
|
610
|
-
function
|
|
604
|
+
function _t(n, e, t) {
|
|
611
605
|
const r = ["passive", "capture", "once"], s = {
|
|
612
606
|
capture: "Capture",
|
|
613
607
|
once: "Once",
|
|
@@ -615,7 +609,7 @@ function gt(n, e, t) {
|
|
|
615
609
|
};
|
|
616
610
|
return Object.keys(e || {}).reduce(
|
|
617
611
|
(o, a) => {
|
|
618
|
-
const i = e[a], l = fe(i.modifiers), c = l.find((f) => r.includes(f)), d = "on" +
|
|
612
|
+
const i = e[a], l = fe(i.modifiers), c = l.find((f) => r.includes(f)), d = "on" + Pe(a) + (c && s[c] || ""), u = t.__parseFunction(i.handler);
|
|
619
613
|
return u && (o[d] = n.withModifiers(u, l)), o;
|
|
620
614
|
},
|
|
621
615
|
{}
|
|
@@ -625,27 +619,27 @@ function fe(n = {}, e = !1) {
|
|
|
625
619
|
const t = Object.keys(n);
|
|
626
620
|
return e ? t.map((r) => "." + r) : t;
|
|
627
621
|
}
|
|
628
|
-
function
|
|
629
|
-
const { children: o } = e, a =
|
|
622
|
+
function wt(n, e, t, r, s) {
|
|
623
|
+
const { children: o } = e, a = St(e, r), i = r.$slots?.[a.name];
|
|
630
624
|
return i ? i(t) : o ? S(o) ? n.createTextVNode(o) : g(o) ? n.createTextVNode(
|
|
631
625
|
ie(r.__parseExpression(o))
|
|
632
626
|
) : Array.isArray(o) ? o.map(
|
|
633
627
|
(l) => M(l, r, n, s)
|
|
634
628
|
) : null : null;
|
|
635
629
|
}
|
|
636
|
-
function
|
|
630
|
+
function St(n, e) {
|
|
637
631
|
const { props: t } = n, r = t?.name || "default";
|
|
638
632
|
return {
|
|
639
633
|
name: g(r) ? e.__parseExpression(r) : r,
|
|
640
634
|
params: []
|
|
641
635
|
};
|
|
642
636
|
}
|
|
643
|
-
function
|
|
637
|
+
function $t(n, e) {
|
|
644
638
|
return e.__parseExpression(n.value) ? {} : {
|
|
645
639
|
display: "none"
|
|
646
640
|
};
|
|
647
641
|
}
|
|
648
|
-
function
|
|
642
|
+
function jt(n, e, t) {
|
|
649
643
|
const r = {
|
|
650
644
|
type: "JSFunction",
|
|
651
645
|
value: e.value?.value ? `(v) => {
|
|
@@ -657,9 +651,8 @@ function $t(n, e, t) {
|
|
|
657
651
|
[`onUpdate:${a}`]: o.length && s ? n.withModifiers(s, o) : s
|
|
658
652
|
};
|
|
659
653
|
}
|
|
660
|
-
function
|
|
661
|
-
if (!e)
|
|
662
|
-
return null;
|
|
654
|
+
function Et(n, e, t, r, s) {
|
|
655
|
+
if (!e) return null;
|
|
663
656
|
if (S(e))
|
|
664
657
|
return { default: () => e };
|
|
665
658
|
if (g(e))
|
|
@@ -667,11 +660,11 @@ function jt(n, e, t, r, s) {
|
|
|
667
660
|
default: () => ie(t.__parseExpression(e))
|
|
668
661
|
};
|
|
669
662
|
if (Array.isArray(e) && e.length > 0) {
|
|
670
|
-
const o =
|
|
663
|
+
const o = bt(e), a = (i) => !i || !s ? {} : s?.id && Object.keys(i).length ? {
|
|
671
664
|
[`scope_${s.id}`]: i
|
|
672
665
|
} : {};
|
|
673
666
|
return Object.entries(o).reduce((i, [l, { nodes: c, params: d }]) => (i[l] = (u) => {
|
|
674
|
-
const f = d.length ?
|
|
667
|
+
const f = d.length ? Ce(u ?? {}, d) : a(u);
|
|
675
668
|
return c.map(
|
|
676
669
|
(p) => M(p, t.__clone(f), n, r)
|
|
677
670
|
);
|
|
@@ -679,7 +672,7 @@ function jt(n, e, t, r, s) {
|
|
|
679
672
|
}
|
|
680
673
|
return null;
|
|
681
674
|
}
|
|
682
|
-
function
|
|
675
|
+
function bt(n) {
|
|
683
676
|
const e = {
|
|
684
677
|
default: {
|
|
685
678
|
params: [],
|
|
@@ -687,7 +680,7 @@ function Et(n) {
|
|
|
687
680
|
}
|
|
688
681
|
};
|
|
689
682
|
for (const t of n) {
|
|
690
|
-
const r =
|
|
683
|
+
const r = Pt(t.slot), s = r.name;
|
|
691
684
|
e[s] ? (e[s].nodes.push(t), e[s].params = e[s].params.concat(r.params)) : e[s] = {
|
|
692
685
|
nodes: [t],
|
|
693
686
|
params: r.params
|
|
@@ -695,59 +688,59 @@ function Et(n) {
|
|
|
695
688
|
}
|
|
696
689
|
return e;
|
|
697
690
|
}
|
|
698
|
-
function
|
|
691
|
+
function Pt(n = "default") {
|
|
699
692
|
return S(n) ? { name: n, params: [] } : { params: [], ...n };
|
|
700
693
|
}
|
|
701
|
-
function
|
|
694
|
+
function Ct(n, e, t) {
|
|
702
695
|
const { value: r, iterator: s } = n, { item: o = "item", index: a = "index" } = s || {};
|
|
703
696
|
let i = t.__parseExpression(r) || [];
|
|
704
697
|
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`), []);
|
|
705
698
|
}
|
|
706
|
-
function
|
|
707
|
-
return
|
|
699
|
+
function Rt(n) {
|
|
700
|
+
return De() ? (ke(n), !0) : !1;
|
|
708
701
|
}
|
|
709
702
|
function V(n) {
|
|
710
|
-
return typeof n == "function" ? n() :
|
|
703
|
+
return typeof n == "function" ? n() : Te(n);
|
|
711
704
|
}
|
|
712
705
|
const pe = typeof window < "u" && typeof document < "u";
|
|
713
706
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
714
|
-
const
|
|
707
|
+
const Ft = (n) => n != null, It = () => {
|
|
715
708
|
};
|
|
716
|
-
function
|
|
709
|
+
function xt(n) {
|
|
717
710
|
return te();
|
|
718
711
|
}
|
|
719
|
-
function
|
|
712
|
+
function Ht(...n) {
|
|
720
713
|
if (n.length !== 1)
|
|
721
|
-
return
|
|
714
|
+
return xe(...n);
|
|
722
715
|
const e = n[0];
|
|
723
|
-
return typeof e == "function" ?
|
|
716
|
+
return typeof e == "function" ? He(Me(() => ({ get: e, set: It }))) : N(e);
|
|
724
717
|
}
|
|
725
|
-
function
|
|
726
|
-
|
|
718
|
+
function Mt(n, e) {
|
|
719
|
+
xt() && Oe(n, e);
|
|
727
720
|
}
|
|
728
|
-
function
|
|
721
|
+
function Ot(n) {
|
|
729
722
|
var e;
|
|
730
723
|
const t = V(n);
|
|
731
724
|
return (e = t?.$el) != null ? e : t;
|
|
732
725
|
}
|
|
733
|
-
const
|
|
734
|
-
function
|
|
726
|
+
const Dt = pe ? window : void 0, kt = pe ? window.document : void 0;
|
|
727
|
+
function Tt() {
|
|
735
728
|
const n = N(!1), e = te();
|
|
736
|
-
return e &&
|
|
729
|
+
return e && Ae(() => {
|
|
737
730
|
n.value = !0;
|
|
738
731
|
}, e), n;
|
|
739
732
|
}
|
|
740
|
-
function
|
|
741
|
-
const e =
|
|
733
|
+
function At(n) {
|
|
734
|
+
const e = Tt();
|
|
742
735
|
return re(() => (e.value, !!n()));
|
|
743
736
|
}
|
|
744
|
-
function
|
|
745
|
-
const { window: r =
|
|
737
|
+
function Bt(n, e, t = {}) {
|
|
738
|
+
const { window: r = Dt, ...s } = t;
|
|
746
739
|
let o;
|
|
747
|
-
const a =
|
|
740
|
+
const a = At(() => r && "MutationObserver" in r), i = () => {
|
|
748
741
|
o && (o.disconnect(), o = void 0);
|
|
749
742
|
}, l = re(() => {
|
|
750
|
-
const f = V(n), p = (Array.isArray(f) ? f : [f]).map(
|
|
743
|
+
const f = V(n), p = (Array.isArray(f) ? f : [f]).map(Ot).filter(Ft);
|
|
751
744
|
return new Set(p);
|
|
752
745
|
}), c = ne(
|
|
753
746
|
() => l.value,
|
|
@@ -758,18 +751,18 @@ function At(n, e, t = {}) {
|
|
|
758
751
|
), d = () => o?.takeRecords(), u = () => {
|
|
759
752
|
i(), c();
|
|
760
753
|
};
|
|
761
|
-
return
|
|
754
|
+
return Rt(u), {
|
|
762
755
|
isSupported: a,
|
|
763
756
|
stop: u,
|
|
764
757
|
takeRecords: d
|
|
765
758
|
};
|
|
766
759
|
}
|
|
767
|
-
function
|
|
760
|
+
function Ut(n = null, e = {}) {
|
|
768
761
|
var t, r, s;
|
|
769
762
|
const {
|
|
770
|
-
document: o =
|
|
763
|
+
document: o = kt,
|
|
771
764
|
restoreOnUnmount: a = (u) => u
|
|
772
|
-
} = e, i = (t = o?.title) != null ? t : "", l =
|
|
765
|
+
} = e, i = (t = o?.title) != null ? t : "", l = Ht((r = n ?? o?.title) != null ? r : null), c = n && typeof n == "function";
|
|
773
766
|
function d(u) {
|
|
774
767
|
if (!("titleTemplate" in e))
|
|
775
768
|
return u;
|
|
@@ -782,13 +775,13 @@ function Bt(n = null, e = {}) {
|
|
|
782
775
|
u !== f && o && (o.title = d(typeof u == "string" ? u : ""));
|
|
783
776
|
},
|
|
784
777
|
{ immediate: !0 }
|
|
785
|
-
), e.observe && !e.titleTemplate && o && !c &&
|
|
778
|
+
), e.observe && !e.titleTemplate && o && !c && Bt(
|
|
786
779
|
(s = o.head) == null ? void 0 : s.querySelector("title"),
|
|
787
780
|
() => {
|
|
788
781
|
o && o.title !== l.value && (l.value = d(o.title));
|
|
789
782
|
},
|
|
790
783
|
{ childList: !0 }
|
|
791
|
-
),
|
|
784
|
+
), Mt(() => {
|
|
792
785
|
if (a) {
|
|
793
786
|
const u = a(i, l.value || "");
|
|
794
787
|
u != null && o && (o.title = u);
|
|
@@ -799,7 +792,7 @@ const Z = se({
|
|
|
799
792
|
name: "VtjPageContainer",
|
|
800
793
|
async setup() {
|
|
801
794
|
const n = me(), e = oe(), t = e.params.id, r = t ? n.getPage(t) : n.getHomepage(), s = r ? await n.getRenderComponent(r.id) : null;
|
|
802
|
-
return r &&
|
|
795
|
+
return r && Ut(r.title || "VTJ"), {
|
|
803
796
|
provider: n,
|
|
804
797
|
component: s,
|
|
805
798
|
file: r,
|
|
@@ -809,13 +802,13 @@ const Z = se({
|
|
|
809
802
|
render() {
|
|
810
803
|
return this.component ? T(this.component, this.query) : T("div", "页面不存在");
|
|
811
804
|
}
|
|
812
|
-
}),
|
|
805
|
+
}), Nt = se({
|
|
813
806
|
name: "VtjStartupContainer",
|
|
814
807
|
render() {
|
|
815
|
-
return T(
|
|
808
|
+
return T(qe);
|
|
816
809
|
}
|
|
817
810
|
}), de = Symbol("Provider");
|
|
818
|
-
class
|
|
811
|
+
class qt extends ve {
|
|
819
812
|
constructor(e) {
|
|
820
813
|
super(), this.options = e;
|
|
821
814
|
const {
|
|
@@ -836,7 +829,7 @@ class Nt extends ve {
|
|
|
836
829
|
mode;
|
|
837
830
|
globals = {};
|
|
838
831
|
modules = {};
|
|
839
|
-
adapter = { request:
|
|
832
|
+
adapter = { request: ze, jsonp: Re };
|
|
840
833
|
apis = {};
|
|
841
834
|
dependencies = {};
|
|
842
835
|
materials = {};
|
|
@@ -853,7 +846,7 @@ class Nt extends ve {
|
|
|
853
846
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
|
854
847
|
throw new Error("project is null");
|
|
855
848
|
const { apis: r = [], meta: s = [] } = this.project, o = window;
|
|
856
|
-
o.CKEDITOR_VERSION = void 0, this.nodeEnv !== "production" && await this.loadAssets(o), this.apis =
|
|
849
|
+
o.CKEDITOR_VERSION = void 0, this.nodeEnv !== "production" && await this.loadAssets(o), this.apis = tt(r, s, this.adapter), le(), this.project.config?.mock && nt(r), this.initRouter(), this.triggerReady();
|
|
857
850
|
}
|
|
858
851
|
async loadAssets(e) {
|
|
859
852
|
const { dependencies: t = [] } = this.project, { dependencies: r, library: s, components: o, materialPath: a } = this, {
|
|
@@ -862,7 +855,7 @@ class Nt extends ve {
|
|
|
862
855
|
materials: c,
|
|
863
856
|
materialExports: d,
|
|
864
857
|
materialMapLibrary: u
|
|
865
|
-
} =
|
|
858
|
+
} = We(t, a);
|
|
866
859
|
for (const p of i) {
|
|
867
860
|
const h = r[p], m = e[p];
|
|
868
861
|
if (m)
|
|
@@ -872,7 +865,7 @@ class Nt extends ve {
|
|
|
872
865
|
else {
|
|
873
866
|
const v = l[p] || [];
|
|
874
867
|
for (const w of v)
|
|
875
|
-
J(w) && await
|
|
868
|
+
J(w) && await Ke(p, b.append(w, { v: P })), L(w) && await Q(b.append(w, { v: P }));
|
|
876
869
|
s[p] = e[p];
|
|
877
870
|
}
|
|
878
871
|
}
|
|
@@ -888,7 +881,7 @@ class Nt extends ve {
|
|
|
888
881
|
else {
|
|
889
882
|
const v = f[p] ? (await f[p]()).default : e[p];
|
|
890
883
|
v && h && (v.components || []).forEach((w) => {
|
|
891
|
-
o[w.name] =
|
|
884
|
+
o[w.name] = Ge(w, h);
|
|
892
885
|
});
|
|
893
886
|
}
|
|
894
887
|
}
|
|
@@ -902,13 +895,13 @@ class Nt extends ve {
|
|
|
902
895
|
}), e.addRoute({
|
|
903
896
|
path: "/",
|
|
904
897
|
name: "VtjHomepage",
|
|
905
|
-
component: t?.homepage ? Z :
|
|
898
|
+
component: t?.homepage ? Z : Nt
|
|
906
899
|
}));
|
|
907
900
|
}
|
|
908
901
|
install(e) {
|
|
909
902
|
const t = e.config.globalProperties.installed || {};
|
|
910
903
|
for (const [r, s] of Object.entries(this.library))
|
|
911
|
-
!t[r] &&
|
|
904
|
+
!t[r] && Xe(s) && (e.use(s), t[r] = !0);
|
|
912
905
|
this.options.install && e.use(this.options.install), e.provide(de, this), e.config.globalProperties.installed = t;
|
|
913
906
|
}
|
|
914
907
|
getFile(e) {
|
|
@@ -991,15 +984,15 @@ class Nt extends ve {
|
|
|
991
984
|
});
|
|
992
985
|
}
|
|
993
986
|
}
|
|
994
|
-
function
|
|
995
|
-
const e = new
|
|
987
|
+
function rn(n) {
|
|
988
|
+
const e = new qt(n);
|
|
996
989
|
return {
|
|
997
990
|
provider: e,
|
|
998
991
|
onReady: (r) => e.ready(r)
|
|
999
992
|
};
|
|
1000
993
|
}
|
|
1001
994
|
function me(n = {}) {
|
|
1002
|
-
const e =
|
|
995
|
+
const e = Be(de);
|
|
1003
996
|
if (!e)
|
|
1004
997
|
throw new Error("Can not find provider");
|
|
1005
998
|
if (e.nodeEnv === "development") {
|
|
@@ -1014,7 +1007,7 @@ function me(n = {}) {
|
|
|
1014
1007
|
}
|
|
1015
1008
|
return e;
|
|
1016
1009
|
}
|
|
1017
|
-
const W = new
|
|
1010
|
+
const W = new Fe({
|
|
1018
1011
|
settings: {
|
|
1019
1012
|
type: "json",
|
|
1020
1013
|
validSuccess: !0,
|
|
@@ -1027,7 +1020,7 @@ const W = new Re({
|
|
|
1027
1020
|
});
|
|
1028
1021
|
}
|
|
1029
1022
|
}
|
|
1030
|
-
}),
|
|
1023
|
+
}), Jt = (n = "/vtj/local/repository/${type}.json") => (e, t) => W.send({
|
|
1031
1024
|
url: n,
|
|
1032
1025
|
method: "post",
|
|
1033
1026
|
query: { type: e },
|
|
@@ -1035,7 +1028,7 @@ const W = new Re({
|
|
|
1035
1028
|
type: e,
|
|
1036
1029
|
data: t
|
|
1037
1030
|
}
|
|
1038
|
-
}),
|
|
1031
|
+
}), Lt = (n = "/vtj/local/repository/uploader.json") => async (e, t) => await W.send({
|
|
1039
1032
|
url: n,
|
|
1040
1033
|
method: "post",
|
|
1041
1034
|
data: {
|
|
@@ -1051,7 +1044,7 @@ class G {
|
|
|
1051
1044
|
pluginCaches = {};
|
|
1052
1045
|
uploader;
|
|
1053
1046
|
constructor() {
|
|
1054
|
-
this.api =
|
|
1047
|
+
this.api = Jt(), this.uploader = Lt();
|
|
1055
1048
|
}
|
|
1056
1049
|
async getExtension() {
|
|
1057
1050
|
console.log("BaseService.getExtension");
|
|
@@ -1124,9 +1117,8 @@ class G {
|
|
|
1124
1117
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
|
1125
1118
|
}
|
|
1126
1119
|
async getPluginMaterial(e) {
|
|
1127
|
-
const { urls: t = [] } = e, r = t.filter((o) =>
|
|
1128
|
-
if (!r)
|
|
1129
|
-
return null;
|
|
1120
|
+
const { urls: t = [] } = e, r = t.filter((o) => Ve(o))[0];
|
|
1121
|
+
if (!r) return null;
|
|
1130
1122
|
const s = this.pluginCaches[r];
|
|
1131
1123
|
return s || (this.pluginCaches[r] = W.send({
|
|
1132
1124
|
url: r,
|
|
@@ -1138,12 +1130,12 @@ class G {
|
|
|
1138
1130
|
}).then((o) => o.data).catch(() => null));
|
|
1139
1131
|
}
|
|
1140
1132
|
}
|
|
1141
|
-
const y = new
|
|
1133
|
+
const y = new Ie({
|
|
1142
1134
|
type: "local",
|
|
1143
1135
|
expired: 0,
|
|
1144
1136
|
prefix: "__VTJ_"
|
|
1145
1137
|
});
|
|
1146
|
-
class
|
|
1138
|
+
class sn extends G {
|
|
1147
1139
|
init(e) {
|
|
1148
1140
|
const t = new I(e), r = y.get(`project_${t.id}`), s = Object.assign(t.toDsl(), r || {});
|
|
1149
1141
|
return y.save(`project_${t.id}`, s), Promise.resolve(s);
|
|
@@ -1193,7 +1185,7 @@ class rn extends G {
|
|
|
1193
1185
|
}), Promise.resolve(!0);
|
|
1194
1186
|
}
|
|
1195
1187
|
}
|
|
1196
|
-
class
|
|
1188
|
+
class Vt extends G {
|
|
1197
1189
|
projects = {};
|
|
1198
1190
|
materials = {};
|
|
1199
1191
|
files = {};
|
|
@@ -1251,10 +1243,10 @@ class Lt extends G {
|
|
|
1251
1243
|
}
|
|
1252
1244
|
}
|
|
1253
1245
|
let F = null;
|
|
1254
|
-
function
|
|
1255
|
-
return F || (F = new
|
|
1246
|
+
function on() {
|
|
1247
|
+
return F || (F = new Vt(), F);
|
|
1256
1248
|
}
|
|
1257
|
-
class
|
|
1249
|
+
class an extends G {
|
|
1258
1250
|
getFileCaches = {};
|
|
1259
1251
|
async getExtension() {
|
|
1260
1252
|
return await this.api("getExtension", {}).catch(() => {
|
|
@@ -1322,9 +1314,9 @@ function he(n = []) {
|
|
|
1322
1314
|
};
|
|
1323
1315
|
});
|
|
1324
1316
|
}
|
|
1325
|
-
function
|
|
1317
|
+
function cn() {
|
|
1326
1318
|
const n = me(), e = oe(), t = N(!1), r = n.project;
|
|
1327
|
-
|
|
1319
|
+
Ue(() => {
|
|
1328
1320
|
const { name: a, params: i, meta: l } = e;
|
|
1329
1321
|
if (a === "VtjPage") {
|
|
1330
1322
|
const c = n.getPage(i.id);
|
|
@@ -1345,54 +1337,54 @@ function an() {
|
|
|
1345
1337
|
};
|
|
1346
1338
|
}
|
|
1347
1339
|
export {
|
|
1348
|
-
|
|
1340
|
+
Je as BUILT_IN_DIRECTIVES,
|
|
1349
1341
|
G as BaseService,
|
|
1350
1342
|
Y as CONTEXT_HOST,
|
|
1351
|
-
|
|
1343
|
+
st as Context,
|
|
1352
1344
|
_ as ContextMode,
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1345
|
+
Le as DATA_TYPES,
|
|
1346
|
+
nn as JSCodeToString,
|
|
1347
|
+
Zt as LIFE_CYCLES_LIST,
|
|
1348
|
+
an as LocalService,
|
|
1349
|
+
Vt as MemoryService,
|
|
1350
|
+
qt as Provider,
|
|
1351
|
+
sn as StorageService,
|
|
1360
1352
|
P as VTJ_RENDERER_VERSION,
|
|
1361
1353
|
ae as adoptedStyleSheets,
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1354
|
+
en as createAssetScripts,
|
|
1355
|
+
tn as createAssetsCss,
|
|
1356
|
+
ft as createDataSources,
|
|
1365
1357
|
B as createLoader,
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1358
|
+
on as createMemoryService,
|
|
1359
|
+
et as createMetaApi,
|
|
1360
|
+
rn as createProvider,
|
|
1369
1361
|
A as createRenderer,
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1362
|
+
Ze as createSchemaApi,
|
|
1363
|
+
tt as createSchemaApis,
|
|
1364
|
+
mt as defaultLoader,
|
|
1373
1365
|
R as fillBasePath,
|
|
1374
1366
|
fe as getModifiers,
|
|
1375
1367
|
ue as getPlugin,
|
|
1376
|
-
|
|
1368
|
+
Ge as getRawComponent,
|
|
1377
1369
|
J as isCSSUrl,
|
|
1378
|
-
|
|
1370
|
+
Ye as isJSCode,
|
|
1379
1371
|
g as isJSExpression,
|
|
1380
1372
|
D as isJSFunction,
|
|
1381
|
-
|
|
1373
|
+
Ve as isJSON,
|
|
1382
1374
|
L as isJSUrl,
|
|
1383
|
-
|
|
1384
|
-
|
|
1375
|
+
Xe as isVuePlugin,
|
|
1376
|
+
Ke as loadCss,
|
|
1385
1377
|
ce as loadCssUrl,
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1378
|
+
Qe as loadScriptUrl,
|
|
1379
|
+
rt as mockApi,
|
|
1380
|
+
nt as mockApis,
|
|
1389
1381
|
le as mockCleanup,
|
|
1390
1382
|
M as nodeRender,
|
|
1391
|
-
|
|
1383
|
+
We as parseDeps,
|
|
1392
1384
|
C as parseExpression,
|
|
1393
1385
|
z as parseFunction,
|
|
1394
1386
|
de as providerKey,
|
|
1395
1387
|
ie as toString,
|
|
1396
|
-
|
|
1388
|
+
cn as useMask,
|
|
1397
1389
|
me as useProvider
|
|
1398
1390
|
};
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vtj/renderer",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.63",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"mockjs": "~1.1.0",
|
|
8
|
-
"@vtj/
|
|
9
|
-
"@vtj/
|
|
10
|
-
"@vtj/
|
|
11
|
-
"@vtj/
|
|
8
|
+
"@vtj/icons": "~0.8.63",
|
|
9
|
+
"@vtj/core": "~0.8.63",
|
|
10
|
+
"@vtj/utils": "~0.8.63",
|
|
11
|
+
"@vtj/ui": "~0.8.63"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"vue": "~3.4.15",
|
|
15
|
-
"vue-router": "~4.
|
|
16
|
-
"@vtj/cli": "~0.8.
|
|
15
|
+
"vue-router": "~4.4.0",
|
|
16
|
+
"@vtj/cli": "~0.8.16"
|
|
17
17
|
},
|
|
18
18
|
"exports": {
|
|
19
19
|
".": {
|
|
@@ -43,6 +43,6 @@ export declare class Context {
|
|
|
43
43
|
private __cleanup;
|
|
44
44
|
__parseFunction(code?: JSFunction): Function | undefined;
|
|
45
45
|
__parseExpression(code?: JSExpression | JSFunction): any;
|
|
46
|
-
__ref(id?: string | null, ref?: string | Function): ((el: any) => any) | undefined;
|
|
46
|
+
__ref(id?: string | null, ref?: string | Function): ((el: any) => Promise<any>) | undefined;
|
|
47
47
|
__clone(context?: Record<string, any>): Context;
|
|
48
48
|
}
|
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.62
|
|
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.62";
|