@vtj/renderer 0.7.6 → 0.7.7
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 +254 -250
- package/package.json +7 -7
- 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 P=require("@vtj/core"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("@vtj/core"),u=require("@vtj/utils"),d=require("vue"),G=require("vue-router"),F=require("element-plus"),ve=require("@vueuse/core"),he=require("@vtj/icons");function ge(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const N=ge(d);/**!
|
|
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.7.
|
|
5
|
+
* @version 0.7.7
|
|
6
6
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
7
|
-
*/const
|
|
8
|
-
`)+o;const i=`with(${t?"{}":"$scope || {}"}) { ${o} }`;return new Function("$scope",i)(e)}catch(n){if(
|
|
7
|
+
*/const b="0.7.7";var w=(r=>(r.Runtime="Runtime",r.Design="Design",r.Raw="Raw",r.VNode="VNode",r))(w||{});const B=["$el","$emit","$nextTick","$parent","$root","$attrs","$slots","$watch","$props","$options","$forceUpdate"],_e=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeUnmount","unmounted","errorCaptured","renderTracked","renderTriggered","activated","deactivated"],Q=["vIf","vShow","vModel","vFor","vBind"],Z={String,Number,Boolean,Array,Object,Function,Date};function C(r,e){return r.map(t=>u.isUrl(t)?t:`${e}${t}`)}function A(r){return/\.css$/.test(r)}function k(r){return/\.js$/.test(r)}function ye(r){return r.map(e=>`<script src="${u.url.append(e,{v:b})}"><\/script>`).join("")}function Se(r=[]){return r.map(e=>`<link rel="stylesheet" href="${u.url.append(e,{v:b})}" />`).join("")}function ee(r,e){const t=r.filter(v=>!!v.enabled),s=[],n=[],o=[],i=[],a={},l=[],c={};return t.forEach(({urls:v,assetsUrl:m,library:p,assetsLibrary:g})=>{v?.forEach(y=>{k(y)&&s.push(y),A(y)&&n.push(y)}),p&&(i.push(p),a[p]=C(v||[],e)),m&&o.push(m),g&&l.push(g),p&&g&&(c[g]=p)}),{scripts:C(s,e),css:C(n,e),materials:C(o,e),libraryExports:i,materialExports:l,materialMapLibrary:c,libraryMap:a}}function te(r,e){const{name:t,parent:s,alias:n}=r;return s?e[s]?.[n||t]:e[n||t]}function J(r){return u.isString(r)?r:JSON.stringify(r)}function q(r,e,t){const s=r.CSSStyleSheet;if(s.prototype.replaceSync){const n=new s;n.id=e,n.replaceSync(t);const o=r.document,i=o.adoptedStyleSheets,a=Array.from(i).filter(l=>l.id!==e);o.adoptedStyleSheets=[...a,n]}else{const n=r.document;let o=n.getElementById(e);o?o.innerHTML=t:(o=n.createElement("style"),o.id=e,o.innerHTML=t,n.head.appendChild(o))}}async function re(r,e){const t=await window.fetch(e).then(s=>s.text()).catch(()=>"");t&&q(window,r,t)}function se(r){return u.isFunction(r)||u.isFunction(r?.install)}var M=function(){return M=Object.assign||function(r){for(var e,t=1,s=arguments.length;t<s;t++){e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r},M.apply(this,arguments)},L={debug:-1,log:0,info:0,warn:1,error:2},we=function(r,e,t,s){return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(e&&L[e]<=L[r]&&console[r].apply&&(s==="*"||t.startsWith(s)))return console[r].apply(console,je(n,t))}};function je(r,e){return e!=="*"&&(typeof r[0]=="string"?r[0]="["+e+"] "+r[0]:r=["["+e+"]"].concat(r)),r}function $e(r,e){if(!r)return{targetLevel:e.level,targetBizName:e.bizName};if(~r.indexOf(":")){var t=r.split(":");return{targetLevel:t[0],targetBizName:t[1]}}return{targetLevel:r,targetBizName:"*"}}var Pe={level:"warn",bizName:"*"},ne=function(){function r(e){e=M(M({},Pe),e);var t=location||{},s=(/__(?:logConf|logLevel)__=([^#/&]*)/.exec(t.href)||[])[1],n=$e(s,e),o=n.targetLevel,i=n.targetBizName;for(var a in L)this[a]=we(a,o,e.bizName,i)}return r}();function oe(r){return new ne(r)}const I=oe({level:"log",bizName:"VTJ"});function R(r,e,t=!1,s=!1){try{const n=['"use strict";',"var __self = arguments[0];"];n.push("return ");let o=(r.value||"").trim();o=o.replace(/this(\W|$)/g,(a,l)=>`__self${l}`),o=n.join(`
|
|
8
|
+
`)+o;const i=`with(${t?"{}":"$scope || {}"}) { ${o} }`;return new Function("$scope",i)(e)}catch(n){if(I.error("parseExpression.error",n,r,e?.__self??e),s)throw n}}function V(r,e,t=!1,s=!1){const n=R(r,e,t,s);if(typeof n!="function"&&(I.error("parseFunction.error","not a function",r,e?.__self??e),s))throw new Error(`"${r.value}" not a function`);return n}function _(r){return r&&r.type==="JSExpression"}function H(r){return typeof r=="object"&&r&&r.type==="JSFunction"}function ie(r){return _(r)||H(r)}function Ee(r){return ie(r)?r.value:JSON.stringify(r)}let E=null;const be=u.createRequest({settings:{type:"form",validSuccess:!0,originResponse:!1,loading:!0,validate:r=>r.data?.code===0||!!r.data?.success,failMessage:!0,showError:r=>{F.ElNotification.error({message:r||"未知错误"})},showLoading:()=>{E&&E.close(),E=F.ElLoading.service({lock:!0,text:"Loading",background:"rgba(0, 0, 0, 0.05)"})},hideLoading:()=>{E&&(E.close(),E=null)}}});function ae(r,e){const{jsonp:t,request:s}=e;if(r.method==="jsonp")return(n={})=>t(r.url,{...r.jsonpOptions,query:n});{const n=r.headers?R(r.headers,{},!0):void 0,o={url:r.url,method:r.method,settings:{...r.settings,headers:n}};return(i,a)=>s.send(u.merge(o,a||{},{data:i}))}}function ce(r=[],e){return r.reduce((t,s)=>(t[s.id]=ae(s,e),t),{})}class le{__id=null;__mode;__instance=null;__contextRefs={};__refs={};context={};state={};$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:s,attrs:n}=e;this.__mode=t,s&&(this.__id=s.id||null,this.__transform=s.transform||{}),n&&Object.assign(this,n)}setup(e,t=N){const s=t.getCurrentInstance();if(!s)return;this.__instance=s.proxy;const n=s.appContext.config.globalProperties;Object.assign(this,n),Object.assign(this,e||{}),this.__proxy(),t.onMounted(()=>{this.__proxy()}),t.onUnmounted(()=>{this.__cleanup()})}__proxy(){this.__instance&&B.forEach(e=>{this[e]=this.__instance?.[e]})}__cleanup(){B.forEach(e=>{this[e]=null})}__parseFunction(e){if(e)if(this.__mode===w.Runtime){const{id:t,type:s}=e,n=t?this.__transform[t]??e.value:e.value;return V({type:s,value:n},this)}else return V(e,this)}__parseExpression(e){if(e)if(this.__mode===w.Runtime){const{id:t,type:s}=e,n=t?this.__transform[t]??e.value:e.value;return R({type:s,value:n},this)}else return R(e,this)}__ref(e=null,t){if(this.__mode!==w.VNode)return e&&e!==this.__id&&(this.__contextRefs[e]=this),s=>{let n=s?.$vtjEl||s?.$el||s;if(!n){typeof t=="string"&&(delete this.$refs[t],e&&delete this.__refs[e]);return}if(n.__vtj__=e,n.nodeType===3&&n.nextSibling&&(n=n.nextSibling),w.Design===this.__mode&&(n.__context__=this),e&&(this.__refs[e]=s),typeof t=="function")t(s);else if(t){const o=this.$refs[t];if(o){const i=new Set([].concat(o,s));this.$refs[t]=Array.from(i)}else this.$refs[t]=s}return s}}__clone(e={}){const t={...this.context,...e},s={...t,context:t};return s.context.__proto__=this.context,s.__proto__=this,s}}function U(r){const{Vue:e=N,mode:t=w.Runtime,components:s={},libs:n={},apis:o={},loader:i}=r,a=e.computed(()=>r.dsl),l={$components:s,$libs:n,$apis:o},c=new le({mode:t,dsl:a.value,attrs:l}),v=e.defineComponent({name:a.value.name,props:{...Ce(a.value.props??[],c)},setup(m){c.$props=m,a.value.id&&q(r.window||window,a.value.id,a.value.css||""),c.state=Fe(e,a.value.state??{},c);const p=Ie(e,a.value.computed??{},c),g=Re(a.value.methods??{},c),y=xe(e,a.value.inject,c),f=ue(a.value.dataSources||{},c),j={...y,...p,...g,...f};return c.setup(j,e),He(e,a.value.watch??[],c),{vtj:c}},emits:[...a.value.emits??[]],expose:["vtj"],render(){if(!a.value.nodes)return null;const m=a.value.nodes||[];return m.length===1?x(m[0],c,e,i):m.map(p=>x(p,c,e,i))},...Oe(a.value.lifeCycles??{},c)});return{renderer:e.markRaw(v),context:c}}function Ce(r=[],e){const t=s=>s?(Array.isArray(s)?s:[s]).map(o=>Z[o]):void 0;return r.map(s=>u.isString(s)?{name:s}:{name:s.name,type:s.type,required:s.required,default:_(s.default)?e.__parseExpression(s.default):s.default}).reduce((s,n)=>(s[n.name]={type:t(n.type),required:n.required,default:n.default},s),{})}function Fe(r,e,t){return r.reactive(Object.keys(e||{}).reduce((s,n)=>{let o=e[n];return _(o)?o=t.__parseExpression(o):H(o)&&(o=t.__parseFunction(o)),s[n]=o,s},{}))}function Ie(r,e,t){return Object.entries(e??{}).reduce((s,[n,o])=>(s[n]=r.computed(t.__parseFunction(o)),s),{})}function Re(r,e){return Object.entries(r??{}).reduce((t,[s,n])=>(t[s]=e.__parseFunction(n),t),{})}function xe(r,e=[],t){return e.reduce((s,n)=>{const{name:o,from:i}=n||{};n.default;const a=_(i)?t.__parseExpression(i)||o:i??o,l=_(n.default)?t.__parseExpression(n.default):n.default??null;return s[o]=r.inject(a,l),s},{})}function ue(r,e){return Object.keys(r).reduce((t,s)=>{const n=r[s],o=e.$apis[n.ref],i=H(n.transform)?n.transform.value?e.__parseFunction(n.transform):void 0:n.transform;return t[s]=async(...a)=>{const l=await o.apply(e,a);return i?i(l):l},t},{})}function He(r,e=[],t){e.forEach(s=>{r.watch(t.__parseExpression(s.source),t.__parseFunction(s.handler),{deep:s.deep,immediate:s.immediate})})}function Oe(r,e){return Object.entries(r??{}).reduce((t,[s,n])=>(t[s]=e.__parseFunction(n),t),{})}const pe=r=>r;function z(r){const{getDsl:e,options:t}=r;return(s,n,o=N)=>!n||typeof n=="string"?s:n.type==="Schema"?o.defineAsyncComponent(async()=>{const i=await e(n.id);return i?U({...t,Vue:o,dsl:i,mode:w.Runtime,loader:z(r)}).renderer:null}):s}function x(r,e,t=N,s=pe){if(!r||!r.name||r.invisible)return null;const{id:n=null,directives:o=[]}=r,{vIf:i,vFor:a,vShow:l,vModels:c,vBind:v}=Te(o);if(i&&!Me(i,e))return null;const m=p=>{const g=p.$components,y=(()=>{if(r.name==="component")return Ne(p,r.props?.is);if(r.name==="slot")return r.name;const S=s(r.name,r.from,t);return u.isString(S)?g[S]??S:S})(),f=De(n,r.props??{},p),j=Be(t,r.events??{},p);if(r.name==="slot")return Le(t,r,f,p);v&&Object.assign(f,p.__parseExpression(v.value)),l&&(f.style=Object.assign(f.style??{},Ae(l,p))),c.forEach(S=>{Object.assign(f,ke(t,S,p))});const $=Je(t,r.children??[],p,r);return t.createVNode(y,{...f,...j},$)};return a?ze(a,m,e):m(e)}function Te(r=[]){const e=r.find(a=>u.camelCase(a.name)==="vIf"),t=r.find(a=>u.camelCase(a.name)==="vFor"),s=r.find(a=>u.camelCase(a.name)==="vShow"),n=r.find(a=>u.camelCase(a.name)==="vBind"),o=r.filter(a=>u.camelCase(a.name)==="vModel"),i=r.filter(a=>!Q.includes(u.camelCase(a.name)));return{vIf:e,vFor:t,vShow:s,vModels:o,vBind:n,others:i}}function Me(r,e){return!!e.__parseExpression(r.value)}function Ne(r,e){return e?_(e)?r.__parseExpression(e):e:"div"}function De(r,e,t){const s=Object.keys(e||{}).reduce((n,o)=>{let i=e[o];return _(i)?i=t.__parseExpression(i):H(i)&&(i=t.__parseFunction(i)),n[o]=i,n},{});return s.ref=t.__ref(r,s.ref),s}function Be(r,e,t){const s=["passive","capture","once"],n={capture:"Capture",once:"Once",passive:"OnceCapture"};return Object.keys(e||{}).reduce((o,i)=>{const a=e[i],l=Y(a.modifiers),c=l.find(p=>s.includes(p)),v="on"+u.upperFirst(i)+(c&&n[c]||""),m=t.__parseFunction(a.handler);return m&&(o[v]=r.withModifiers(m,l)),o},{})}function Y(r={},e=!1){const t=Object.keys(r);return e?t.map(s=>"."+s):t}function Le(r,e,t,s){const{children:n}=e,o=Ve(e,s),i=s.$slots?.[o.name];return i?i(t):n?u.isString(n)?r.createTextVNode(n):_(n)?r.createTextVNode(J(s.__parseExpression(n))):Array.isArray(n)?n.map(a=>x(a,s,r)):null:null}function Ve(r,e){const{props:t}=r,s=t?.name||"default";return{name:_(s)?e.__parseExpression(s):s,params:[]}}function Ae(r,e){return e.__parseExpression(r.value)?{}:{display:"none"}}function ke(r,e,t){const s={type:"JSFunction",value:e.value?.value?`(v) => {
|
|
9
9
|
${e.value.value} = v;
|
|
10
|
-
}`:"(v) => {}"},n=t.__parseFunction(s),o=z(e.modifiers),i=_(e.arg)?t.__parseExpression(e.arg):e.arg||"modelValue";return{[i]:t.__parseExpression(e.value),[`onUpdate:${i}`]:o.length&&n?r.withModifiers(n,o):n}}function Je(r,e,t,s){if(!e)return null;if(p.isString(e))return{default:()=>e};if(_(e))return{default:()=>k(t.__parseExpression(e))};if(Array.isArray(e)){const n=qe(e),o=i=>!i||!s?{}:s?.id&&Object.keys(i).length?{[`scope_${s.id}`]:i}:{};return Object.entries(n).reduce((i,[a,{nodes:l,params:c}])=>(i[a]=h=>{const m=c.length?p.pick(h??{},c):o(h);return l.map(u=>R(u,t.__clone(m),r))},i),{})}}function qe(r){const e={default:{params:[],nodes:[]}};for(const t of r){const s=Ue(t.slot),n=s.name;e[n]?(e[n].nodes.push(t),e[n].params=e[n].params.concat(s.params)):e[n]={nodes:[t],params:s.params}}return e}function Ue(r="default"){return p.isString(r)?{name:r,params:[]}:{params:[],...r}}function ze(r,e,t){const{value:s,iterator:n}=r,{item:o="item",index:i="index"}=n||{};let a=t.__parseExpression(s)||[];return Number.isInteger(a)&&(a=new Array(a).fill(!0).map((l,c)=>c+1)),Array.isArray(a)?a.map((l,c)=>e(t.__clone({[o]:l,[i]:c}))):(console.warn("[vForRender]:",`${s?.value} is not a Arrary`),[])}const W=d.defineComponent({name:"VtjPageContainer",async setup(){const r=K(),e=X.useRoute(),t=e.params.id,s=t?r.getPage(t):r.getHomepage(),n=s?await r.getRenderComponent(s.id):null;return s&&me.useTitle(s.title||"VTJ"),{provider:r,component:n,file:s,query:e.query}},render(){return this.component?d.h(this.component,this.query):d.h("div","页面不存在")}}),Ye={name:{type:String,default:"VTJ.PRO"},tagline:{type:String,default:"基于 Vue3 + TypeScript 快速打造高生产力的低代码研发平台"},actionText:{type:String,default:"开始设计"},actionLink:{type:String,default:"/@vtj/pro/"}},Ke={class:"x-startup"},We={class:"x-startup__wrapper"},Xe={class:"x-startup__name"},Ge={class:"clip"},Qe={class:"x-startup__tagline"},Ze={class:"x-startup__actions"},et=d.defineComponent({__name:"Startup",props:Ye,setup(r){const e=r,t=()=>{let s=(window.__VTJ_LINK__||{}).href||window.location.pathname+"@vtj/pro/#/";location.href=s};return(s,n)=>(d.openBlock(),d.createElementBlock("div",Ke,[d.createElementVNode("div",We,[d.createElementVNode("div",Xe,[d.createElementVNode("span",Ge,d.toDisplayString(e.name),1)]),d.createElementVNode("div",Qe,d.toDisplayString(e.tagline),1),d.createElementVNode("div",Ze,[d.createVNode(d.unref(C.ElButton),{type:"primary",size:"large",round:"",icon:d.unref(he.EditPen),onClick:t},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(e.actionText),1)]),_:1},8,["icon"])])])]))}}),tt=d.defineComponent({name:"VtjStartupContainer",render(){return d.h(et)}}),Y=Symbol("Provider");class pe extends P.Base{mode;globals={};modules={};adapter={request:be,jsonp:p.jsonp};apis={};dependencies={};materials={};library={};service;project=null;components={};router=null;materialPath="./";constructor(e){super();const{service:t,mode:s=w.Raw,dependencies:n,materials:o,project:i={},adapter:a={},globals:l={},modules:c={},router:h=null,materialPath:m="./"}=e;this.mode=s,this.modules=c,this.service=t,this.router=h,this.materialPath=m,n&&(this.dependencies=n),o&&(this.materials=o),Object.assign(this.globals,l),Object.assign(this.adapter,a),s!==w.Design&&this.load(i)}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:s=[],apis:n}=this.project,{dependencies:o,library:i,components:a,materialPath:l}=this,{libraryExports:c,libraryMap:h,materials:m,materialExports:u,materialMapLibrary:g}=Z(s,l);for(const f of c){const j=o[f],$=window[f];if($)i[f]=$;else if(j)window[f]=i[f]=await j();else{const S=h[f]||[];for(const H of S)V(H)&&await te(f,H),A(H)&&await p.loadScript(H),i[f]=window[f]}}for(const f of m)await p.loadScript(f);const y=this.materials||{};for(const f of u){const j=y[f]?(await y[f]()).default:window[f],$=window[g[f]];j&&$&&j.components.forEach(S=>{a[S.name]=ee(S,$)})}n&&(this.apis=ae(n,this.adapter)),this.initRouter(),this.triggerReady()}initRouter(){const{router:e,project:t}=this;e&&(e.addRoute({path:"/page/:id",name:"VtjPage",component:W}),e.addRoute({path:"/",name:"VtjHomepage",component:t?.homepage?W:tt}))}install(e){const t=e.config.globalProperties.installed||{};for(const[s,n]of Object.entries(this.library))!t[s]&&re(n)&&(e.use(n),t[s]=!0);e.provide(Y,this),e.config.globalProperties.installed=t}getFile(e){const{blocks:t=[]}=this.project||{};return this.getPage(e)||t.find(s=>s.id===e)||null}getPage(e){const{pages:t=[]}=this.project||{},s=(n,o=[])=>{for(const i of o){if(i.id===n)return i;if(i.children&&i.children.length){const a=s(n,i.children);if(a)return a}}};return s(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 getRenderComponent(e){const t=this.getFile(e);if(!t)return F.warn(`Can not find file: ${e}`),null;const s=`.vtj/vue/${e}.vue`,n=this.modules[s];if(n)return(await n())?.default;const o=await this.getDsl(t.id);if(!o)return F.warn(`Can not find dsl: ${e}`),null;const{library:i,components:a,mode:l,apis:c}=this,h={mode:l,Vue:i.Vue,components:a,libs:i,apis:c,window},m=U({getDsl:async g=>await this.getDsl(g)||null,options:h}),{renderer:u}=q({...h,dsl:o,loader:m});return u}}function rt(r){const e=new pe(r);return{provider:e,onReady:s=>e.ready(s)}}function K(r={}){const e=d.inject(Y);if(!e)throw new Error("Can not find provider");if(e.mode===w.Raw){const{id:t,version:s}=r;t&&s&&(async()=>{const n=await e.getDsl(t);n?.__VERSION__!==s&&C.ElNotification.warning({title:n?.name,message:"当前组件源码版本与运行时版本不一致,请重新发布组件"})})()}return e}const st=new p.Request({settings:{type:"json",validSuccess:!0,originResponse:!1,failMessage:!0,validate:r=>r.data?.code===0,showError:r=>{C.ElNotification.error({message:r||"未知错误"})}}}),nt=(r="/vtj/local/repository/${type}.json")=>(e,t)=>st.send({url:r,method:"post",query:{type:e},data:{type:e,data:t}});class N{api;constructor(){this.api=nt()}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(()=>"")}}const v=new p.Storage({type:"local",expired:0,prefix:"__VTJ_"});class ot extends N{init(e){const t=new P.ProjectModel(e),s=v.get(`project_${t.id}`),n=Object.assign(t.toDsl(),s||{});return v.save(`project_${t.id}`,n),Promise.resolve(n)}saveProject(e){const t=new P.ProjectModel(e);return v.save(`project_${t.id}`,t.toDsl()),Promise.resolve(!0)}saveMaterials(e,t){return v.save(`materials_${e.id}`,p.mapToObject(t)),Promise.resolve(!0)}saveFile(e){return v.save(`file_${e.id}`,e),Promise.resolve(!0)}getFile(e){const t=v.get(`file_${e}`);return t?Promise.resolve(t):Promise.reject(null)}removeFile(e){return v.remove(`file_${e}`),Promise.resolve(!0)}saveHistory(e){return v.save(`history_${e.id}`,e),Promise.resolve(!0)}removeHistory(e){const t=v.get(`history_${e}`);if(t){const n=(t.items||[]).map(o=>o.id);this.removeHistoryItem(e,n),v.remove(`history_${e}`)}return Promise.resolve(!0)}getHistory(e){const t=v.get(`history_${e}`),s=new P.HistoryModel(t||{id:e});return Promise.resolve(s.toDsl())}getHistoryItem(e,t){const s=v.get(`history_${e}_${t}`);return Promise.resolve(s)}saveHistoryItem(e,t){return v.save(`history_${e}_${t.id}`,t),Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(s=>{v.remove(`history_${e}_${s}`)}),Promise.resolve(!0)}}class fe extends N{projects={};materials={};files={};histories={};historyItems={};init(e){const t=new P.ProjectModel(e),s=this.projects[t.id]||{},n=Object.assign(t.toDsl(),s);return this.projects[n.id]=n,Promise.resolve(n)}saveProject(e){const t=new P.ProjectModel(e);return this.projects[t.id]=t.toDsl(),Promise.resolve(!0)}saveMaterials(e,t){return e.id&&(this.materials[e.id]=p.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 n=(t.items||[]).map(o=>o.id);this.removeHistoryItem(e,n),delete this.historyItems[e]}return Promise.resolve(!0)}getHistory(e){const t=this.histories[e],s=new P.HistoryModel(t||{id:e});return Promise.resolve(s)}getHistoryItem(e,t){const s=`${e}_${t}`,n=this.historyItems[s]||{};return Promise.resolve(n)}saveHistoryItem(e,t){const s=`${e}_${t.id}`;return this.historyItems[s]=t,Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(s=>{const n=`${e}_${s}`;delete this.historyItems[n]}),Promise.resolve(!0)}}let O=null;function it(){return O||(O=new fe,O)}class at extends N{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:p.mapToObject(t)}).catch(()=>!1)}async saveFile(e){return!!await this.api("saveFile",e).catch(()=>!1)}async getFile(e){return await this.api("getFile",e).catch(()=>null)||{}}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 de(r=[]){return r.map(e=>{const{id:t,title:s,icon:n,children:o,hidden:i}=e;return{id:t,title:s,icon:n,hidden:i,url:`/page/${t}`,children:o&&o.length?de(o):void 0}})}function ct(){const r=K(),e=X.useRoute(),t=d.ref(!1),s=r.project;d.watchEffect(()=>{const{name:o,params:i,meta:a}=e;if(o==="VtjPage"){const l=r.getPage(i.id);t.value=!l?.mask}else if(o==="VtjHomepage"){const l=r.getHomepage();t.value=!l?.mask}else t.value=!a.mask});const n=de(s?.pages);return{disabled:t,title:s?.description||s?.name||"VTJ App",menus:n}}exports.BUILDIN_DIRECTIVES=G;exports.BaseService=N;exports.CONTEXT_HOST=D;exports.Context=ce;exports.ContextMode=w;exports.DATA_TYPES=Q;exports.JSCodeToString=Ee;exports.LIFE_CYCLES_LIST=_e;exports.LocalService=at;exports.Logger=se;exports.MemoryService=fe;exports.Provider=pe;exports.StorageService=ot;exports.VTJ_RENDERER_VERSION=ge;exports.adoptedStyleSheets=J;exports.createAssetScripts=ye;exports.createAssetsCss=Se;exports.createDataSources=le;exports.createLoader=U;exports.createMemoryService=it;exports.createProvider=rt;exports.createRenderer=q;exports.createSchemaApi=ie;exports.createSchemaApis=ae;exports.defaultLoader=ue;exports.fillBasePath=b;exports.getLogger=ne;exports.getModifiers=z;exports.getRawComponent=ee;exports.isCSSUrl=V;exports.isJSCode=oe;exports.isJSExpression=_;exports.isJSFunction=x;exports.isJSUrl=A;exports.isVuePlugin=re;exports.loadCss=te;exports.logger=F;exports.nodeRender=R;exports.parseDeps=Z;exports.parseExpression=I;exports.parseFunction=L;exports.providerKey=Y;exports.toString=k;exports.useMask=ct;exports.useProvider=K;
|
|
10
|
+
}`:"(v) => {}"},n=t.__parseFunction(s),o=Y(e.modifiers),i=_(e.arg)?t.__parseExpression(e.arg):e.arg||"modelValue";return{[i]:t.__parseExpression(e.value),[`onUpdate:${i}`]:o.length&&n?r.withModifiers(n,o):n}}function Je(r,e,t,s){if(!e)return null;if(u.isString(e))return{default:()=>e};if(_(e))return{default:()=>J(t.__parseExpression(e))};if(Array.isArray(e)){const n=qe(e),o=i=>!i||!s?{}:s?.id&&Object.keys(i).length?{[`scope_${s.id}`]:i}:{};return Object.entries(n).reduce((i,[a,{nodes:l,params:c}])=>(i[a]=v=>{const m=c.length?u.pick(v??{},c):o(v);return l.map(p=>x(p,t.__clone(m),r))},i),{})}}function qe(r){const e={default:{params:[],nodes:[]}};for(const t of r){const s=Ue(t.slot),n=s.name;e[n]?(e[n].nodes.push(t),e[n].params=e[n].params.concat(s.params)):e[n]={nodes:[t],params:s.params}}return e}function Ue(r="default"){return u.isString(r)?{name:r,params:[]}:{params:[],...r}}function ze(r,e,t){const{value:s,iterator:n}=r,{item:o="item",index:i="index"}=n||{};let a=t.__parseExpression(s)||[];return Number.isInteger(a)&&(a=new Array(a).fill(!0).map((l,c)=>c+1)),Array.isArray(a)?a.map((l,c)=>e(t.__clone({[o]:l,[i]:c}))):(console.warn("[vForRender]:",`${s?.value} is not a Arrary`),[])}const X=d.defineComponent({name:"VtjPageContainer",async setup(){const r=W(),e=G.useRoute(),t=e.params.id,s=t?r.getPage(t):r.getHomepage(),n=s?await r.getRenderComponent(s.id):null;return s&&ve.useTitle(s.title||"VTJ"),{provider:r,component:n,file:s,query:e.query}},render(){return this.component?d.h(this.component,this.query):d.h("div","页面不存在")}}),Ye={name:{type:String,default:"VTJ.PRO"},tagline:{type:String,default:"基于 Vue3 + TypeScript 快速打造高生产力的低代码研发平台"},actionText:{type:String,default:"开始设计"},actionLink:{type:String,default:"/@vtj/pro/"}},Ke={class:"x-startup"},We={class:"x-startup__wrapper"},Xe={class:"x-startup__name"},Ge={class:"clip"},Qe={class:"x-startup__tagline"},Ze={class:"x-startup__actions"},et=d.defineComponent({__name:"Startup",props:Ye,setup(r){const e=r,t=()=>{let s=(window.__VTJ_LINK__||{}).href||window.location.pathname+"@vtj/pro/#/";location.href=s};return(s,n)=>(d.openBlock(),d.createElementBlock("div",Ke,[d.createElementVNode("div",We,[d.createElementVNode("div",Xe,[d.createElementVNode("span",Ge,d.toDisplayString(e.name),1)]),d.createElementVNode("div",Qe,d.toDisplayString(e.tagline),1),d.createElementVNode("div",Ze,[d.createVNode(d.unref(F.ElButton),{type:"primary",size:"large",round:"",icon:d.unref(he.EditPen),onClick:t},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(e.actionText),1)]),_:1},8,["icon"])])])]))}}),tt=d.defineComponent({name:"VtjStartupContainer",render(){return d.h(et)}}),K=Symbol("Provider");class fe extends P.Base{mode;globals={};modules={};adapter={request:be,jsonp:u.jsonp};apis={};dependencies={};materials={};library={};service;project=null;components={};router=null;materialPath="./";constructor(e){super();const{service:t,mode:s=w.Raw,dependencies:n,materials:o,project:i={},adapter:a={},globals:l={},modules:c={},router:v=null,materialPath:m="./"}=e;this.mode=s,this.modules=c,this.service=t,this.router=v,this.materialPath=m,n&&(this.dependencies=n),o&&(this.materials=o),Object.assign(this.globals,l),Object.assign(this.adapter,a),s!==w.Design&&this.load(i)}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:s=[],apis:n}=this.project,{dependencies:o,library:i,components:a,materialPath:l}=this,{libraryExports:c,libraryMap:v,materials:m,materialExports:p,materialMapLibrary:g}=ee(s,l);for(const f of c){const j=o[f],$=window[f];if($)i[f]=$;else if(j)window[f]=i[f]=await j();else{const S=v[f]||[];for(const O of S)A(O)&&await re(f,u.url.append(O,{v:b})),k(O)&&await u.loadScript(u.url.append(O,{v:b})),i[f]=window[f]}}for(const f of m)await u.loadScript(u.url.append(f,{v:b}));const y=this.materials||{};for(const f of p){const j=y[f]?(await y[f]()).default:window[f],$=window[g[f]];j&&$&&j.components.forEach(S=>{a[S.name]=te(S,$)})}n&&(this.apis=ce(n,this.adapter)),this.initRouter(),this.triggerReady()}initRouter(){const{router:e,project:t}=this;e&&(e.addRoute({path:"/page/:id",name:"VtjPage",component:X}),e.addRoute({path:"/",name:"VtjHomepage",component:t?.homepage?X:tt}))}install(e){const t=e.config.globalProperties.installed||{};for(const[s,n]of Object.entries(this.library))!t[s]&&se(n)&&(e.use(n),t[s]=!0);e.provide(K,this),e.config.globalProperties.installed=t}getFile(e){const{blocks:t=[]}=this.project||{};return this.getPage(e)||t.find(s=>s.id===e)||null}getPage(e){const{pages:t=[]}=this.project||{},s=(n,o=[])=>{for(const i of o){if(i.id===n)return i;if(i.children&&i.children.length){const a=s(n,i.children);if(a)return a}}};return s(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 getRenderComponent(e){const t=this.getFile(e);if(!t)return I.warn(`Can not find file: ${e}`),null;const s=`.vtj/vue/${e}.vue`,n=this.modules[s];if(n)return(await n())?.default;const o=await this.getDsl(t.id);if(!o)return I.warn(`Can not find dsl: ${e}`),null;const{library:i,components:a,mode:l,apis:c}=this,v={mode:l,Vue:i.Vue,components:a,libs:i,apis:c,window},m=z({getDsl:async g=>await this.getDsl(g)||null,options:v}),{renderer:p}=U({...v,dsl:o,loader:m});return p}}function rt(r){const e=new fe(r);return{provider:e,onReady:s=>e.ready(s)}}function W(r={}){const e=d.inject(K);if(!e)throw new Error("Can not find provider");if(e.mode===w.Raw){const{id:t,version:s}=r;t&&s&&(async()=>{const n=await e.getDsl(t);n?.__VERSION__!==s&&F.ElNotification.warning({title:n?.name,message:"当前组件源码版本与运行时版本不一致,请重新发布组件"})})()}return e}const st=new u.Request({settings:{type:"json",validSuccess:!0,originResponse:!1,failMessage:!0,validate:r=>r.data?.code===0,showError:r=>{F.ElNotification.error({message:r||"未知错误"})}}}),nt=(r="/vtj/local/repository/${type}.json")=>(e,t)=>st.send({url:r,method:"post",query:{type:e},data:{type:e,data:t}});class D{api;constructor(){this.api=nt()}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(()=>"")}}const h=new u.Storage({type:"local",expired:0,prefix:"__VTJ_"});class ot extends D{init(e){const t=new P.ProjectModel(e),s=h.get(`project_${t.id}`),n=Object.assign(t.toDsl(),s||{});return h.save(`project_${t.id}`,n),Promise.resolve(n)}saveProject(e){const t=new P.ProjectModel(e);return h.save(`project_${t.id}`,t.toDsl()),Promise.resolve(!0)}saveMaterials(e,t){return h.save(`materials_${e.id}`,u.mapToObject(t)),Promise.resolve(!0)}saveFile(e){return h.save(`file_${e.id}`,e),Promise.resolve(!0)}getFile(e){const t=h.get(`file_${e}`);return t?Promise.resolve(t):Promise.reject(null)}removeFile(e){return h.remove(`file_${e}`),Promise.resolve(!0)}saveHistory(e){return h.save(`history_${e.id}`,e),Promise.resolve(!0)}removeHistory(e){const t=h.get(`history_${e}`);if(t){const n=(t.items||[]).map(o=>o.id);this.removeHistoryItem(e,n),h.remove(`history_${e}`)}return Promise.resolve(!0)}getHistory(e){const t=h.get(`history_${e}`),s=new P.HistoryModel(t||{id:e});return Promise.resolve(s.toDsl())}getHistoryItem(e,t){const s=h.get(`history_${e}_${t}`);return Promise.resolve(s)}saveHistoryItem(e,t){return h.save(`history_${e}_${t.id}`,t),Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(s=>{h.remove(`history_${e}_${s}`)}),Promise.resolve(!0)}}class de extends D{projects={};materials={};files={};histories={};historyItems={};init(e){const t=new P.ProjectModel(e),s=this.projects[t.id]||{},n=Object.assign(t.toDsl(),s);return this.projects[n.id]=n,Promise.resolve(n)}saveProject(e){const t=new P.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 n=(t.items||[]).map(o=>o.id);this.removeHistoryItem(e,n),delete this.historyItems[e]}return Promise.resolve(!0)}getHistory(e){const t=this.histories[e],s=new P.HistoryModel(t||{id:e});return Promise.resolve(s)}getHistoryItem(e,t){const s=`${e}_${t}`,n=this.historyItems[s]||{};return Promise.resolve(n)}saveHistoryItem(e,t){const s=`${e}_${t.id}`;return this.historyItems[s]=t,Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(s=>{const n=`${e}_${s}`;delete this.historyItems[n]}),Promise.resolve(!0)}}let T=null;function it(){return T||(T=new de,T)}class at extends D{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){return await this.api("getFile",e).catch(()=>null)||{}}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 me(r=[]){return r.map(e=>{const{id:t,title:s,icon:n,children:o,hidden:i}=e;return{id:t,title:s,icon:n,hidden:i,url:`/page/${t}`,children:o&&o.length?me(o):void 0}})}function ct(){const r=W(),e=G.useRoute(),t=d.ref(!1),s=r.project;d.watchEffect(()=>{const{name:o,params:i,meta:a}=e;if(o==="VtjPage"){const l=r.getPage(i.id);t.value=!l?.mask}else if(o==="VtjHomepage"){const l=r.getHomepage();t.value=!l?.mask}else t.value=!a.mask});const n=me(s?.pages);return{disabled:t,title:s?.description||s?.name||"VTJ App",menus:n}}exports.BUILDIN_DIRECTIVES=Q;exports.BaseService=D;exports.CONTEXT_HOST=B;exports.Context=le;exports.ContextMode=w;exports.DATA_TYPES=Z;exports.JSCodeToString=Ee;exports.LIFE_CYCLES_LIST=_e;exports.LocalService=at;exports.Logger=ne;exports.MemoryService=de;exports.Provider=fe;exports.StorageService=ot;exports.VTJ_RENDERER_VERSION=b;exports.adoptedStyleSheets=q;exports.createAssetScripts=ye;exports.createAssetsCss=Se;exports.createDataSources=ue;exports.createLoader=z;exports.createMemoryService=it;exports.createProvider=rt;exports.createRenderer=U;exports.createSchemaApi=ae;exports.createSchemaApis=ce;exports.defaultLoader=pe;exports.fillBasePath=C;exports.getLogger=oe;exports.getModifiers=Y;exports.getRawComponent=te;exports.isCSSUrl=A;exports.isJSCode=ie;exports.isJSExpression=_;exports.isJSFunction=H;exports.isJSUrl=k;exports.isVuePlugin=se;exports.loadCss=re;exports.logger=I;exports.nodeRender=x;exports.parseDeps=ee;exports.parseExpression=R;exports.parseFunction=V;exports.providerKey=K;exports.toString=J;exports.useMask=ct;exports.useProvider=W;
|
package/dist/index.mjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { Base as
|
|
2
|
-
import { isUrl as
|
|
3
|
-
import * as
|
|
4
|
-
import { defineComponent as
|
|
5
|
-
import { useRoute as
|
|
6
|
-
import { ElNotification as
|
|
7
|
-
import { useTitle as
|
|
8
|
-
import { EditPen as
|
|
1
|
+
import { Base as le, ProjectModel as R, HistoryModel as G } from "@vtj/core";
|
|
2
|
+
import { isUrl as ue, url as b, isString as P, isFunction as U, createRequest as pe, merge as fe, camelCase as $, upperFirst as me, pick as de, jsonp as he, loadScript as z, Request as ve, Storage as ge, mapToObject as V } from "@vtj/utils";
|
|
3
|
+
import * as B from "vue";
|
|
4
|
+
import { defineComponent as L, h as D, openBlock as _e, createElementBlock as ye, createElementVNode as E, toDisplayString as k, createVNode as we, unref as W, withCtx as Se, createTextVNode as $e, inject as je, ref as Pe, watchEffect as Ee } from "vue";
|
|
5
|
+
import { useRoute as Q } from "vue-router";
|
|
6
|
+
import { ElNotification as J, ElLoading as be, ElButton as Fe } from "element-plus";
|
|
7
|
+
import { useTitle as xe } from "@vueuse/core";
|
|
8
|
+
import { EditPen as He } from "@vtj/icons";
|
|
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.7.
|
|
13
|
+
* @version 0.7.7
|
|
14
14
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
15
15
|
*/
|
|
16
|
-
const
|
|
16
|
+
const F = "0.7.7";
|
|
17
17
|
var y = /* @__PURE__ */ ((r) => (r.Runtime = "Runtime", r.Design = "Design", r.Raw = "Raw", r.VNode = "VNode", r))(y || {});
|
|
18
|
-
const
|
|
18
|
+
const K = [
|
|
19
19
|
"$el",
|
|
20
20
|
"$emit",
|
|
21
21
|
"$nextTick",
|
|
@@ -27,7 +27,7 @@ const z = [
|
|
|
27
27
|
"$props",
|
|
28
28
|
"$options",
|
|
29
29
|
"$forceUpdate"
|
|
30
|
-
],
|
|
30
|
+
], Tt = [
|
|
31
31
|
"beforeCreate",
|
|
32
32
|
"created",
|
|
33
33
|
"beforeMount",
|
|
@@ -41,7 +41,7 @@ const z = [
|
|
|
41
41
|
"renderTriggered",
|
|
42
42
|
"activated",
|
|
43
43
|
"deactivated"
|
|
44
|
-
],
|
|
44
|
+
], Ie = ["vIf", "vShow", "vModel", "vFor", "vBind"], Re = {
|
|
45
45
|
String,
|
|
46
46
|
Number,
|
|
47
47
|
Boolean,
|
|
@@ -50,45 +50,49 @@ const z = [
|
|
|
50
50
|
Function,
|
|
51
51
|
Date
|
|
52
52
|
};
|
|
53
|
-
function
|
|
54
|
-
return r.map((t) =>
|
|
53
|
+
function H(r, e) {
|
|
54
|
+
return r.map((t) => ue(t) ? t : `${e}${t}`);
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function Z(r) {
|
|
57
57
|
return /\.css$/.test(r);
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function ee(r) {
|
|
60
60
|
return /\.js$/.test(r);
|
|
61
61
|
}
|
|
62
|
-
function
|
|
63
|
-
return r.map(
|
|
62
|
+
function Bt(r) {
|
|
63
|
+
return r.map(
|
|
64
|
+
(e) => `<script src="${b.append(e, { v: F })}"><\/script>`
|
|
65
|
+
).join("");
|
|
64
66
|
}
|
|
65
|
-
function
|
|
66
|
-
return r.map(
|
|
67
|
+
function Nt(r = []) {
|
|
68
|
+
return r.map(
|
|
69
|
+
(e) => `<link rel="stylesheet" href="${b.append(e, { v: F })}" />`
|
|
70
|
+
).join("");
|
|
67
71
|
}
|
|
68
|
-
function
|
|
72
|
+
function Ce(r, e) {
|
|
69
73
|
const t = r.filter((m) => !!m.enabled), s = [], n = [], o = [], i = [], a = {}, l = [], c = {};
|
|
70
74
|
return t.forEach(({ urls: m, assetsUrl: f, library: u, assetsLibrary: h }) => {
|
|
71
75
|
m?.forEach((v) => {
|
|
72
|
-
|
|
73
|
-
}), u && (i.push(u), a[u] =
|
|
76
|
+
ee(v) && s.push(v), Z(v) && n.push(v);
|
|
77
|
+
}), u && (i.push(u), a[u] = H(m || [], e)), f && o.push(f), h && l.push(h), u && h && (c[h] = u);
|
|
74
78
|
}), {
|
|
75
|
-
scripts:
|
|
76
|
-
css:
|
|
77
|
-
materials:
|
|
79
|
+
scripts: H(s, e),
|
|
80
|
+
css: H(n, e),
|
|
81
|
+
materials: H(o, e),
|
|
78
82
|
libraryExports: i,
|
|
79
83
|
materialExports: l,
|
|
80
84
|
materialMapLibrary: c,
|
|
81
85
|
libraryMap: a
|
|
82
86
|
};
|
|
83
87
|
}
|
|
84
|
-
function
|
|
88
|
+
function Oe(r, e) {
|
|
85
89
|
const { name: t, parent: s, alias: n } = r;
|
|
86
90
|
return s ? e[s]?.[n || t] : e[n || t];
|
|
87
91
|
}
|
|
88
|
-
function
|
|
92
|
+
function te(r) {
|
|
89
93
|
return P(r) ? r : JSON.stringify(r);
|
|
90
94
|
}
|
|
91
|
-
function
|
|
95
|
+
function re(r, e, t) {
|
|
92
96
|
const s = r.CSSStyleSheet;
|
|
93
97
|
if (s.prototype.replaceSync) {
|
|
94
98
|
const n = new s();
|
|
@@ -103,34 +107,34 @@ function ee(r, e, t) {
|
|
|
103
107
|
o ? o.innerHTML = t : (o = n.createElement("style"), o.id = e, o.innerHTML = t, n.head.appendChild(o));
|
|
104
108
|
}
|
|
105
109
|
}
|
|
106
|
-
async function
|
|
110
|
+
async function Me(r, e) {
|
|
107
111
|
const t = await window.fetch(e).then((s) => s.text()).catch(() => "");
|
|
108
|
-
t &&
|
|
112
|
+
t && re(window, r, t);
|
|
109
113
|
}
|
|
110
|
-
function
|
|
111
|
-
return
|
|
114
|
+
function Te(r) {
|
|
115
|
+
return U(r) || U(r?.install);
|
|
112
116
|
}
|
|
113
|
-
var
|
|
114
|
-
return
|
|
117
|
+
var C = function() {
|
|
118
|
+
return C = Object.assign || function(r) {
|
|
115
119
|
for (var e, t = 1, s = arguments.length; t < s; t++) {
|
|
116
120
|
e = arguments[t];
|
|
117
121
|
for (var n in e)
|
|
118
122
|
Object.prototype.hasOwnProperty.call(e, n) && (r[n] = e[n]);
|
|
119
123
|
}
|
|
120
124
|
return r;
|
|
121
|
-
},
|
|
122
|
-
},
|
|
125
|
+
}, C.apply(this, arguments);
|
|
126
|
+
}, A = { debug: -1, log: 0, info: 0, warn: 1, error: 2 }, Be = function(r, e, t, s) {
|
|
123
127
|
return function() {
|
|
124
128
|
for (var n = [], o = 0; o < arguments.length; o++)
|
|
125
129
|
n[o] = arguments[o];
|
|
126
|
-
if (e &&
|
|
127
|
-
return console[r].apply(console,
|
|
130
|
+
if (e && A[e] <= A[r] && console[r].apply && (s === "*" || t.startsWith(s)))
|
|
131
|
+
return console[r].apply(console, Ne(n, t));
|
|
128
132
|
};
|
|
129
133
|
};
|
|
130
|
-
function
|
|
134
|
+
function Ne(r, e) {
|
|
131
135
|
return e !== "*" && (typeof r[0] == "string" ? r[0] = "[" + e + "] " + r[0] : r = ["[" + e + "]"].concat(r)), r;
|
|
132
136
|
}
|
|
133
|
-
function
|
|
137
|
+
function ke(r, e) {
|
|
134
138
|
if (!r)
|
|
135
139
|
return {
|
|
136
140
|
targetLevel: e.level,
|
|
@@ -148,26 +152,26 @@ function Be(r, e) {
|
|
|
148
152
|
targetBizName: "*"
|
|
149
153
|
};
|
|
150
154
|
}
|
|
151
|
-
var
|
|
155
|
+
var De = {
|
|
152
156
|
level: "warn",
|
|
153
157
|
bizName: "*"
|
|
154
|
-
},
|
|
158
|
+
}, Ae = (
|
|
155
159
|
/** @class */
|
|
156
160
|
/* @__PURE__ */ function() {
|
|
157
161
|
function r(e) {
|
|
158
|
-
e =
|
|
159
|
-
var t = location || {}, s = (/__(?:logConf|logLevel)__=([^#/&]*)/.exec(t.href) || [])[1], n =
|
|
160
|
-
for (var a in
|
|
161
|
-
this[a] =
|
|
162
|
+
e = C(C({}, De), e);
|
|
163
|
+
var t = location || {}, s = (/__(?:logConf|logLevel)__=([^#/&]*)/.exec(t.href) || [])[1], n = ke(s, e), o = n.targetLevel, i = n.targetBizName;
|
|
164
|
+
for (var a in A)
|
|
165
|
+
this[a] = Be(a, o, e.bizName, i);
|
|
162
166
|
}
|
|
163
167
|
return r;
|
|
164
168
|
}()
|
|
165
169
|
);
|
|
166
|
-
function
|
|
167
|
-
return new
|
|
170
|
+
function Ve(r) {
|
|
171
|
+
return new Ae(r);
|
|
168
172
|
}
|
|
169
|
-
const
|
|
170
|
-
function
|
|
173
|
+
const O = Ve({ level: "log", bizName: "VTJ" });
|
|
174
|
+
function M(r, e, t = !1, s = !1) {
|
|
171
175
|
try {
|
|
172
176
|
const n = ['"use strict";', "var __self = arguments[0];"];
|
|
173
177
|
n.push("return ");
|
|
@@ -177,13 +181,13 @@ function C(r, e, t = !1, s = !1) {
|
|
|
177
181
|
const i = `with(${t ? "{}" : "$scope || {}"}) { ${o} }`;
|
|
178
182
|
return new Function("$scope", i)(e);
|
|
179
183
|
} catch (n) {
|
|
180
|
-
if (
|
|
184
|
+
if (O.error("parseExpression.error", n, r, e?.__self ?? e), s)
|
|
181
185
|
throw n;
|
|
182
186
|
}
|
|
183
187
|
}
|
|
184
|
-
function
|
|
185
|
-
const n =
|
|
186
|
-
if (typeof n != "function" && (
|
|
188
|
+
function Y(r, e, t = !1, s = !1) {
|
|
189
|
+
const n = M(r, e, t, s);
|
|
190
|
+
if (typeof n != "function" && (O.error(
|
|
187
191
|
"parseFunction.error",
|
|
188
192
|
"not a function",
|
|
189
193
|
r,
|
|
@@ -195,17 +199,17 @@ function W(r, e, t = !1, s = !1) {
|
|
|
195
199
|
function _(r) {
|
|
196
200
|
return r && r.type === "JSExpression";
|
|
197
201
|
}
|
|
198
|
-
function
|
|
202
|
+
function N(r) {
|
|
199
203
|
return typeof r == "object" && r && r.type === "JSFunction";
|
|
200
204
|
}
|
|
201
|
-
function
|
|
202
|
-
return _(r) ||
|
|
205
|
+
function Le(r) {
|
|
206
|
+
return _(r) || N(r);
|
|
203
207
|
}
|
|
204
|
-
function
|
|
205
|
-
return
|
|
208
|
+
function kt(r) {
|
|
209
|
+
return Le(r) ? r.value : JSON.stringify(r);
|
|
206
210
|
}
|
|
207
211
|
let j = null;
|
|
208
|
-
const
|
|
212
|
+
const Je = pe({
|
|
209
213
|
settings: {
|
|
210
214
|
type: "form",
|
|
211
215
|
validSuccess: !0,
|
|
@@ -214,12 +218,12 @@ const Ve = le({
|
|
|
214
218
|
validate: (r) => r.data?.code === 0 || !!r.data?.success,
|
|
215
219
|
failMessage: !0,
|
|
216
220
|
showError: (r) => {
|
|
217
|
-
|
|
221
|
+
J.error({
|
|
218
222
|
message: r || "未知错误"
|
|
219
223
|
});
|
|
220
224
|
},
|
|
221
225
|
showLoading: () => {
|
|
222
|
-
j && j.close(), j =
|
|
226
|
+
j && j.close(), j = be.service({
|
|
223
227
|
lock: !0,
|
|
224
228
|
text: "Loading",
|
|
225
229
|
background: "rgba(0, 0, 0, 0.05)"
|
|
@@ -230,7 +234,7 @@ const Ve = le({
|
|
|
230
234
|
}
|
|
231
235
|
}
|
|
232
236
|
});
|
|
233
|
-
function
|
|
237
|
+
function qe(r, e) {
|
|
234
238
|
const { jsonp: t, request: s } = e;
|
|
235
239
|
if (r.method === "jsonp")
|
|
236
240
|
return (n = {}) => t(r.url, {
|
|
@@ -238,7 +242,7 @@ function Le(r, e) {
|
|
|
238
242
|
query: n
|
|
239
243
|
});
|
|
240
244
|
{
|
|
241
|
-
const n = r.headers ?
|
|
245
|
+
const n = r.headers ? M(r.headers, {}, !0) : void 0, o = {
|
|
242
246
|
url: r.url,
|
|
243
247
|
method: r.method,
|
|
244
248
|
settings: {
|
|
@@ -246,13 +250,13 @@ function Le(r, e) {
|
|
|
246
250
|
headers: n
|
|
247
251
|
}
|
|
248
252
|
};
|
|
249
|
-
return (i, a) => s.send(
|
|
253
|
+
return (i, a) => s.send(fe(o, a || {}, { data: i }));
|
|
250
254
|
}
|
|
251
255
|
}
|
|
252
|
-
function
|
|
253
|
-
return r.reduce((t, s) => (t[s.id] =
|
|
256
|
+
function Ue(r = [], e) {
|
|
257
|
+
return r.reduce((t, s) => (t[s.id] = qe(s, e), t), {});
|
|
254
258
|
}
|
|
255
|
-
class
|
|
259
|
+
class ze {
|
|
256
260
|
__id = null;
|
|
257
261
|
__mode;
|
|
258
262
|
__instance = null;
|
|
@@ -280,7 +284,7 @@ class qe {
|
|
|
280
284
|
const { mode: t, dsl: s, attrs: n } = e;
|
|
281
285
|
this.__mode = t, s && (this.__id = s.id || null, this.__transform = s.transform || {}), n && Object.assign(this, n);
|
|
282
286
|
}
|
|
283
|
-
setup(e, t =
|
|
287
|
+
setup(e, t = B) {
|
|
284
288
|
const s = t.getCurrentInstance();
|
|
285
289
|
if (!s)
|
|
286
290
|
return;
|
|
@@ -293,12 +297,12 @@ class qe {
|
|
|
293
297
|
});
|
|
294
298
|
}
|
|
295
299
|
__proxy() {
|
|
296
|
-
this.__instance &&
|
|
300
|
+
this.__instance && K.forEach((e) => {
|
|
297
301
|
this[e] = this.__instance?.[e];
|
|
298
302
|
});
|
|
299
303
|
}
|
|
300
304
|
__cleanup() {
|
|
301
|
-
|
|
305
|
+
K.forEach((e) => {
|
|
302
306
|
this[e] = null;
|
|
303
307
|
});
|
|
304
308
|
}
|
|
@@ -306,17 +310,17 @@ class qe {
|
|
|
306
310
|
if (e)
|
|
307
311
|
if (this.__mode === y.Runtime) {
|
|
308
312
|
const { id: t, type: s } = e, n = t ? this.__transform[t] ?? e.value : e.value;
|
|
309
|
-
return
|
|
313
|
+
return Y({ type: s, value: n }, this);
|
|
310
314
|
} else
|
|
311
|
-
return
|
|
315
|
+
return Y(e, this);
|
|
312
316
|
}
|
|
313
317
|
__parseExpression(e) {
|
|
314
318
|
if (e)
|
|
315
319
|
if (this.__mode === y.Runtime) {
|
|
316
320
|
const { id: t, type: s } = e, n = t ? this.__transform[t] ?? e.value : e.value;
|
|
317
|
-
return
|
|
321
|
+
return M({ type: s, value: n }, this);
|
|
318
322
|
} else
|
|
319
|
-
return
|
|
323
|
+
return M(e, this);
|
|
320
324
|
}
|
|
321
325
|
__ref(e = null, t) {
|
|
322
326
|
if (this.__mode !== y.VNode)
|
|
@@ -347,9 +351,9 @@ class qe {
|
|
|
347
351
|
return s.context.__proto__ = this.context, s.__proto__ = this, s;
|
|
348
352
|
}
|
|
349
353
|
}
|
|
350
|
-
function
|
|
354
|
+
function se(r) {
|
|
351
355
|
const {
|
|
352
|
-
Vue: e =
|
|
356
|
+
Vue: e = B,
|
|
353
357
|
mode: t = y.Runtime,
|
|
354
358
|
components: s = {},
|
|
355
359
|
libs: n = {},
|
|
@@ -359,22 +363,22 @@ function te(r) {
|
|
|
359
363
|
$components: s,
|
|
360
364
|
$libs: n,
|
|
361
365
|
$apis: o
|
|
362
|
-
}, c = new
|
|
366
|
+
}, c = new ze({
|
|
363
367
|
mode: t,
|
|
364
368
|
dsl: a.value,
|
|
365
369
|
attrs: l
|
|
366
370
|
}), m = e.defineComponent({
|
|
367
371
|
name: a.value.name,
|
|
368
372
|
props: {
|
|
369
|
-
...
|
|
373
|
+
...We(a.value.props ?? [], c)
|
|
370
374
|
},
|
|
371
375
|
setup(f) {
|
|
372
|
-
c.$props = f, a.value.id &&
|
|
376
|
+
c.$props = f, a.value.id && re(
|
|
373
377
|
r.window || window,
|
|
374
378
|
a.value.id,
|
|
375
379
|
a.value.css || ""
|
|
376
|
-
), c.state =
|
|
377
|
-
const u =
|
|
380
|
+
), c.state = Ke(e, a.value.state ?? {}, c);
|
|
381
|
+
const u = Ye(e, a.value.computed ?? {}, c), h = Xe(a.value.methods ?? {}, c), v = Ge(e, a.value.inject, c), p = Qe(
|
|
378
382
|
a.value.dataSources || {},
|
|
379
383
|
c
|
|
380
384
|
), w = {
|
|
@@ -383,7 +387,7 @@ function te(r) {
|
|
|
383
387
|
...h,
|
|
384
388
|
...p
|
|
385
389
|
};
|
|
386
|
-
return c.setup(w, e),
|
|
390
|
+
return c.setup(w, e), Ze(e, a.value.watch ?? [], c), {
|
|
387
391
|
vtj: c
|
|
388
392
|
};
|
|
389
393
|
},
|
|
@@ -393,17 +397,17 @@ function te(r) {
|
|
|
393
397
|
if (!a.value.nodes)
|
|
394
398
|
return null;
|
|
395
399
|
const f = a.value.nodes || [];
|
|
396
|
-
return f.length === 1 ?
|
|
400
|
+
return f.length === 1 ? T(f[0], c, e, i) : f.map((u) => T(u, c, e, i));
|
|
397
401
|
},
|
|
398
|
-
...
|
|
402
|
+
...et(a.value.lifeCycles ?? {}, c)
|
|
399
403
|
});
|
|
400
404
|
return {
|
|
401
405
|
renderer: e.markRaw(m),
|
|
402
406
|
context: c
|
|
403
407
|
};
|
|
404
408
|
}
|
|
405
|
-
function
|
|
406
|
-
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((o) =>
|
|
409
|
+
function We(r = [], e) {
|
|
410
|
+
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((o) => Re[o]) : void 0;
|
|
407
411
|
return r.map((s) => P(s) ? {
|
|
408
412
|
name: s
|
|
409
413
|
} : {
|
|
@@ -420,30 +424,30 @@ function Ue(r = [], e) {
|
|
|
420
424
|
{}
|
|
421
425
|
);
|
|
422
426
|
}
|
|
423
|
-
function
|
|
427
|
+
function Ke(r, e, t) {
|
|
424
428
|
return r.reactive(
|
|
425
429
|
Object.keys(e || {}).reduce(
|
|
426
430
|
(s, n) => {
|
|
427
431
|
let o = e[n];
|
|
428
|
-
return _(o) ? o = t.__parseExpression(o) :
|
|
432
|
+
return _(o) ? o = t.__parseExpression(o) : N(o) && (o = t.__parseFunction(o)), s[n] = o, s;
|
|
429
433
|
},
|
|
430
434
|
{}
|
|
431
435
|
)
|
|
432
436
|
);
|
|
433
437
|
}
|
|
434
|
-
function
|
|
438
|
+
function Ye(r, e, t) {
|
|
435
439
|
return Object.entries(e ?? {}).reduce(
|
|
436
440
|
(s, [n, o]) => (s[n] = r.computed(t.__parseFunction(o)), s),
|
|
437
441
|
{}
|
|
438
442
|
);
|
|
439
443
|
}
|
|
440
|
-
function
|
|
444
|
+
function Xe(r, e) {
|
|
441
445
|
return Object.entries(r ?? {}).reduce(
|
|
442
446
|
(t, [s, n]) => (t[s] = e.__parseFunction(n), t),
|
|
443
447
|
{}
|
|
444
448
|
);
|
|
445
449
|
}
|
|
446
|
-
function
|
|
450
|
+
function Ge(r, e = [], t) {
|
|
447
451
|
return e.reduce(
|
|
448
452
|
(s, n) => {
|
|
449
453
|
const { name: o, from: i } = n || {};
|
|
@@ -454,10 +458,10 @@ function Ye(r, e = [], t) {
|
|
|
454
458
|
{}
|
|
455
459
|
);
|
|
456
460
|
}
|
|
457
|
-
function
|
|
461
|
+
function Qe(r, e) {
|
|
458
462
|
return Object.keys(r).reduce(
|
|
459
463
|
(t, s) => {
|
|
460
|
-
const n = r[s], o = e.$apis[n.ref], i =
|
|
464
|
+
const n = r[s], o = e.$apis[n.ref], i = N(n.transform) ? n.transform.value ? e.__parseFunction(n.transform) : void 0 : n.transform;
|
|
461
465
|
return t[s] = async (...a) => {
|
|
462
466
|
const l = await o.apply(e, a);
|
|
463
467
|
return i ? i(l) : l;
|
|
@@ -466,7 +470,7 @@ function Xe(r, e) {
|
|
|
466
470
|
{}
|
|
467
471
|
);
|
|
468
472
|
}
|
|
469
|
-
function
|
|
473
|
+
function Ze(r, e = [], t) {
|
|
470
474
|
e.forEach((s) => {
|
|
471
475
|
r.watch(
|
|
472
476
|
t.__parseExpression(s.source),
|
|
@@ -478,57 +482,57 @@ function Ge(r, e = [], t) {
|
|
|
478
482
|
);
|
|
479
483
|
});
|
|
480
484
|
}
|
|
481
|
-
function
|
|
485
|
+
function et(r, e) {
|
|
482
486
|
return Object.entries(r ?? {}).reduce(
|
|
483
487
|
(t, [s, n]) => (t[s] = e.__parseFunction(n), t),
|
|
484
488
|
{}
|
|
485
489
|
);
|
|
486
490
|
}
|
|
487
|
-
const
|
|
488
|
-
function
|
|
491
|
+
const tt = (r) => r;
|
|
492
|
+
function ne(r) {
|
|
489
493
|
const { getDsl: e, options: t } = r;
|
|
490
|
-
return (s, n, o =
|
|
494
|
+
return (s, n, o = B) => !n || typeof n == "string" ? s : n.type === "Schema" ? o.defineAsyncComponent(async () => {
|
|
491
495
|
const i = await e(n.id);
|
|
492
|
-
return i ?
|
|
496
|
+
return i ? se({
|
|
493
497
|
...t,
|
|
494
498
|
Vue: o,
|
|
495
499
|
dsl: i,
|
|
496
500
|
mode: y.Runtime,
|
|
497
|
-
loader:
|
|
501
|
+
loader: ne(r)
|
|
498
502
|
}).renderer : null;
|
|
499
503
|
}) : s;
|
|
500
504
|
}
|
|
501
|
-
function
|
|
505
|
+
function T(r, e, t = B, s = tt) {
|
|
502
506
|
if (!r || !r.name || r.invisible)
|
|
503
507
|
return null;
|
|
504
|
-
const { id: n = null, directives: o = [] } = r, { vIf: i, vFor: a, vShow: l, vModels: c, vBind: m } =
|
|
505
|
-
if (i && !
|
|
508
|
+
const { id: n = null, directives: o = [] } = r, { vIf: i, vFor: a, vShow: l, vModels: c, vBind: m } = rt(o);
|
|
509
|
+
if (i && !st(i, e))
|
|
506
510
|
return null;
|
|
507
511
|
const f = (u) => {
|
|
508
512
|
const h = u.$components, v = (() => {
|
|
509
513
|
if (r.name === "component")
|
|
510
|
-
return
|
|
514
|
+
return nt(u, r.props?.is);
|
|
511
515
|
if (r.name === "slot")
|
|
512
516
|
return r.name;
|
|
513
517
|
const g = s(r.name, r.from, t);
|
|
514
518
|
return P(g) ? h[g] ?? g : g;
|
|
515
|
-
})(), p =
|
|
519
|
+
})(), p = ot(n, r.props ?? {}, u), w = it(t, r.events ?? {}, u);
|
|
516
520
|
if (r.name === "slot")
|
|
517
|
-
return
|
|
521
|
+
return at(t, r, p, u);
|
|
518
522
|
m && Object.assign(p, u.__parseExpression(m.value)), l && (p.style = Object.assign(
|
|
519
523
|
p.style ?? {},
|
|
520
|
-
|
|
524
|
+
lt(l, u)
|
|
521
525
|
)), c.forEach((g) => {
|
|
522
|
-
Object.assign(p,
|
|
526
|
+
Object.assign(p, ut(t, g, u));
|
|
523
527
|
});
|
|
524
|
-
const S =
|
|
528
|
+
const S = pt(t, r.children ?? [], u, r);
|
|
525
529
|
return t.createVNode(v, { ...p, ...w }, S);
|
|
526
530
|
};
|
|
527
|
-
return a ?
|
|
531
|
+
return a ? dt(a, f, e) : f(e);
|
|
528
532
|
}
|
|
529
|
-
function
|
|
533
|
+
function rt(r = []) {
|
|
530
534
|
const e = r.find((a) => $(a.name) === "vIf"), t = r.find((a) => $(a.name) === "vFor"), s = r.find((a) => $(a.name) === "vShow"), n = r.find((a) => $(a.name) === "vBind"), o = r.filter((a) => $(a.name) === "vModel"), i = r.filter(
|
|
531
|
-
(a) => !
|
|
535
|
+
(a) => !Ie.includes($(a.name))
|
|
532
536
|
);
|
|
533
537
|
return {
|
|
534
538
|
vIf: e,
|
|
@@ -539,86 +543,86 @@ function et(r = []) {
|
|
|
539
543
|
others: i
|
|
540
544
|
};
|
|
541
545
|
}
|
|
542
|
-
function
|
|
546
|
+
function st(r, e) {
|
|
543
547
|
return !!e.__parseExpression(r.value);
|
|
544
548
|
}
|
|
545
|
-
function
|
|
549
|
+
function nt(r, e) {
|
|
546
550
|
return e ? _(e) ? r.__parseExpression(e) : e : "div";
|
|
547
551
|
}
|
|
548
|
-
function
|
|
552
|
+
function ot(r, e, t) {
|
|
549
553
|
const s = Object.keys(e || {}).reduce((n, o) => {
|
|
550
554
|
let i = e[o];
|
|
551
|
-
return _(i) ? i = t.__parseExpression(i) :
|
|
555
|
+
return _(i) ? i = t.__parseExpression(i) : N(i) && (i = t.__parseFunction(i)), n[o] = i, n;
|
|
552
556
|
}, {});
|
|
553
557
|
return s.ref = t.__ref(r, s.ref), s;
|
|
554
558
|
}
|
|
555
|
-
function
|
|
559
|
+
function it(r, e, t) {
|
|
556
560
|
const s = ["passive", "capture", "once"], n = {
|
|
557
561
|
capture: "Capture",
|
|
558
562
|
once: "Once",
|
|
559
563
|
passive: "OnceCapture"
|
|
560
564
|
};
|
|
561
565
|
return Object.keys(e || {}).reduce((o, i) => {
|
|
562
|
-
const a = e[i], l =
|
|
566
|
+
const a = e[i], l = oe(a.modifiers), c = l.find((u) => s.includes(u)), m = "on" + me(i) + (c && n[c] || ""), f = t.__parseFunction(a.handler);
|
|
563
567
|
return f && (o[m] = r.withModifiers(f, l)), o;
|
|
564
568
|
}, {});
|
|
565
569
|
}
|
|
566
|
-
function
|
|
570
|
+
function oe(r = {}, e = !1) {
|
|
567
571
|
const t = Object.keys(r);
|
|
568
572
|
return e ? t.map((s) => "." + s) : t;
|
|
569
573
|
}
|
|
570
|
-
function
|
|
571
|
-
const { children: n } = e, o =
|
|
574
|
+
function at(r, e, t, s) {
|
|
575
|
+
const { children: n } = e, o = ct(e, s), i = s.$slots?.[o.name];
|
|
572
576
|
return i ? i(t) : n ? P(n) ? r.createTextVNode(n) : _(n) ? r.createTextVNode(
|
|
573
|
-
|
|
574
|
-
) : Array.isArray(n) ? n.map((a) =>
|
|
577
|
+
te(s.__parseExpression(n))
|
|
578
|
+
) : Array.isArray(n) ? n.map((a) => T(a, s, r)) : null : null;
|
|
575
579
|
}
|
|
576
|
-
function
|
|
580
|
+
function ct(r, e) {
|
|
577
581
|
const { props: t } = r, s = t?.name || "default";
|
|
578
582
|
return {
|
|
579
583
|
name: _(s) ? e.__parseExpression(s) : s,
|
|
580
584
|
params: []
|
|
581
585
|
};
|
|
582
586
|
}
|
|
583
|
-
function
|
|
587
|
+
function lt(r, e) {
|
|
584
588
|
return e.__parseExpression(r.value) ? {} : {
|
|
585
589
|
display: "none"
|
|
586
590
|
};
|
|
587
591
|
}
|
|
588
|
-
function
|
|
592
|
+
function ut(r, e, t) {
|
|
589
593
|
const s = {
|
|
590
594
|
type: "JSFunction",
|
|
591
595
|
value: e.value?.value ? `(v) => {
|
|
592
596
|
${e.value.value} = v;
|
|
593
597
|
}` : "(v) => {}"
|
|
594
|
-
}, n = t.__parseFunction(s), o =
|
|
598
|
+
}, n = t.__parseFunction(s), o = oe(e.modifiers), i = _(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
|
595
599
|
return {
|
|
596
600
|
[i]: t.__parseExpression(e.value),
|
|
597
601
|
[`onUpdate:${i}`]: o.length && n ? r.withModifiers(n, o) : n
|
|
598
602
|
};
|
|
599
603
|
}
|
|
600
|
-
function
|
|
604
|
+
function pt(r, e, t, s) {
|
|
601
605
|
if (!e)
|
|
602
606
|
return null;
|
|
603
607
|
if (P(e))
|
|
604
608
|
return { default: () => e };
|
|
605
609
|
if (_(e))
|
|
606
610
|
return {
|
|
607
|
-
default: () =>
|
|
611
|
+
default: () => te(t.__parseExpression(e))
|
|
608
612
|
};
|
|
609
613
|
if (Array.isArray(e)) {
|
|
610
|
-
const n =
|
|
614
|
+
const n = ft(e), o = (i) => !i || !s ? {} : s?.id && Object.keys(i).length ? {
|
|
611
615
|
[`scope_${s.id}`]: i
|
|
612
616
|
} : {};
|
|
613
617
|
return Object.entries(n).reduce((i, [a, { nodes: l, params: c }]) => (i[a] = (m) => {
|
|
614
|
-
const f = c.length ?
|
|
618
|
+
const f = c.length ? de(m ?? {}, c) : o(m);
|
|
615
619
|
return l.map(
|
|
616
|
-
(u) =>
|
|
620
|
+
(u) => T(u, t.__clone(f), r)
|
|
617
621
|
);
|
|
618
622
|
}, i), {});
|
|
619
623
|
}
|
|
620
624
|
}
|
|
621
|
-
function
|
|
625
|
+
function ft(r) {
|
|
622
626
|
const e = {
|
|
623
627
|
default: {
|
|
624
628
|
params: [],
|
|
@@ -626,7 +630,7 @@ function ut(r) {
|
|
|
626
630
|
}
|
|
627
631
|
};
|
|
628
632
|
for (const t of r) {
|
|
629
|
-
const s =
|
|
633
|
+
const s = mt(t.slot), n = s.name;
|
|
630
634
|
e[n] ? (e[n].nodes.push(t), e[n].params = e[n].params.concat(s.params)) : e[n] = {
|
|
631
635
|
nodes: [t],
|
|
632
636
|
params: s.params
|
|
@@ -634,19 +638,19 @@ function ut(r) {
|
|
|
634
638
|
}
|
|
635
639
|
return e;
|
|
636
640
|
}
|
|
637
|
-
function
|
|
641
|
+
function mt(r = "default") {
|
|
638
642
|
return P(r) ? { name: r, params: [] } : { params: [], ...r };
|
|
639
643
|
}
|
|
640
|
-
function
|
|
644
|
+
function dt(r, e, t) {
|
|
641
645
|
const { value: s, iterator: n } = r, { item: o = "item", index: i = "index" } = n || {};
|
|
642
646
|
let a = t.__parseExpression(s) || [];
|
|
643
647
|
return Number.isInteger(a) && (a = new Array(a).fill(!0).map((l, c) => c + 1)), Array.isArray(a) ? a.map((l, c) => e(t.__clone({ [o]: l, [i]: c }))) : (console.warn("[vForRender]:", `${s?.value} is not a Arrary`), []);
|
|
644
648
|
}
|
|
645
|
-
const
|
|
649
|
+
const X = L({
|
|
646
650
|
name: "VtjPageContainer",
|
|
647
651
|
async setup() {
|
|
648
|
-
const r =
|
|
649
|
-
return s &&
|
|
652
|
+
const r = ae(), e = Q(), t = e.params.id, s = t ? r.getPage(t) : r.getHomepage(), n = s ? await r.getRenderComponent(s.id) : null;
|
|
653
|
+
return s && xe(s.title || "VTJ"), {
|
|
650
654
|
provider: r,
|
|
651
655
|
component: n,
|
|
652
656
|
file: s,
|
|
@@ -654,9 +658,9 @@ const K = A({
|
|
|
654
658
|
};
|
|
655
659
|
},
|
|
656
660
|
render() {
|
|
657
|
-
return this.component ?
|
|
661
|
+
return this.component ? D(this.component, this.query) : D("div", "页面不存在");
|
|
658
662
|
}
|
|
659
|
-
}),
|
|
663
|
+
}), ht = {
|
|
660
664
|
name: {
|
|
661
665
|
type: String,
|
|
662
666
|
default: "VTJ.PRO"
|
|
@@ -673,30 +677,30 @@ const K = A({
|
|
|
673
677
|
type: String,
|
|
674
678
|
default: "/@vtj/pro/"
|
|
675
679
|
}
|
|
676
|
-
},
|
|
680
|
+
}, vt = { class: "x-startup" }, gt = { class: "x-startup__wrapper" }, _t = { class: "x-startup__name" }, yt = { class: "clip" }, wt = { class: "x-startup__tagline" }, St = { class: "x-startup__actions" }, $t = /* @__PURE__ */ L({
|
|
677
681
|
__name: "Startup",
|
|
678
|
-
props:
|
|
682
|
+
props: ht,
|
|
679
683
|
setup(r) {
|
|
680
684
|
const e = r, t = () => {
|
|
681
685
|
let s = (window.__VTJ_LINK__ || {}).href || window.location.pathname + "@vtj/pro/#/";
|
|
682
686
|
location.href = s;
|
|
683
687
|
};
|
|
684
|
-
return (s, n) => (
|
|
685
|
-
E("div",
|
|
686
|
-
E("div",
|
|
687
|
-
E("span",
|
|
688
|
+
return (s, n) => (_e(), ye("div", vt, [
|
|
689
|
+
E("div", gt, [
|
|
690
|
+
E("div", _t, [
|
|
691
|
+
E("span", yt, k(e.name), 1)
|
|
688
692
|
]),
|
|
689
|
-
E("div",
|
|
690
|
-
E("div",
|
|
691
|
-
|
|
693
|
+
E("div", wt, k(e.tagline), 1),
|
|
694
|
+
E("div", St, [
|
|
695
|
+
we(W(Fe), {
|
|
692
696
|
type: "primary",
|
|
693
697
|
size: "large",
|
|
694
698
|
round: "",
|
|
695
|
-
icon:
|
|
699
|
+
icon: W(He),
|
|
696
700
|
onClick: t
|
|
697
701
|
}, {
|
|
698
|
-
default:
|
|
699
|
-
|
|
702
|
+
default: Se(() => [
|
|
703
|
+
$e(k(e.actionText), 1)
|
|
700
704
|
]),
|
|
701
705
|
_: 1
|
|
702
706
|
}, 8, ["icon"])
|
|
@@ -704,17 +708,17 @@ const K = A({
|
|
|
704
708
|
])
|
|
705
709
|
]));
|
|
706
710
|
}
|
|
707
|
-
}),
|
|
711
|
+
}), jt = L({
|
|
708
712
|
name: "VtjStartupContainer",
|
|
709
713
|
render() {
|
|
710
|
-
return
|
|
714
|
+
return D($t);
|
|
711
715
|
}
|
|
712
|
-
}),
|
|
713
|
-
class
|
|
716
|
+
}), ie = Symbol("Provider");
|
|
717
|
+
class Pt extends le {
|
|
714
718
|
mode;
|
|
715
719
|
globals = {};
|
|
716
720
|
modules = {};
|
|
717
|
-
adapter = { request:
|
|
721
|
+
adapter = { request: Je, jsonp: he };
|
|
718
722
|
apis = {};
|
|
719
723
|
dependencies = {};
|
|
720
724
|
materials = {};
|
|
@@ -750,7 +754,7 @@ class $t extends ae {
|
|
|
750
754
|
materials: f,
|
|
751
755
|
materialExports: u,
|
|
752
756
|
materialMapLibrary: h
|
|
753
|
-
} =
|
|
757
|
+
} = Ce(s, l);
|
|
754
758
|
for (const p of c) {
|
|
755
759
|
const w = o[p], S = window[p];
|
|
756
760
|
if (S)
|
|
@@ -759,38 +763,38 @@ class $t extends ae {
|
|
|
759
763
|
window[p] = i[p] = await w();
|
|
760
764
|
else {
|
|
761
765
|
const g = m[p] || [];
|
|
762
|
-
for (const
|
|
763
|
-
|
|
766
|
+
for (const x of g)
|
|
767
|
+
Z(x) && await Me(p, b.append(x, { v: F })), ee(x) && await z(b.append(x, { v: F })), i[p] = window[p];
|
|
764
768
|
}
|
|
765
769
|
}
|
|
766
770
|
for (const p of f)
|
|
767
|
-
await
|
|
771
|
+
await z(b.append(p, { v: F }));
|
|
768
772
|
const v = this.materials || {};
|
|
769
773
|
for (const p of u) {
|
|
770
774
|
const w = v[p] ? (await v[p]()).default : window[p], S = window[h[p]];
|
|
771
775
|
w && S && w.components.forEach((g) => {
|
|
772
|
-
a[g.name] =
|
|
776
|
+
a[g.name] = Oe(g, S);
|
|
773
777
|
});
|
|
774
778
|
}
|
|
775
|
-
n && (this.apis =
|
|
779
|
+
n && (this.apis = Ue(n, this.adapter)), this.initRouter(), this.triggerReady();
|
|
776
780
|
}
|
|
777
781
|
initRouter() {
|
|
778
782
|
const { router: e, project: t } = this;
|
|
779
783
|
e && (e.addRoute({
|
|
780
784
|
path: "/page/:id",
|
|
781
785
|
name: "VtjPage",
|
|
782
|
-
component:
|
|
786
|
+
component: X
|
|
783
787
|
}), e.addRoute({
|
|
784
788
|
path: "/",
|
|
785
789
|
name: "VtjHomepage",
|
|
786
|
-
component: t?.homepage ?
|
|
790
|
+
component: t?.homepage ? X : jt
|
|
787
791
|
}));
|
|
788
792
|
}
|
|
789
793
|
install(e) {
|
|
790
794
|
const t = e.config.globalProperties.installed || {};
|
|
791
795
|
for (const [s, n] of Object.entries(this.library))
|
|
792
|
-
!t[s] &&
|
|
793
|
-
e.provide(
|
|
796
|
+
!t[s] && Te(n) && (e.use(n), t[s] = !0);
|
|
797
|
+
e.provide(ie, this), e.config.globalProperties.installed = t;
|
|
794
798
|
}
|
|
795
799
|
getFile(e) {
|
|
796
800
|
const { blocks: t = [] } = this.project || {};
|
|
@@ -821,13 +825,13 @@ class $t extends ae {
|
|
|
821
825
|
async getRenderComponent(e) {
|
|
822
826
|
const t = this.getFile(e);
|
|
823
827
|
if (!t)
|
|
824
|
-
return
|
|
828
|
+
return O.warn(`Can not find file: ${e}`), null;
|
|
825
829
|
const s = `.vtj/vue/${e}.vue`, n = this.modules[s];
|
|
826
830
|
if (n)
|
|
827
831
|
return (await n())?.default;
|
|
828
832
|
const o = await this.getDsl(t.id);
|
|
829
833
|
if (!o)
|
|
830
|
-
return
|
|
834
|
+
return O.warn(`Can not find dsl: ${e}`), null;
|
|
831
835
|
const { library: i, components: a, mode: l, apis: c } = this, m = {
|
|
832
836
|
mode: l,
|
|
833
837
|
Vue: i.Vue,
|
|
@@ -835,10 +839,10 @@ class $t extends ae {
|
|
|
835
839
|
libs: i,
|
|
836
840
|
apis: c,
|
|
837
841
|
window
|
|
838
|
-
}, f =
|
|
842
|
+
}, f = ne({
|
|
839
843
|
getDsl: async (h) => await this.getDsl(h) || null,
|
|
840
844
|
options: m
|
|
841
|
-
}), { renderer: u } =
|
|
845
|
+
}), { renderer: u } = se({
|
|
842
846
|
...m,
|
|
843
847
|
dsl: o,
|
|
844
848
|
loader: f
|
|
@@ -846,22 +850,22 @@ class $t extends ae {
|
|
|
846
850
|
return u;
|
|
847
851
|
}
|
|
848
852
|
}
|
|
849
|
-
function
|
|
850
|
-
const e = new
|
|
853
|
+
function Dt(r) {
|
|
854
|
+
const e = new Pt(r);
|
|
851
855
|
return {
|
|
852
856
|
provider: e,
|
|
853
857
|
onReady: (s) => e.ready(s)
|
|
854
858
|
};
|
|
855
859
|
}
|
|
856
|
-
function
|
|
857
|
-
const e =
|
|
860
|
+
function ae(r = {}) {
|
|
861
|
+
const e = je(ie);
|
|
858
862
|
if (!e)
|
|
859
863
|
throw new Error("Can not find provider");
|
|
860
864
|
if (e.mode === y.Raw) {
|
|
861
865
|
const { id: t, version: s } = r;
|
|
862
866
|
t && s && (async () => {
|
|
863
867
|
const n = await e.getDsl(t);
|
|
864
|
-
n?.__VERSION__ !== s &&
|
|
868
|
+
n?.__VERSION__ !== s && J.warning({
|
|
865
869
|
title: n?.name,
|
|
866
870
|
message: "当前组件源码版本与运行时版本不一致,请重新发布组件"
|
|
867
871
|
});
|
|
@@ -869,7 +873,7 @@ function oe(r = {}) {
|
|
|
869
873
|
}
|
|
870
874
|
return e;
|
|
871
875
|
}
|
|
872
|
-
const
|
|
876
|
+
const Et = new ve({
|
|
873
877
|
settings: {
|
|
874
878
|
type: "json",
|
|
875
879
|
validSuccess: !0,
|
|
@@ -877,12 +881,12 @@ const jt = new de({
|
|
|
877
881
|
failMessage: !0,
|
|
878
882
|
validate: (r) => r.data?.code === 0,
|
|
879
883
|
showError: (r) => {
|
|
880
|
-
|
|
884
|
+
J.error({
|
|
881
885
|
message: r || "未知错误"
|
|
882
886
|
});
|
|
883
887
|
}
|
|
884
888
|
}
|
|
885
|
-
}),
|
|
889
|
+
}), bt = (r = "/vtj/local/repository/${type}.json") => (e, t) => Et.send({
|
|
886
890
|
url: r,
|
|
887
891
|
method: "post",
|
|
888
892
|
query: { type: e },
|
|
@@ -891,10 +895,10 @@ const jt = new de({
|
|
|
891
895
|
data: t
|
|
892
896
|
}
|
|
893
897
|
});
|
|
894
|
-
class
|
|
898
|
+
class q {
|
|
895
899
|
api;
|
|
896
900
|
constructor() {
|
|
897
|
-
this.api =
|
|
901
|
+
this.api = bt();
|
|
898
902
|
}
|
|
899
903
|
async init(e) {
|
|
900
904
|
return console.log("BaseService.init", e), {};
|
|
@@ -950,22 +954,22 @@ class L {
|
|
|
950
954
|
return await this.api("removeRawPage", e).catch(() => "");
|
|
951
955
|
}
|
|
952
956
|
}
|
|
953
|
-
const d = new
|
|
957
|
+
const d = new ge({
|
|
954
958
|
type: "local",
|
|
955
959
|
expired: 0,
|
|
956
960
|
prefix: "__VTJ_"
|
|
957
961
|
});
|
|
958
|
-
class
|
|
962
|
+
class At extends q {
|
|
959
963
|
init(e) {
|
|
960
|
-
const t = new
|
|
964
|
+
const t = new R(e), s = d.get(`project_${t.id}`), n = Object.assign(t.toDsl(), s || {});
|
|
961
965
|
return d.save(`project_${t.id}`, n), Promise.resolve(n);
|
|
962
966
|
}
|
|
963
967
|
saveProject(e) {
|
|
964
|
-
const t = new
|
|
968
|
+
const t = new R(e);
|
|
965
969
|
return d.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
|
|
966
970
|
}
|
|
967
971
|
saveMaterials(e, t) {
|
|
968
|
-
return d.save(`materials_${e.id}`,
|
|
972
|
+
return d.save(`materials_${e.id}`, V(t)), Promise.resolve(!0);
|
|
969
973
|
}
|
|
970
974
|
saveFile(e) {
|
|
971
975
|
return d.save(`file_${e.id}`, e), Promise.resolve(!0);
|
|
@@ -989,7 +993,7 @@ class Dt extends L {
|
|
|
989
993
|
return Promise.resolve(!0);
|
|
990
994
|
}
|
|
991
995
|
getHistory(e) {
|
|
992
|
-
const t = d.get(`history_${e}`), s = new
|
|
996
|
+
const t = d.get(`history_${e}`), s = new G(t || { id: e });
|
|
993
997
|
return Promise.resolve(s.toDsl());
|
|
994
998
|
}
|
|
995
999
|
getHistoryItem(e, t) {
|
|
@@ -1005,22 +1009,22 @@ class Dt extends L {
|
|
|
1005
1009
|
}), Promise.resolve(!0);
|
|
1006
1010
|
}
|
|
1007
1011
|
}
|
|
1008
|
-
class
|
|
1012
|
+
class Ft extends q {
|
|
1009
1013
|
projects = {};
|
|
1010
1014
|
materials = {};
|
|
1011
1015
|
files = {};
|
|
1012
1016
|
histories = {};
|
|
1013
1017
|
historyItems = {};
|
|
1014
1018
|
init(e) {
|
|
1015
|
-
const t = new
|
|
1019
|
+
const t = new R(e), s = this.projects[t.id] || {}, n = Object.assign(t.toDsl(), s);
|
|
1016
1020
|
return this.projects[n.id] = n, Promise.resolve(n);
|
|
1017
1021
|
}
|
|
1018
1022
|
saveProject(e) {
|
|
1019
|
-
const t = new
|
|
1023
|
+
const t = new R(e);
|
|
1020
1024
|
return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
|
|
1021
1025
|
}
|
|
1022
1026
|
saveMaterials(e, t) {
|
|
1023
|
-
return e.id && (this.materials[e.id] =
|
|
1027
|
+
return e.id && (this.materials[e.id] = V(t)), Promise.resolve(!0);
|
|
1024
1028
|
}
|
|
1025
1029
|
saveFile(e) {
|
|
1026
1030
|
return this.files[e.id] = e, Promise.resolve(!0);
|
|
@@ -1044,7 +1048,7 @@ class Et extends L {
|
|
|
1044
1048
|
return Promise.resolve(!0);
|
|
1045
1049
|
}
|
|
1046
1050
|
getHistory(e) {
|
|
1047
|
-
const t = this.histories[e], s = new
|
|
1051
|
+
const t = this.histories[e], s = new G(t || { id: e });
|
|
1048
1052
|
return Promise.resolve(s);
|
|
1049
1053
|
}
|
|
1050
1054
|
getHistoryItem(e, t) {
|
|
@@ -1062,11 +1066,11 @@ class Et extends L {
|
|
|
1062
1066
|
}), Promise.resolve(!0);
|
|
1063
1067
|
}
|
|
1064
1068
|
}
|
|
1065
|
-
let
|
|
1066
|
-
function
|
|
1067
|
-
return
|
|
1069
|
+
let I = null;
|
|
1070
|
+
function Vt() {
|
|
1071
|
+
return I || (I = new Ft(), I);
|
|
1068
1072
|
}
|
|
1069
|
-
class
|
|
1073
|
+
class Lt extends q {
|
|
1070
1074
|
async init(e) {
|
|
1071
1075
|
return await this.api("init", e).catch(() => null) || {};
|
|
1072
1076
|
}
|
|
@@ -1076,7 +1080,7 @@ class Vt extends L {
|
|
|
1076
1080
|
async saveMaterials(e, t) {
|
|
1077
1081
|
return !!await this.api("saveMaterials", {
|
|
1078
1082
|
project: e,
|
|
1079
|
-
materials:
|
|
1083
|
+
materials: V(t)
|
|
1080
1084
|
}).catch(() => !1);
|
|
1081
1085
|
}
|
|
1082
1086
|
async saveFile(e) {
|
|
@@ -1111,7 +1115,7 @@ class Vt extends L {
|
|
|
1111
1115
|
);
|
|
1112
1116
|
}
|
|
1113
1117
|
}
|
|
1114
|
-
function
|
|
1118
|
+
function ce(r = []) {
|
|
1115
1119
|
return r.map((e) => {
|
|
1116
1120
|
const { id: t, title: s, icon: n, children: o, hidden: i } = e;
|
|
1117
1121
|
return {
|
|
@@ -1120,13 +1124,13 @@ function ie(r = []) {
|
|
|
1120
1124
|
icon: n,
|
|
1121
1125
|
hidden: i,
|
|
1122
1126
|
url: `/page/${t}`,
|
|
1123
|
-
children: o && o.length ?
|
|
1127
|
+
children: o && o.length ? ce(o) : void 0
|
|
1124
1128
|
};
|
|
1125
1129
|
});
|
|
1126
1130
|
}
|
|
1127
|
-
function
|
|
1128
|
-
const r =
|
|
1129
|
-
|
|
1131
|
+
function Jt() {
|
|
1132
|
+
const r = ae(), e = Q(), t = Pe(!1), s = r.project;
|
|
1133
|
+
Ee(() => {
|
|
1130
1134
|
const { name: o, params: i, meta: a } = e;
|
|
1131
1135
|
if (o === "VtjPage") {
|
|
1132
1136
|
const l = r.getPage(i.id);
|
|
@@ -1137,7 +1141,7 @@ function Lt() {
|
|
|
1137
1141
|
} else
|
|
1138
1142
|
t.value = !a.mask;
|
|
1139
1143
|
});
|
|
1140
|
-
const n =
|
|
1144
|
+
const n = ce(s?.pages);
|
|
1141
1145
|
return {
|
|
1142
1146
|
disabled: t,
|
|
1143
1147
|
title: s?.description || s?.name || "VTJ App",
|
|
@@ -1145,49 +1149,49 @@ function Lt() {
|
|
|
1145
1149
|
};
|
|
1146
1150
|
}
|
|
1147
1151
|
export {
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
+
Ie as BUILDIN_DIRECTIVES,
|
|
1153
|
+
q as BaseService,
|
|
1154
|
+
K as CONTEXT_HOST,
|
|
1155
|
+
ze as Context,
|
|
1152
1156
|
y as ContextMode,
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1157
|
+
Re as DATA_TYPES,
|
|
1158
|
+
kt as JSCodeToString,
|
|
1159
|
+
Tt as LIFE_CYCLES_LIST,
|
|
1160
|
+
Lt as LocalService,
|
|
1161
|
+
Ae as Logger,
|
|
1162
|
+
Ft as MemoryService,
|
|
1163
|
+
Pt as Provider,
|
|
1164
|
+
At as StorageService,
|
|
1165
|
+
F as VTJ_RENDERER_VERSION,
|
|
1166
|
+
re as adoptedStyleSheets,
|
|
1167
|
+
Bt as createAssetScripts,
|
|
1168
|
+
Nt as createAssetsCss,
|
|
1169
|
+
Qe as createDataSources,
|
|
1170
|
+
ne as createLoader,
|
|
1171
|
+
Vt as createMemoryService,
|
|
1172
|
+
Dt as createProvider,
|
|
1173
|
+
se as createRenderer,
|
|
1174
|
+
qe as createSchemaApi,
|
|
1175
|
+
Ue as createSchemaApis,
|
|
1176
|
+
tt as defaultLoader,
|
|
1177
|
+
H as fillBasePath,
|
|
1178
|
+
Ve as getLogger,
|
|
1179
|
+
oe as getModifiers,
|
|
1180
|
+
Oe as getRawComponent,
|
|
1181
|
+
Z as isCSSUrl,
|
|
1182
|
+
Le as isJSCode,
|
|
1179
1183
|
_ as isJSExpression,
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1184
|
+
N as isJSFunction,
|
|
1185
|
+
ee as isJSUrl,
|
|
1186
|
+
Te as isVuePlugin,
|
|
1187
|
+
Me as loadCss,
|
|
1188
|
+
O as logger,
|
|
1189
|
+
T as nodeRender,
|
|
1190
|
+
Ce as parseDeps,
|
|
1191
|
+
M as parseExpression,
|
|
1192
|
+
Y as parseFunction,
|
|
1193
|
+
ie as providerKey,
|
|
1194
|
+
te as toString,
|
|
1195
|
+
Jt as useMask,
|
|
1196
|
+
ae as useProvider
|
|
1193
1197
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vtj/renderer",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.7",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "vue-tsc && vite build",
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
"coverage": "vitest run --coverage"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@vtj/core": "^0.7.
|
|
14
|
-
"@vtj/icons": "^0.7.
|
|
15
|
-
"@vtj/ui": "^0.7.
|
|
16
|
-
"@vtj/utils": "^0.7.
|
|
13
|
+
"@vtj/core": "^0.7.7",
|
|
14
|
+
"@vtj/icons": "^0.7.7",
|
|
15
|
+
"@vtj/ui": "^0.7.7",
|
|
16
|
+
"@vtj/utils": "^0.7.7",
|
|
17
17
|
"zen-logger": "~1.1.4"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@vtj/cli": "^0.7.
|
|
20
|
+
"@vtj/cli": "^0.7.5",
|
|
21
21
|
"vue": "~3.4.15",
|
|
22
22
|
"vue-router": "~4.2.5"
|
|
23
23
|
},
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dist",
|
|
36
36
|
"types"
|
|
37
37
|
],
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "d60eaf7f78872c997d62456f4b565d7d656a2f80",
|
|
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.7.
|
|
5
|
+
* @version 0.7.6
|
|
6
6
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
7
7
|
*/
|
|
8
|
-
export declare const version = "0.7.
|
|
8
|
+
export declare const version = "0.7.6";
|