@vtj/renderer 0.7.31 → 0.7.33
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 +253 -303
- package/package.json +6 -6
- package/types/version.d.ts +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("@vtj/core"),l=require("@vtj/utils"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("@vtj/core"),l=require("@vtj/utils"),j=require("vue"),z=require("vue-router"),O=require("element-plus"),T=require("mockjs"),me=require("@vueuse/core"),he=require("@vtj/ui");function ve(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 x=ve(j);/**!
|
|
2
2
|
* Copyright (c) 2024, VTJ.PRO All rights reserved.
|
|
3
3
|
* @name @vtj/renderer
|
|
4
4
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
5
|
-
* @version 0.7.
|
|
5
|
+
* @version 0.7.33
|
|
6
6
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
7
|
-
*/const C="0.7.
|
|
8
|
-
`)+o;const i=`with(${t?"{}":"$scope || {}"}) { ${o} }`;return new Function("$scope",i)(e)}catch(n){if(l.logger.error("parseExpression.error",n,r,e?.__self??e),s)throw n}}function
|
|
7
|
+
*/const C="0.7.33";var w=(r=>(r.Runtime="Runtime",r.Design="Design",r.Raw="Raw",r.VNode="VNode",r))(w||{});const A=["$el","$emit","$nextTick","$parent","$root","$attrs","$slots","$watch","$props","$options","$forceUpdate"],ge=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeUnmount","unmounted","errorCaptured","renderTracked","renderTriggered","activated","deactivated"],G=["vIf","vShow","vModel","vFor","vBind"],Q={String,Number,Boolean,Array,Object,Function,Date};function I(r,e){return r.map(t=>l.isUrl(t)?t:`${e}${t}`)}function N(r){return/\.css$/.test(r)}function B(r){return/\.js$/.test(r)}function _e(r){return r.map(e=>`<script src="${l.url.append(e,{v:C})}"><\/script>`).join("")}function ye(r=[]){return r.map(e=>`<link rel="stylesheet" href="${l.url.append(e,{v:C})}" />`).join("")}function Z(r,e){const t=r.filter(m=>!!m.enabled),s=[],n=[],o=[],i=[],a={},u=[],c={};return t.forEach(({urls:m,assetsUrl:d,library:p,assetsLibrary:g})=>{m?.forEach(y=>{B(y)&&s.push(y),N(y)&&n.push(y)}),p&&(i.push(p),a[p]=I(m||[],e)),d&&o.push(d),g&&u.push(g),p&&g&&(c[g]=p)}),{scripts:I(s,e),css:I(n,e),materials:I(o,e),libraryExports:i,materialExports:l.dedupArray(u),materialMapLibrary:c,libraryMap:a}}function ee(r,e){const{name:t,parent:s,alias:n}=r;return s?e[s]?.[n||t]:e[n||t]}function q(r){return l.isString(r)?r:JSON.stringify(r)}function L(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(u=>u.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 te(r,e){const t=await window.fetch(e).then(s=>s.text()).catch(()=>"");t&&L(window,r,t)}function re(r){return l.isFunction(r)||l.isFunction(r?.install)}function F(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,u)=>`__self${u}`),o=n.join(`
|
|
8
|
+
`)+o;const i=`with(${t?"{}":"$scope || {}"}) { ${o} }`;return new Function("$scope",i)(e)}catch(n){if(l.logger.error("parseExpression.error",n,r,e?.__self??e),s)throw n}}function D(r,e,t=!1,s=!1){const n=F(r,e,t,s);if(typeof n!="function"&&(l.logger.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 se(r){return _(r)||H(r)}function Se(r){return se(r)?r.value:JSON.stringify(r)}let b=null;const we=l.createRequest({settings:{type:"form",validSuccess:!0,originResponse:!1,loading:!0,validate:r=>r.data?.code===0||!!r.data?.success,failMessage:!0,showError:r=>{O.ElNotification.error({message:r||"未知错误"})},showLoading:()=>{b&&b.close(),b=O.ElLoading.service({lock:!0,text:"Loading",background:"rgba(0, 0, 0, 0.05)"})},hideLoading:()=>{b&&(b.close(),b=null)}}});function ne(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?F(r.headers,{},!0):void 0,o={url:r.url,method:r.method,settings:{...r.settings,headers:n}};return(i,a)=>s.send(l.merge(o,a||{},{data:i}))}}function oe(r=[],e){return r.reduce((t,s)=>(t[s.id]=ne(s,e),t),{})}function ie(r=[]){T.setup({timeout:"50-500"}),J(),r.forEach(e=>ae(e))}function ae(r){if(!r.mock)return;const{url:e,mockTemplate:t}=r;if(e&&t){const s=l.pathToRegexp(`${e}(.*)`),n=l.pathToRegexpMatch(e,{decode:decodeURIComponent}),o=F(t,{},!0);T.mock(s,i=>{const a=l.url.parse(i.url)||{},u=i.body instanceof FormData?l.formDataToJson(i.body):i.body,c=n(i.url)?.params;return Object.assign(i,{data:u,params:a,query:c}),T.mock(o(i))})}}function J(){T._mocked={}}class ce{__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=x){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&&A.forEach(e=>{this[e]=this.__instance?.[e]})}__cleanup(){A.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 D({type:s,value:n},this)}else return D(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 F({type:s,value:n},this)}else return F(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 V(r){const{Vue:e=x,mode:t=w.Runtime,components:s={},libs:n={},apis:o={},loader:i}=r,a=e.computed(()=>r.dsl),u={$components:s,$libs:n,$apis:o},c=new ce({mode:t,dsl:a.value,attrs:u}),m=e.defineComponent({name:a.value.name,props:{...je(a.value.props??[],c)},setup(d){c.$props=d,a.value.id&&L(r.window||window,a.value.id,a.value.css||""),c.state=$e(e,a.value.state??{},c);const p=Ee(e,a.value.computed??{},c),g=Pe(a.value.methods??{},c),y=be(e,a.value.inject,c),f=le(a.value.dataSources||{},c),S={...y,...p,...g,...f};return c.setup(S,e),Ce(e,a.value.watch??[],c),{vtj:c}},emits:[...a.value.emits??[]],expose:["vtj"],render(){if(!a.value.nodes)return null;const d=a.value.nodes||[];return d.length===1?R(d[0],c,e,i):d.map(p=>R(p,c,e,i))},...Fe(a.value.lifeCycles??{},c)});return{renderer:e.markRaw(m),context:c}}function je(r=[],e){const t=s=>s?(Array.isArray(s)?s:[s]).map(o=>Q[o]):void 0;return r.map(s=>l.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 $e(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 Ee(r,e,t){return Object.entries(e??{}).reduce((s,[n,o])=>(s[n]=r.computed(t.__parseFunction(o)),s),{})}function Pe(r,e){return Object.entries(r??{}).reduce((t,[s,n])=>(t[s]=e.__parseFunction(n),t),{})}function be(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,u=_(n.default)?t.__parseExpression(n.default):n.default??null;return s[o]=r.inject(a,u),s},{})}function le(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 u=await o.apply(e,a);return i?i(u):u},t},{})}function Ce(r,e=[],t){e.forEach(s=>{r.watch(t.__parseExpression(s.source),t.__parseFunction(s.handler),{deep:s.deep,immediate:s.immediate})})}function Fe(r,e){return Object.entries(r??{}).reduce((t,[s,n])=>(t[s]=e.__parseFunction(n),t),{})}const ue=r=>r;function U(r){const{getDsl:e,options:t}=r;return(s,n,o=x)=>!n||typeof n=="string"?s:n.type==="Schema"?o.defineAsyncComponent(async()=>{const i=await e(n.id);return i?V({...t,Vue:o,dsl:i,mode:w.Runtime,loader:U(r)}).renderer:null}):s}function R(r,e,t=x,s=ue){if(!r||!r.name||r.invisible)return null;const{id:n=null,directives:o=[]}=r,{vIf:i,vFor:a,vShow:u,vModels:c,vBind:m}=Ie(o);if(i&&!Re(i,e))return null;const d=p=>{const g=p.$components,y=(()=>{if(r.name==="component")return He(p,r.props?.is);if(r.name==="slot")return r.name;const h=s(r.name,r.from,t);return l.isString(h)?g[h]??h:h})(),f=Me(n,r.props??{},p),S=Oe(t,r.events??{},p);if(r.name==="slot")return Te(t,r,f,p);m&&Object.assign(f,p.__parseExpression(m.value)),u&&(f.style=Object.assign(f.style??{},ke(u,p))),c.forEach(h=>{Object.assign(f,Ae(t,h,p))});const E=De(t,r.children??[],p,r);return t.createVNode(y,{...f,...S},E)};return a?qe(a,d,e):d(e)}function Ie(r=[]){const e=r.find(a=>l.camelCase(a.name)==="vIf"),t=r.find(a=>l.camelCase(a.name)==="vFor"),s=r.find(a=>l.camelCase(a.name)==="vShow"),n=r.find(a=>l.camelCase(a.name)==="vBind"),o=r.filter(a=>l.camelCase(a.name)==="vModel"),i=r.filter(a=>!G.includes(l.camelCase(a.name)));return{vIf:e,vFor:t,vShow:s,vModels:o,vBind:n,others:i}}function Re(r,e){return!!e.__parseExpression(r.value)}function He(r,e){return e?_(e)?r.__parseExpression(e):e:"div"}function Me(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 Oe(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],u=Y(a.modifiers),c=u.find(p=>s.includes(p)),m="on"+l.upperFirst(i)+(c&&n[c]||""),d=t.__parseFunction(a.handler);return d&&(o[m]=r.withModifiers(d,u)),o},{})}function Y(r={},e=!1){const t=Object.keys(r);return e?t.map(s=>"."+s):t}function Te(r,e,t,s){const{children:n}=e,o=xe(e,s),i=s.$slots?.[o.name];return i?i(t):n?l.isString(n)?r.createTextVNode(n):_(n)?r.createTextVNode(q(s.__parseExpression(n))):Array.isArray(n)?n.map(a=>R(a,s,r)):null:null}function xe(r,e){const{props:t}=r,s=t?.name||"default";return{name:_(s)?e.__parseExpression(s):s,params:[]}}function ke(r,e){return e.__parseExpression(r.value)?{}:{display:"none"}}function Ae(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=Y(e.modifiers),i=y(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 Ae(r,e,t,s){if(!e)return null;if(l.isString(e))return{default:()=>e};if(y(e))return{default:()=>B(t.__parseExpression(e))};if(Array.isArray(e)&&e.length>0){const n=De(e),o=i=>!i||!s?{}:s?.id&&Object.keys(i).length?{[`scope_${s.id}`]:i}:{};return Object.entries(n).reduce((i,[a,{nodes:u,params:c}])=>(i[a]=h=>{const m=c.length?l.pick(h??{},c):o(h);return u.map(p=>T(p,t.__clone(m),r))},i),{})}return null}function De(r){const e={default:{params:[],nodes:[]}};for(const t of r){const s=Ve(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 Ve(r="default"){return l.isString(r)?{name:r,params:[]}:{params:[],...r}}function Be(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((u,c)=>c+1)),Array.isArray(a)?a.map((u,c)=>e(t.__clone({[o]:u,[i]:c}))):(console.warn("[vForRender]:",`${s?.value} is not a Arrary`),[])}const W=f.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?f.h(this.component,this.query):f.h("div","页面不存在")}}),qe={name:{type:String,default:"VTJ.PRO"},tagline:{type:String,default:"基于 Vue3 + TypeScript 快速打造高生产力的低代码研发平台"},actionText:{type:String,default:"开始设计"},actionLink:{type:String,default:"/@vtj/pro/"}},Le={class:"x-startup"},Je={class:"x-startup__wrapper"},Ue={class:"x-startup__name"},Ye={class:"clip"},ze={class:"x-startup__tagline"},Ke={class:"x-startup__actions"},We=f.defineComponent({__name:"Startup",props:qe,setup(r){const e=r,t=()=>{if(typeof window<"u"){let s=(window.__VTJ_LINK__||{}).href||window.location.pathname+"@vtj/pro/#/";window.location.href=s}};return(s,n)=>(f.openBlock(),f.createElementBlock("div",Le,[f.createElementVNode("div",Je,[f.createElementVNode("div",Ue,[f.createElementVNode("span",Ye,f.toDisplayString(e.name),1)]),f.createElementVNode("div",ze,f.toDisplayString(e.tagline),1),f.createElementVNode("div",Ke,[f.createVNode(f.unref(R.ElButton),{type:"primary",size:"large",round:"",icon:f.unref(he.EditPen),onClick:t},{default:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(e.actionText),1)]),_:1},8,["icon"])])])]))}}),Xe=f.defineComponent({name:"VtjStartupContainer",render(){return f.h(We)}}),z=Symbol("Provider");class pe extends $.Base{mode;globals={};modules={};adapter={request:we,jsonp:l.jsonp};apis={};dependencies={};materials={};library={};service;project=null;components={};nodeEnv="development";router=null;materialPath="./";constructor(e){super();const{service:t,mode:s=j.Raw,dependencies:n,materials:o,project:i={},adapter:a={},globals:u={},modules:c={},router:h=null,materialPath:m="./",nodeEnv:p="development"}=e;this.mode=s,this.modules=c,this.service=t,this.router=h,this.materialPath=m,this.nodeEnv=p,n&&(this.dependencies=n),o&&(this.materials=o),Object.assign(this.globals,u),Object.assign(this.adapter,a),s!==j.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:u}=this,{libraryExports:c,libraryMap:h,materials:m,materialExports:p,materialMapLibrary:_}=Z(s,u);for(const d of c){const w=o[d],E=window[d];if(E)i[d]=E;else if(w)window[d]=i[d]=await w();else{const v=h[d]||[];for(const P of v)D(P)&&await te(d,l.url.append(P,{v:C})),V(P)&&await l.loadScript(l.url.append(P,{v:C})),i[d]=window[d]}}for(const d of m)await l.loadScript(l.url.append(d,{v:C}));const S=this.materials||{};for(const d of p){const w=window[_[d]],E=$.BUILT_IN_COMPONENTS[d];if(E)w&&E.forEach(v=>{a[v]=w[v]});else{const v=S[d]?(await S[d]()).default:window[d];v&&w&&(v.components||[]).forEach(P=>{a[P.name]=ee(P,w)})}}n&&(this.apis=oe(n,this.adapter),L(),this.project.config?.mock&&ie(n)),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:Xe}))}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(z,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 l.logger.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 l.logger.warn(`Can not find dsl: ${e}`),null;const{library:i,components:a,mode:u,apis:c}=this,h={mode:u,Vue:i.Vue,components:a,libs:i,apis:c,window},m=U({getDsl:async _=>await this.getDsl(_)||null,options:h}),{renderer:p}=J({...h,dsl:o,loader:m});return p}}function Ge(r){const e=new pe(r);return{provider:e,onReady:s=>e.ready(s)}}function K(r={}){const e=f.inject(z);if(!e)throw new Error("Can not find provider");if(e.mode===j.Raw&&e.nodeEnv==="development"){const{id:t,version:s}=r;t&&s&&(async()=>{const n=await e.getDsl(t);n?.__VERSION__!==s&&R.ElNotification.warning({title:n?.name,message:"当前组件源码版本与运行时版本不一致,请重新发布组件"})})()}return e}const Qe=new l.Request({settings:{type:"json",validSuccess:!0,originResponse:!1,failMessage:!0,validate:r=>r.data?.code===0,showError:r=>{R.ElNotification.error({message:r||"未知错误"})}}}),Ze=(r="/vtj/local/repository/${type}.json")=>(e,t)=>Qe.send({url:r,method:"post",query:{type:e},data:{type:e,data:t}});class k{api;constructor(){this.api=Ze()}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 g=new l.Storage({type:"local",expired:0,prefix:"__VTJ_"});class et extends k{init(e){const t=new $.ProjectModel(e),s=g.get(`project_${t.id}`),n=Object.assign(t.toDsl(),s||{});return g.save(`project_${t.id}`,n),Promise.resolve(n)}saveProject(e){const t=new $.ProjectModel(e);return g.save(`project_${t.id}`,t.toDsl()),Promise.resolve(!0)}saveMaterials(e,t){return g.save(`materials_${e.id}`,l.mapToObject(t)),Promise.resolve(!0)}saveFile(e){return g.save(`file_${e.id}`,e),Promise.resolve(!0)}getFile(e){const t=g.get(`file_${e}`);return t?Promise.resolve(t):Promise.reject(null)}removeFile(e){return g.remove(`file_${e}`),Promise.resolve(!0)}saveHistory(e){return g.save(`history_${e.id}`,e),Promise.resolve(!0)}removeHistory(e){const t=g.get(`history_${e}`);if(t){const n=(t.items||[]).map(o=>o.id);this.removeHistoryItem(e,n),g.remove(`history_${e}`)}return Promise.resolve(!0)}getHistory(e){const t=g.get(`history_${e}`),s=new $.HistoryModel(t||{id:e});return Promise.resolve(s.toDsl())}getHistoryItem(e,t){const s=g.get(`history_${e}_${t}`);return Promise.resolve(s)}saveHistoryItem(e,t){return g.save(`history_${e}_${t.id}`,t),Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(s=>{g.remove(`history_${e}_${s}`)}),Promise.resolve(!0)}}class de extends k{projects={};materials={};files={};histories={};historyItems={};init(e){const t=new $.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 $.ProjectModel(e);return this.projects[t.id]=t.toDsl(),Promise.resolve(!0)}saveMaterials(e,t){return e.id&&(this.materials[e.id]=l.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 $.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 H=null;function tt(){return H||(H=new de,H)}class rt extends k{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:l.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 fe(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?fe(o):void 0}})}function st(){const r=K(),e=X.useRoute(),t=f.ref(!1),s=r.project;f.watchEffect(()=>{const{name:i,params:a,meta:u}=e;if(i==="VtjPage"){const c=r.getPage(a.id);t.value=!c?.mask}else if(i==="VtjHomepage"){const c=r.getHomepage();t.value=!c?.mask}else t.value=!u.mask});const n=fe(s?.pages),o=s?.config;return{disabled:t,logo:o?.logo,themeSwitchable:o?.themeSwitchable,title:o?.title||s?.description||s?.name||"VTJ App",menus:n}}exports.BUILT_IN_DIRECTIVES=G;exports.BaseService=k;exports.CONTEXT_HOST=N;exports.Context=ce;exports.ContextMode=j;exports.DATA_TYPES=Q;exports.JSCodeToString=Se;exports.LIFE_CYCLES_LIST=ge;exports.LocalService=rt;exports.MemoryService=de;exports.Provider=pe;exports.StorageService=et;exports.VTJ_RENDERER_VERSION=C;exports.adoptedStyleSheets=q;exports.createAssetScripts=_e;exports.createAssetsCss=ye;exports.createDataSources=le;exports.createLoader=U;exports.createMemoryService=tt;exports.createProvider=Ge;exports.createRenderer=J;exports.createSchemaApi=ne;exports.createSchemaApis=oe;exports.defaultLoader=ue;exports.fillBasePath=F;exports.getModifiers=Y;exports.getRawComponent=ee;exports.isCSSUrl=D;exports.isJSCode=se;exports.isJSExpression=y;exports.isJSFunction=x;exports.isJSUrl=V;exports.isVuePlugin=re;exports.loadCss=te;exports.mockApi=ae;exports.mockApis=ie;exports.mockCleanup=L;exports.nodeRender=T;exports.parseDeps=Z;exports.parseExpression=I;exports.parseFunction=A;exports.providerKey=z;exports.toString=B;exports.useMask=st;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 De(r,e,t,s){if(!e)return null;if(l.isString(e))return{default:()=>e};if(_(e))return{default:()=>q(t.__parseExpression(e))};if(Array.isArray(e)&&e.length>0){const n=Ne(e),o=i=>!i||!s?{}:s?.id&&Object.keys(i).length?{[`scope_${s.id}`]:i}:{};return Object.entries(n).reduce((i,[a,{nodes:u,params:c}])=>(i[a]=m=>{const d=c.length?l.pick(m??{},c):o(m);return u.map(p=>R(p,t.__clone(d),r))},i),{})}return null}function Ne(r){const e={default:{params:[],nodes:[]}};for(const t of r){const s=Be(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 Be(r="default"){return l.isString(r)?{name:r,params:[]}:{params:[],...r}}function qe(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((u,c)=>c+1)),Array.isArray(a)?a.map((u,c)=>e(t.__clone({[o]:u,[i]:c}))):(console.warn("[vForRender]:",`${s?.value} is not a Arrary`),[])}const W=j.defineComponent({name:"VtjPageContainer",async setup(){const r=K(),e=z.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?j.h(this.component,this.query):j.h("div","页面不存在")}}),Le=j.defineComponent({name:"VtjStartupContainer",render(){return j.h(he.XStartup)}}),X=Symbol("Provider");class pe extends $.Base{mode;globals={};modules={};adapter={request:we,jsonp:l.jsonp};apis={};dependencies={};materials={};library={};service;project=null;components={};nodeEnv="development";router=null;materialPath="./";constructor(e){super();const{service:t,mode:s=w.Raw,dependencies:n,materials:o,project:i={},adapter:a={},globals:u={},modules:c={},router:m=null,materialPath:d="./",nodeEnv:p="development"}=e;this.mode=s,this.modules=c,this.service=t,this.router=m,this.materialPath=d,this.nodeEnv=p,n&&(this.dependencies=n),o&&(this.materials=o),Object.assign(this.globals,u),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:u}=this,{libraryExports:c,libraryMap:m,materials:d,materialExports:p,materialMapLibrary:g}=Z(s,u);for(const f of c){const S=o[f],E=window[f];if(E)i[f]=E;else if(S)window[f]=i[f]=await S();else{const h=m[f]||[];for(const P of h)N(P)&&await te(f,l.url.append(P,{v:C})),B(P)&&await l.loadScript(l.url.append(P,{v:C})),i[f]=window[f]}}for(const f of d)await l.loadScript(l.url.append(f,{v:C}));const y=this.materials||{};for(const f of p){const S=window[g[f]],E=$.BUILT_IN_COMPONENTS[f];if(E)S&&E.forEach(h=>{a[h]=S[h]});else{const h=y[f]?(await y[f]()).default:window[f];h&&S&&(h.components||[]).forEach(P=>{a[P.name]=ee(P,S)})}}n&&(this.apis=oe(n,this.adapter),J(),this.project.config?.mock&&ie(n)),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:Le}))}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(X,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 l.logger.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 l.logger.warn(`Can not find dsl: ${e}`),null;const{library:i,components:a,mode:u,apis:c}=this,m={mode:u,Vue:i.Vue,components:a,libs:i,apis:c,window},d=U({getDsl:async g=>await this.getDsl(g)||null,options:m}),{renderer:p}=V({...m,dsl:o,loader:d});return p}}function Je(r){const e=new pe(r);return{provider:e,onReady:s=>e.ready(s)}}function K(r={}){const e=j.inject(X);if(!e)throw new Error("Can not find provider");if(e.mode===w.Raw&&e.nodeEnv==="development"){const{id:t,version:s}=r;t&&s&&(async()=>{const n=await e.getDsl(t);n?.__VERSION__!==s&&O.ElNotification.warning({title:n?.name,message:"当前组件源码版本与运行时版本不一致,请重新发布组件"})})()}return e}const Ve=new l.Request({settings:{type:"json",validSuccess:!0,originResponse:!1,failMessage:!0,validate:r=>r.data?.code===0,showError:r=>{O.ElNotification.error({message:r||"未知错误"})}}}),Ue=(r="/vtj/local/repository/${type}.json")=>(e,t)=>Ve.send({url:r,method:"post",query:{type:e},data:{type:e,data:t}});class k{api;constructor(){this.api=Ue()}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 l.Storage({type:"local",expired:0,prefix:"__VTJ_"});class Ye extends k{init(e){const t=new $.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 $.ProjectModel(e);return v.save(`project_${t.id}`,t.toDsl()),Promise.resolve(!0)}saveMaterials(e,t){return v.save(`materials_${e.id}`,l.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 $.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 k{projects={};materials={};files={};histories={};historyItems={};init(e){const t=new $.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 $.ProjectModel(e);return this.projects[t.id]=t.toDsl(),Promise.resolve(!0)}saveMaterials(e,t){return e.id&&(this.materials[e.id]=l.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 $.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 M=null;function Xe(){return M||(M=new fe,M)}class Ke extends k{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:l.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 We(){const r=K(),e=z.useRoute(),t=j.ref(!1),s=r.project;j.watchEffect(()=>{const{name:i,params:a,meta:u}=e;if(i==="VtjPage"){const c=r.getPage(a.id);t.value=!c?.mask}else if(i==="VtjHomepage"){const c=r.getHomepage();t.value=!c?.mask}else t.value=!u.mask});const n=de(s?.pages),o=s?.config;return{disabled:t,logo:o?.logo,themeSwitchable:o?.themeSwitchable,title:o?.title||s?.description||s?.name||"VTJ App",menus:n}}exports.BUILT_IN_DIRECTIVES=G;exports.BaseService=k;exports.CONTEXT_HOST=A;exports.Context=ce;exports.ContextMode=w;exports.DATA_TYPES=Q;exports.JSCodeToString=Se;exports.LIFE_CYCLES_LIST=ge;exports.LocalService=Ke;exports.MemoryService=fe;exports.Provider=pe;exports.StorageService=Ye;exports.VTJ_RENDERER_VERSION=C;exports.adoptedStyleSheets=L;exports.createAssetScripts=_e;exports.createAssetsCss=ye;exports.createDataSources=le;exports.createLoader=U;exports.createMemoryService=Xe;exports.createProvider=Je;exports.createRenderer=V;exports.createSchemaApi=ne;exports.createSchemaApis=oe;exports.defaultLoader=ue;exports.fillBasePath=I;exports.getModifiers=Y;exports.getRawComponent=ee;exports.isCSSUrl=N;exports.isJSCode=se;exports.isJSExpression=_;exports.isJSFunction=H;exports.isJSUrl=B;exports.isVuePlugin=re;exports.loadCss=te;exports.mockApi=ae;exports.mockApis=ie;exports.mockCleanup=J;exports.nodeRender=R;exports.parseDeps=Z;exports.parseExpression=F;exports.parseFunction=D;exports.providerKey=X;exports.toString=q;exports.useMask=We;exports.useProvider=K;
|
package/dist/index.mjs
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { Base as
|
|
2
|
-
import { isUrl as
|
|
3
|
-
import * as
|
|
4
|
-
import { defineComponent as
|
|
5
|
-
import { useRoute as
|
|
6
|
-
import { ElNotification as
|
|
1
|
+
import { Base as ie, BUILT_IN_COMPONENTS as ae, ProjectModel as C, HistoryModel as W } from "@vtj/core";
|
|
2
|
+
import { isUrl as ce, url as b, dedupArray as ue, isString as P, isFunction as V, logger as x, createRequest as le, merge as pe, pathToRegexp as fe, pathToRegexpMatch as me, formDataToJson as de, camelCase as j, upperFirst as he, pick as ve, jsonp as _e, loadScript as q, Request as ye, Storage as ge, mapToObject as D } from "@vtj/utils";
|
|
3
|
+
import * as T from "vue";
|
|
4
|
+
import { defineComponent as X, h as A, inject as we, ref as Se, watchEffect as $e } from "vue";
|
|
5
|
+
import { useRoute as Y } from "vue-router";
|
|
6
|
+
import { ElNotification as N, ElLoading as je } from "element-plus";
|
|
7
7
|
import M from "mockjs";
|
|
8
|
-
import { useTitle as
|
|
9
|
-
import {
|
|
8
|
+
import { useTitle as Ee } from "@vueuse/core";
|
|
9
|
+
import { XStartup as be } from "@vtj/ui";
|
|
10
10
|
/**!
|
|
11
11
|
* Copyright (c) 2024, VTJ.PRO All rights reserved.
|
|
12
12
|
* @name @vtj/renderer
|
|
13
13
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
14
|
-
* @version 0.7.
|
|
14
|
+
* @version 0.7.33
|
|
15
15
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
16
16
|
*/
|
|
17
|
-
const
|
|
17
|
+
const F = "0.7.33";
|
|
18
18
|
var w = /* @__PURE__ */ ((r) => (r.Runtime = "Runtime", r.Design = "Design", r.Raw = "Raw", r.VNode = "VNode", r))(w || {});
|
|
19
|
-
const
|
|
19
|
+
const J = [
|
|
20
20
|
"$el",
|
|
21
21
|
"$emit",
|
|
22
22
|
"$nextTick",
|
|
@@ -28,7 +28,7 @@ const K = [
|
|
|
28
28
|
"$props",
|
|
29
29
|
"$options",
|
|
30
30
|
"$forceUpdate"
|
|
31
|
-
],
|
|
31
|
+
], wt = [
|
|
32
32
|
"beforeCreate",
|
|
33
33
|
"created",
|
|
34
34
|
"beforeMount",
|
|
@@ -42,7 +42,7 @@ const K = [
|
|
|
42
42
|
"renderTriggered",
|
|
43
43
|
"activated",
|
|
44
44
|
"deactivated"
|
|
45
|
-
],
|
|
45
|
+
], Pe = ["vIf", "vShow", "vModel", "vFor", "vBind"], Fe = {
|
|
46
46
|
String,
|
|
47
47
|
Number,
|
|
48
48
|
Boolean,
|
|
@@ -51,55 +51,55 @@ const K = [
|
|
|
51
51
|
Function,
|
|
52
52
|
Date
|
|
53
53
|
};
|
|
54
|
-
function
|
|
55
|
-
return r.map((t) =>
|
|
54
|
+
function R(r, e) {
|
|
55
|
+
return r.map((t) => ce(t) ? t : `${e}${t}`);
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function K(r) {
|
|
58
58
|
return /\.css$/.test(r);
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function z(r) {
|
|
61
61
|
return /\.js$/.test(r);
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function St(r) {
|
|
64
64
|
return r.map(
|
|
65
|
-
(e) => `<script src="${
|
|
65
|
+
(e) => `<script src="${b.append(e, { v: F })}"><\/script>`
|
|
66
66
|
).join("");
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function $t(r = []) {
|
|
69
69
|
return r.map(
|
|
70
|
-
(e) => `<link rel="stylesheet" href="${
|
|
70
|
+
(e) => `<link rel="stylesheet" href="${b.append(e, { v: F })}" />`
|
|
71
71
|
).join("");
|
|
72
72
|
}
|
|
73
|
-
function
|
|
74
|
-
const t = r.filter((m) => !!m.enabled), s = [], n = [], o = [], i = [], a = {},
|
|
75
|
-
return t.forEach(({ urls: m, assetsUrl: f, library:
|
|
73
|
+
function Ie(r, e) {
|
|
74
|
+
const t = r.filter((m) => !!m.enabled), s = [], n = [], o = [], i = [], a = {}, u = [], c = {};
|
|
75
|
+
return t.forEach(({ urls: m, assetsUrl: f, library: l, assetsLibrary: v }) => {
|
|
76
76
|
m?.forEach((_) => {
|
|
77
|
-
|
|
78
|
-
}),
|
|
77
|
+
z(_) && s.push(_), K(_) && n.push(_);
|
|
78
|
+
}), l && (i.push(l), a[l] = R(m || [], e)), f && o.push(f), v && u.push(v), l && v && (c[v] = l);
|
|
79
79
|
}), {
|
|
80
|
-
scripts:
|
|
81
|
-
css:
|
|
82
|
-
materials:
|
|
80
|
+
scripts: R(s, e),
|
|
81
|
+
css: R(n, e),
|
|
82
|
+
materials: R(o, e),
|
|
83
83
|
libraryExports: i,
|
|
84
|
-
materialExports:
|
|
84
|
+
materialExports: ue(u),
|
|
85
85
|
materialMapLibrary: c,
|
|
86
86
|
libraryMap: a
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function Re(r, e) {
|
|
90
90
|
const { name: t, parent: s, alias: n } = r;
|
|
91
91
|
return s ? e[s]?.[n || t] : e[n || t];
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
return
|
|
93
|
+
function G(r) {
|
|
94
|
+
return P(r) ? r : JSON.stringify(r);
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function Q(r, e, t) {
|
|
97
97
|
const s = r.CSSStyleSheet;
|
|
98
98
|
if (s.prototype.replaceSync) {
|
|
99
99
|
const n = new s();
|
|
100
100
|
n.id = e, n.replaceSync(t);
|
|
101
101
|
const o = r.document, i = o.adoptedStyleSheets, a = Array.from(i).filter(
|
|
102
|
-
(
|
|
102
|
+
(u) => u.id !== e
|
|
103
103
|
);
|
|
104
104
|
o.adoptedStyleSheets = [...a, n];
|
|
105
105
|
} else {
|
|
@@ -108,30 +108,30 @@ function te(r, e, t) {
|
|
|
108
108
|
o ? o.innerHTML = t : (o = n.createElement("style"), o.id = e, o.innerHTML = t, n.head.appendChild(o));
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
async function
|
|
111
|
+
async function He(r, e) {
|
|
112
112
|
const t = await window.fetch(e).then((s) => s.text()).catch(() => "");
|
|
113
|
-
t &&
|
|
113
|
+
t && Q(window, r, t);
|
|
114
114
|
}
|
|
115
|
-
function
|
|
116
|
-
return
|
|
115
|
+
function Ce(r) {
|
|
116
|
+
return V(r) || V(r?.install);
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function I(r, e, t = !1, s = !1) {
|
|
119
119
|
try {
|
|
120
120
|
const n = ['"use strict";', "var __self = arguments[0];"];
|
|
121
121
|
n.push("return ");
|
|
122
122
|
let o = (r.value || "").trim();
|
|
123
|
-
o = o.replace(/this(\W|$)/g, (a,
|
|
123
|
+
o = o.replace(/this(\W|$)/g, (a, u) => `__self${u}`), o = n.join(`
|
|
124
124
|
`) + o;
|
|
125
125
|
const i = `with(${t ? "{}" : "$scope || {}"}) { ${o} }`;
|
|
126
126
|
return new Function("$scope", i)(e);
|
|
127
127
|
} catch (n) {
|
|
128
|
-
if (
|
|
128
|
+
if (x.error("parseExpression.error", n, r, e?.__self ?? e), s)
|
|
129
129
|
throw n;
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
function
|
|
133
|
-
const n =
|
|
134
|
-
if (typeof n != "function" && (
|
|
132
|
+
function L(r, e, t = !1, s = !1) {
|
|
133
|
+
const n = I(r, e, t, s);
|
|
134
|
+
if (typeof n != "function" && (x.error(
|
|
135
135
|
"parseFunction.error",
|
|
136
136
|
"not a function",
|
|
137
137
|
r,
|
|
@@ -143,17 +143,17 @@ function W(r, e, t = !1, s = !1) {
|
|
|
143
143
|
function g(r) {
|
|
144
144
|
return r && r.type === "JSExpression";
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function k(r) {
|
|
147
147
|
return typeof r == "object" && r && r.type === "JSFunction";
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
return g(r) ||
|
|
149
|
+
function xe(r) {
|
|
150
|
+
return g(r) || k(r);
|
|
151
151
|
}
|
|
152
|
-
function
|
|
153
|
-
return
|
|
152
|
+
function jt(r) {
|
|
153
|
+
return xe(r) ? r.value : JSON.stringify(r);
|
|
154
154
|
}
|
|
155
155
|
let E = null;
|
|
156
|
-
const
|
|
156
|
+
const Me = le({
|
|
157
157
|
settings: {
|
|
158
158
|
type: "form",
|
|
159
159
|
validSuccess: !0,
|
|
@@ -162,12 +162,12 @@ const Je = me({
|
|
|
162
162
|
validate: (r) => r.data?.code === 0 || !!r.data?.success,
|
|
163
163
|
failMessage: !0,
|
|
164
164
|
showError: (r) => {
|
|
165
|
-
|
|
165
|
+
N.error({
|
|
166
166
|
message: r || "未知错误"
|
|
167
167
|
});
|
|
168
168
|
},
|
|
169
169
|
showLoading: () => {
|
|
170
|
-
E && E.close(), E =
|
|
170
|
+
E && E.close(), E = je.service({
|
|
171
171
|
lock: !0,
|
|
172
172
|
text: "Loading",
|
|
173
173
|
background: "rgba(0, 0, 0, 0.05)"
|
|
@@ -178,7 +178,7 @@ const Je = me({
|
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
});
|
|
181
|
-
function
|
|
181
|
+
function Oe(r, e) {
|
|
182
182
|
const { jsonp: t, request: s } = e;
|
|
183
183
|
if (r.method === "jsonp")
|
|
184
184
|
return (n = {}) => t(r.url, {
|
|
@@ -186,7 +186,7 @@ function Le(r, e) {
|
|
|
186
186
|
query: n
|
|
187
187
|
});
|
|
188
188
|
{
|
|
189
|
-
const n = r.headers ?
|
|
189
|
+
const n = r.headers ? I(r.headers, {}, !0) : void 0, o = {
|
|
190
190
|
url: r.url,
|
|
191
191
|
method: r.method,
|
|
192
192
|
settings: {
|
|
@@ -194,36 +194,36 @@ function Le(r, e) {
|
|
|
194
194
|
headers: n
|
|
195
195
|
}
|
|
196
196
|
};
|
|
197
|
-
return (i, a) => s.send(
|
|
197
|
+
return (i, a) => s.send(pe(o, a || {}, { data: i }));
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
|
-
function
|
|
200
|
+
function Te(r = [], e) {
|
|
201
201
|
return r.reduce(
|
|
202
|
-
(t, s) => (t[s.id] =
|
|
202
|
+
(t, s) => (t[s.id] = Oe(s, e), t),
|
|
203
203
|
{}
|
|
204
204
|
);
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function ke(r = []) {
|
|
207
207
|
M.setup({
|
|
208
208
|
timeout: "50-500"
|
|
209
|
-
}),
|
|
209
|
+
}), Z(), r.forEach((e) => Ae(e));
|
|
210
210
|
}
|
|
211
|
-
function
|
|
211
|
+
function Ae(r) {
|
|
212
212
|
if (!r.mock)
|
|
213
213
|
return;
|
|
214
214
|
const { url: e, mockTemplate: t } = r;
|
|
215
215
|
if (e && t) {
|
|
216
|
-
const s =
|
|
216
|
+
const s = fe(`${e}(.*)`), n = me(e, { decode: decodeURIComponent }), o = I(t, {}, !0);
|
|
217
217
|
M.mock(s, (i) => {
|
|
218
|
-
const a =
|
|
219
|
-
return Object.assign(i, { data:
|
|
218
|
+
const a = b.parse(i.url) || {}, u = i.body instanceof FormData ? de(i.body) : i.body, c = n(i.url)?.params;
|
|
219
|
+
return Object.assign(i, { data: u, params: a, query: c }), M.mock(o(i));
|
|
220
220
|
});
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
-
function
|
|
223
|
+
function Z() {
|
|
224
224
|
M._mocked = {};
|
|
225
225
|
}
|
|
226
|
-
class
|
|
226
|
+
class De {
|
|
227
227
|
__id = null;
|
|
228
228
|
__mode;
|
|
229
229
|
__instance = null;
|
|
@@ -251,7 +251,7 @@ class Ke {
|
|
|
251
251
|
const { mode: t, dsl: s, attrs: n } = e;
|
|
252
252
|
this.__mode = t, s && (this.__id = s.id || null, this.__transform = s.transform || {}), n && Object.assign(this, n);
|
|
253
253
|
}
|
|
254
|
-
setup(e, t =
|
|
254
|
+
setup(e, t = T) {
|
|
255
255
|
const s = t.getCurrentInstance();
|
|
256
256
|
if (!s)
|
|
257
257
|
return;
|
|
@@ -264,12 +264,12 @@ class Ke {
|
|
|
264
264
|
});
|
|
265
265
|
}
|
|
266
266
|
__proxy() {
|
|
267
|
-
this.__instance &&
|
|
267
|
+
this.__instance && J.forEach((e) => {
|
|
268
268
|
this[e] = this.__instance?.[e];
|
|
269
269
|
});
|
|
270
270
|
}
|
|
271
271
|
__cleanup() {
|
|
272
|
-
|
|
272
|
+
J.forEach((e) => {
|
|
273
273
|
this[e] = null;
|
|
274
274
|
});
|
|
275
275
|
}
|
|
@@ -277,17 +277,17 @@ class Ke {
|
|
|
277
277
|
if (e)
|
|
278
278
|
if (this.__mode === w.Runtime) {
|
|
279
279
|
const { id: t, type: s } = e, n = t ? this.__transform[t] ?? e.value : e.value;
|
|
280
|
-
return
|
|
280
|
+
return L({ type: s, value: n }, this);
|
|
281
281
|
} else
|
|
282
|
-
return
|
|
282
|
+
return L(e, this);
|
|
283
283
|
}
|
|
284
284
|
__parseExpression(e) {
|
|
285
285
|
if (e)
|
|
286
286
|
if (this.__mode === w.Runtime) {
|
|
287
287
|
const { id: t, type: s } = e, n = t ? this.__transform[t] ?? e.value : e.value;
|
|
288
|
-
return
|
|
288
|
+
return I({ type: s, value: n }, this);
|
|
289
289
|
} else
|
|
290
|
-
return
|
|
290
|
+
return I(e, this);
|
|
291
291
|
}
|
|
292
292
|
__ref(e = null, t) {
|
|
293
293
|
if (this.__mode !== w.VNode)
|
|
@@ -318,43 +318,43 @@ class Ke {
|
|
|
318
318
|
return s.context.__proto__ = this.context, s.__proto__ = this, s;
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
|
-
function
|
|
321
|
+
function ee(r) {
|
|
322
322
|
const {
|
|
323
|
-
Vue: e =
|
|
323
|
+
Vue: e = T,
|
|
324
324
|
mode: t = w.Runtime,
|
|
325
325
|
components: s = {},
|
|
326
326
|
libs: n = {},
|
|
327
327
|
apis: o = {},
|
|
328
328
|
loader: i
|
|
329
|
-
} = r, a = e.computed(() => r.dsl),
|
|
329
|
+
} = r, a = e.computed(() => r.dsl), u = {
|
|
330
330
|
$components: s,
|
|
331
331
|
$libs: n,
|
|
332
332
|
$apis: o
|
|
333
|
-
}, c = new
|
|
333
|
+
}, c = new De({
|
|
334
334
|
mode: t,
|
|
335
335
|
dsl: a.value,
|
|
336
|
-
attrs:
|
|
336
|
+
attrs: u
|
|
337
337
|
}), m = e.defineComponent({
|
|
338
338
|
name: a.value.name,
|
|
339
339
|
props: {
|
|
340
|
-
...
|
|
340
|
+
...Ne(a.value.props ?? [], c)
|
|
341
341
|
},
|
|
342
342
|
setup(f) {
|
|
343
|
-
c.$props = f, a.value.id &&
|
|
343
|
+
c.$props = f, a.value.id && Q(
|
|
344
344
|
r.window || window,
|
|
345
345
|
a.value.id,
|
|
346
346
|
a.value.css || ""
|
|
347
|
-
), c.state =
|
|
348
|
-
const
|
|
347
|
+
), c.state = Be(e, a.value.state ?? {}, c);
|
|
348
|
+
const l = Ve(e, a.value.computed ?? {}, c), v = qe(a.value.methods ?? {}, c), _ = Je(e, a.value.inject, c), p = Le(
|
|
349
349
|
a.value.dataSources || {},
|
|
350
350
|
c
|
|
351
351
|
), y = {
|
|
352
352
|
..._,
|
|
353
|
-
...
|
|
353
|
+
...l,
|
|
354
354
|
...v,
|
|
355
355
|
...p
|
|
356
356
|
};
|
|
357
|
-
return c.setup(y, e),
|
|
357
|
+
return c.setup(y, e), Ue(e, a.value.watch ?? [], c), {
|
|
358
358
|
vtj: c
|
|
359
359
|
};
|
|
360
360
|
},
|
|
@@ -364,18 +364,18 @@ function se(r) {
|
|
|
364
364
|
if (!a.value.nodes)
|
|
365
365
|
return null;
|
|
366
366
|
const f = a.value.nodes || [];
|
|
367
|
-
return f.length === 1 ? O(f[0], c, e, i) : f.map((
|
|
367
|
+
return f.length === 1 ? O(f[0], c, e, i) : f.map((l) => O(l, c, e, i));
|
|
368
368
|
},
|
|
369
|
-
...
|
|
369
|
+
...We(a.value.lifeCycles ?? {}, c)
|
|
370
370
|
});
|
|
371
371
|
return {
|
|
372
372
|
renderer: e.markRaw(m),
|
|
373
373
|
context: c
|
|
374
374
|
};
|
|
375
375
|
}
|
|
376
|
-
function
|
|
377
|
-
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((o) =>
|
|
378
|
-
return r.map((s) =>
|
|
376
|
+
function Ne(r = [], e) {
|
|
377
|
+
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((o) => Fe[o]) : void 0;
|
|
378
|
+
return r.map((s) => P(s) ? {
|
|
379
379
|
name: s
|
|
380
380
|
} : {
|
|
381
381
|
name: s.name,
|
|
@@ -391,53 +391,53 @@ function We(r = [], e) {
|
|
|
391
391
|
{}
|
|
392
392
|
);
|
|
393
393
|
}
|
|
394
|
-
function
|
|
394
|
+
function Be(r, e, t) {
|
|
395
395
|
return r.reactive(
|
|
396
396
|
Object.keys(e || {}).reduce(
|
|
397
397
|
(s, n) => {
|
|
398
398
|
let o = e[n];
|
|
399
|
-
return g(o) ? o = t.__parseExpression(o) :
|
|
399
|
+
return g(o) ? o = t.__parseExpression(o) : k(o) && (o = t.__parseFunction(o)), s[n] = o, s;
|
|
400
400
|
},
|
|
401
401
|
{}
|
|
402
402
|
)
|
|
403
403
|
);
|
|
404
404
|
}
|
|
405
|
-
function
|
|
405
|
+
function Ve(r, e, t) {
|
|
406
406
|
return Object.entries(e ?? {}).reduce(
|
|
407
407
|
(s, [n, o]) => (s[n] = r.computed(t.__parseFunction(o)), s),
|
|
408
408
|
{}
|
|
409
409
|
);
|
|
410
410
|
}
|
|
411
|
-
function
|
|
411
|
+
function qe(r, e) {
|
|
412
412
|
return Object.entries(r ?? {}).reduce(
|
|
413
413
|
(t, [s, n]) => (t[s] = e.__parseFunction(n), t),
|
|
414
414
|
{}
|
|
415
415
|
);
|
|
416
416
|
}
|
|
417
|
-
function
|
|
417
|
+
function Je(r, e = [], t) {
|
|
418
418
|
return e.reduce(
|
|
419
419
|
(s, n) => {
|
|
420
420
|
const { name: o, from: i } = n || {};
|
|
421
421
|
n.default;
|
|
422
|
-
const a = g(i) ? t.__parseExpression(i) || o : i ?? o,
|
|
423
|
-
return s[o] = r.inject(a,
|
|
422
|
+
const a = g(i) ? t.__parseExpression(i) || o : i ?? o, u = g(n.default) ? t.__parseExpression(n.default) : n.default ?? null;
|
|
423
|
+
return s[o] = r.inject(a, u), s;
|
|
424
424
|
},
|
|
425
425
|
{}
|
|
426
426
|
);
|
|
427
427
|
}
|
|
428
|
-
function
|
|
428
|
+
function Le(r, e) {
|
|
429
429
|
return Object.keys(r).reduce(
|
|
430
430
|
(t, s) => {
|
|
431
|
-
const n = r[s], o = e.$apis[n.ref], i =
|
|
431
|
+
const n = r[s], o = e.$apis[n.ref], i = k(n.transform) ? n.transform.value ? e.__parseFunction(n.transform) : void 0 : n.transform;
|
|
432
432
|
return t[s] = async (...a) => {
|
|
433
|
-
const
|
|
434
|
-
return i ? i(
|
|
433
|
+
const u = await o.apply(e, a);
|
|
434
|
+
return i ? i(u) : u;
|
|
435
435
|
}, t;
|
|
436
436
|
},
|
|
437
437
|
{}
|
|
438
438
|
);
|
|
439
439
|
}
|
|
440
|
-
function
|
|
440
|
+
function Ue(r, e = [], t) {
|
|
441
441
|
e.forEach((s) => {
|
|
442
442
|
r.watch(
|
|
443
443
|
t.__parseExpression(s.source),
|
|
@@ -449,57 +449,57 @@ function et(r, e = [], t) {
|
|
|
449
449
|
);
|
|
450
450
|
});
|
|
451
451
|
}
|
|
452
|
-
function
|
|
452
|
+
function We(r, e) {
|
|
453
453
|
return Object.entries(r ?? {}).reduce(
|
|
454
454
|
(t, [s, n]) => (t[s] = e.__parseFunction(n), t),
|
|
455
455
|
{}
|
|
456
456
|
);
|
|
457
457
|
}
|
|
458
|
-
const
|
|
459
|
-
function
|
|
458
|
+
const Xe = (r) => r;
|
|
459
|
+
function te(r) {
|
|
460
460
|
const { getDsl: e, options: t } = r;
|
|
461
|
-
return (s, n, o =
|
|
461
|
+
return (s, n, o = T) => !n || typeof n == "string" ? s : n.type === "Schema" ? o.defineAsyncComponent(async () => {
|
|
462
462
|
const i = await e(n.id);
|
|
463
|
-
return i ?
|
|
463
|
+
return i ? ee({
|
|
464
464
|
...t,
|
|
465
465
|
Vue: o,
|
|
466
466
|
dsl: i,
|
|
467
467
|
mode: w.Runtime,
|
|
468
|
-
loader:
|
|
468
|
+
loader: te(r)
|
|
469
469
|
}).renderer : null;
|
|
470
470
|
}) : s;
|
|
471
471
|
}
|
|
472
|
-
function O(r, e, t =
|
|
472
|
+
function O(r, e, t = T, s = Xe) {
|
|
473
473
|
if (!r || !r.name || r.invisible)
|
|
474
474
|
return null;
|
|
475
|
-
const { id: n = null, directives: o = [] } = r, { vIf: i, vFor: a, vShow:
|
|
476
|
-
if (i && !
|
|
475
|
+
const { id: n = null, directives: o = [] } = r, { vIf: i, vFor: a, vShow: u, vModels: c, vBind: m } = Ye(o);
|
|
476
|
+
if (i && !Ke(i, e))
|
|
477
477
|
return null;
|
|
478
|
-
const f = (
|
|
479
|
-
const v =
|
|
478
|
+
const f = (l) => {
|
|
479
|
+
const v = l.$components, _ = (() => {
|
|
480
480
|
if (r.name === "component")
|
|
481
|
-
return
|
|
481
|
+
return ze(l, r.props?.is);
|
|
482
482
|
if (r.name === "slot")
|
|
483
483
|
return r.name;
|
|
484
484
|
const d = s(r.name, r.from, t);
|
|
485
|
-
return
|
|
486
|
-
})(), p =
|
|
485
|
+
return P(d) ? v[d] ?? d : d;
|
|
486
|
+
})(), p = Ge(n, r.props ?? {}, l), y = Qe(t, r.events ?? {}, l);
|
|
487
487
|
if (r.name === "slot")
|
|
488
|
-
return
|
|
489
|
-
m && Object.assign(p,
|
|
488
|
+
return Ze(t, r, p, l);
|
|
489
|
+
m && Object.assign(p, l.__parseExpression(m.value)), u && (p.style = Object.assign(
|
|
490
490
|
p.style ?? {},
|
|
491
|
-
|
|
491
|
+
tt(u, l)
|
|
492
492
|
)), c.forEach((d) => {
|
|
493
|
-
Object.assign(p,
|
|
493
|
+
Object.assign(p, rt(t, d, l));
|
|
494
494
|
});
|
|
495
|
-
const S =
|
|
495
|
+
const S = st(t, r.children ?? [], l, r);
|
|
496
496
|
return t.createVNode(_, { ...p, ...y }, S);
|
|
497
497
|
};
|
|
498
|
-
return a ?
|
|
498
|
+
return a ? it(a, f, e) : f(e);
|
|
499
499
|
}
|
|
500
|
-
function
|
|
500
|
+
function Ye(r = []) {
|
|
501
501
|
const e = r.find((a) => j(a.name) === "vIf"), t = r.find((a) => j(a.name) === "vFor"), s = r.find((a) => j(a.name) === "vShow"), n = r.find((a) => j(a.name) === "vBind"), o = r.filter((a) => j(a.name) === "vModel"), i = r.filter(
|
|
502
|
-
(a) => !
|
|
502
|
+
(a) => !Pe.includes(j(a.name))
|
|
503
503
|
);
|
|
504
504
|
return {
|
|
505
505
|
vIf: e,
|
|
@@ -510,23 +510,23 @@ function st(r = []) {
|
|
|
510
510
|
others: i
|
|
511
511
|
};
|
|
512
512
|
}
|
|
513
|
-
function
|
|
513
|
+
function Ke(r, e) {
|
|
514
514
|
return !!e.__parseExpression(r.value);
|
|
515
515
|
}
|
|
516
|
-
function
|
|
516
|
+
function ze(r, e) {
|
|
517
517
|
return e ? g(e) ? r.__parseExpression(e) : e : "div";
|
|
518
518
|
}
|
|
519
|
-
function
|
|
519
|
+
function Ge(r, e, t) {
|
|
520
520
|
const s = Object.keys(e || {}).reduce(
|
|
521
521
|
(n, o) => {
|
|
522
522
|
let i = e[o];
|
|
523
|
-
return g(i) ? i = t.__parseExpression(i) :
|
|
523
|
+
return g(i) ? i = t.__parseExpression(i) : k(i) && (i = t.__parseFunction(i)), n[o] = i, n;
|
|
524
524
|
},
|
|
525
525
|
{}
|
|
526
526
|
);
|
|
527
527
|
return s.ref = t.__ref(r, s.ref), s;
|
|
528
528
|
}
|
|
529
|
-
function
|
|
529
|
+
function Qe(r, e, t) {
|
|
530
530
|
const s = ["passive", "capture", "once"], n = {
|
|
531
531
|
capture: "Capture",
|
|
532
532
|
once: "Once",
|
|
@@ -534,69 +534,69 @@ function at(r, e, t) {
|
|
|
534
534
|
};
|
|
535
535
|
return Object.keys(e || {}).reduce(
|
|
536
536
|
(o, i) => {
|
|
537
|
-
const a = e[i],
|
|
538
|
-
return f && (o[m] = r.withModifiers(f,
|
|
537
|
+
const a = e[i], u = re(a.modifiers), c = u.find((l) => s.includes(l)), m = "on" + he(i) + (c && n[c] || ""), f = t.__parseFunction(a.handler);
|
|
538
|
+
return f && (o[m] = r.withModifiers(f, u)), o;
|
|
539
539
|
},
|
|
540
540
|
{}
|
|
541
541
|
);
|
|
542
542
|
}
|
|
543
|
-
function
|
|
543
|
+
function re(r = {}, e = !1) {
|
|
544
544
|
const t = Object.keys(r);
|
|
545
545
|
return e ? t.map((s) => "." + s) : t;
|
|
546
546
|
}
|
|
547
|
-
function
|
|
548
|
-
const { children: n } = e, o =
|
|
549
|
-
return i ? i(t) : n ?
|
|
550
|
-
|
|
547
|
+
function Ze(r, e, t, s) {
|
|
548
|
+
const { children: n } = e, o = et(e, s), i = s.$slots?.[o.name];
|
|
549
|
+
return i ? i(t) : n ? P(n) ? r.createTextVNode(n) : g(n) ? r.createTextVNode(
|
|
550
|
+
G(s.__parseExpression(n))
|
|
551
551
|
) : Array.isArray(n) ? n.map((a) => O(a, s, r)) : null : null;
|
|
552
552
|
}
|
|
553
|
-
function
|
|
553
|
+
function et(r, e) {
|
|
554
554
|
const { props: t } = r, s = t?.name || "default";
|
|
555
555
|
return {
|
|
556
556
|
name: g(s) ? e.__parseExpression(s) : s,
|
|
557
557
|
params: []
|
|
558
558
|
};
|
|
559
559
|
}
|
|
560
|
-
function
|
|
560
|
+
function tt(r, e) {
|
|
561
561
|
return e.__parseExpression(r.value) ? {} : {
|
|
562
562
|
display: "none"
|
|
563
563
|
};
|
|
564
564
|
}
|
|
565
|
-
function
|
|
565
|
+
function rt(r, e, t) {
|
|
566
566
|
const s = {
|
|
567
567
|
type: "JSFunction",
|
|
568
568
|
value: e.value?.value ? `(v) => {
|
|
569
569
|
${e.value.value} = v;
|
|
570
570
|
}` : "(v) => {}"
|
|
571
|
-
}, n = t.__parseFunction(s), o =
|
|
571
|
+
}, n = t.__parseFunction(s), o = re(e.modifiers), i = g(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
|
572
572
|
return {
|
|
573
573
|
[i]: t.__parseExpression(e.value),
|
|
574
574
|
[`onUpdate:${i}`]: o.length && n ? r.withModifiers(n, o) : n
|
|
575
575
|
};
|
|
576
576
|
}
|
|
577
|
-
function
|
|
577
|
+
function st(r, e, t, s) {
|
|
578
578
|
if (!e)
|
|
579
579
|
return null;
|
|
580
|
-
if (
|
|
580
|
+
if (P(e))
|
|
581
581
|
return { default: () => e };
|
|
582
582
|
if (g(e))
|
|
583
583
|
return {
|
|
584
|
-
default: () =>
|
|
584
|
+
default: () => G(t.__parseExpression(e))
|
|
585
585
|
};
|
|
586
586
|
if (Array.isArray(e) && e.length > 0) {
|
|
587
|
-
const n =
|
|
587
|
+
const n = nt(e), o = (i) => !i || !s ? {} : s?.id && Object.keys(i).length ? {
|
|
588
588
|
[`scope_${s.id}`]: i
|
|
589
589
|
} : {};
|
|
590
|
-
return Object.entries(n).reduce((i, [a, { nodes:
|
|
591
|
-
const f = c.length ?
|
|
592
|
-
return
|
|
593
|
-
(
|
|
590
|
+
return Object.entries(n).reduce((i, [a, { nodes: u, params: c }]) => (i[a] = (m) => {
|
|
591
|
+
const f = c.length ? ve(m ?? {}, c) : o(m);
|
|
592
|
+
return u.map(
|
|
593
|
+
(l) => O(l, t.__clone(f), r)
|
|
594
594
|
);
|
|
595
595
|
}, i), {});
|
|
596
596
|
}
|
|
597
597
|
return null;
|
|
598
598
|
}
|
|
599
|
-
function
|
|
599
|
+
function nt(r) {
|
|
600
600
|
const e = {
|
|
601
601
|
default: {
|
|
602
602
|
params: [],
|
|
@@ -604,7 +604,7 @@ function mt(r) {
|
|
|
604
604
|
}
|
|
605
605
|
};
|
|
606
606
|
for (const t of r) {
|
|
607
|
-
const s =
|
|
607
|
+
const s = ot(t.slot), n = s.name;
|
|
608
608
|
e[n] ? (e[n].nodes.push(t), e[n].params = e[n].params.concat(s.params)) : e[n] = {
|
|
609
609
|
nodes: [t],
|
|
610
610
|
params: s.params
|
|
@@ -612,19 +612,19 @@ function mt(r) {
|
|
|
612
612
|
}
|
|
613
613
|
return e;
|
|
614
614
|
}
|
|
615
|
-
function
|
|
616
|
-
return
|
|
615
|
+
function ot(r = "default") {
|
|
616
|
+
return P(r) ? { name: r, params: [] } : { params: [], ...r };
|
|
617
617
|
}
|
|
618
|
-
function
|
|
618
|
+
function it(r, e, t) {
|
|
619
619
|
const { value: s, iterator: n } = r, { item: o = "item", index: i = "index" } = n || {};
|
|
620
620
|
let a = t.__parseExpression(s) || [];
|
|
621
|
-
return Number.isInteger(a) && (a = new Array(a).fill(!0).map((
|
|
621
|
+
return Number.isInteger(a) && (a = new Array(a).fill(!0).map((u, c) => c + 1)), Array.isArray(a) ? a.map((u, c) => e(t.__clone({ [o]: u, [i]: c }))) : (console.warn("[vForRender]:", `${s?.value} is not a Arrary`), []);
|
|
622
622
|
}
|
|
623
|
-
const
|
|
623
|
+
const U = X({
|
|
624
624
|
name: "VtjPageContainer",
|
|
625
625
|
async setup() {
|
|
626
|
-
const r =
|
|
627
|
-
return s &&
|
|
626
|
+
const r = ne(), e = Y(), t = e.params.id, s = t ? r.getPage(t) : r.getHomepage(), n = s ? await r.getRenderComponent(s.id) : null;
|
|
627
|
+
return s && Ee(s.title || "VTJ"), {
|
|
628
628
|
provider: r,
|
|
629
629
|
component: n,
|
|
630
630
|
file: s,
|
|
@@ -632,69 +632,19 @@ const Y = V({
|
|
|
632
632
|
};
|
|
633
633
|
},
|
|
634
634
|
render() {
|
|
635
|
-
return this.component ?
|
|
635
|
+
return this.component ? A(this.component, this.query) : A("div", "页面不存在");
|
|
636
636
|
}
|
|
637
|
-
}),
|
|
638
|
-
name: {
|
|
639
|
-
type: String,
|
|
640
|
-
default: "VTJ.PRO"
|
|
641
|
-
},
|
|
642
|
-
tagline: {
|
|
643
|
-
type: String,
|
|
644
|
-
default: "基于 Vue3 + TypeScript 快速打造高生产力的低代码研发平台"
|
|
645
|
-
},
|
|
646
|
-
actionText: {
|
|
647
|
-
type: String,
|
|
648
|
-
default: "开始设计"
|
|
649
|
-
},
|
|
650
|
-
actionLink: {
|
|
651
|
-
type: String,
|
|
652
|
-
default: "/@vtj/pro/"
|
|
653
|
-
}
|
|
654
|
-
}, _t = { class: "x-startup" }, yt = { class: "x-startup__wrapper" }, gt = { class: "x-startup__name" }, wt = { class: "clip" }, St = { class: "x-startup__tagline" }, $t = { class: "x-startup__actions" }, jt = /* @__PURE__ */ V({
|
|
655
|
-
__name: "Startup",
|
|
656
|
-
props: vt,
|
|
657
|
-
setup(r) {
|
|
658
|
-
const e = r, t = () => {
|
|
659
|
-
if (typeof window < "u") {
|
|
660
|
-
let s = (window.__VTJ_LINK__ || {}).href || window.location.pathname + "@vtj/pro/#/";
|
|
661
|
-
window.location.href = s;
|
|
662
|
-
}
|
|
663
|
-
};
|
|
664
|
-
return (s, n) => (je(), Ee("div", _t, [
|
|
665
|
-
F("div", yt, [
|
|
666
|
-
F("div", gt, [
|
|
667
|
-
F("span", wt, A(e.name), 1)
|
|
668
|
-
]),
|
|
669
|
-
F("div", St, A(e.tagline), 1),
|
|
670
|
-
F("div", $t, [
|
|
671
|
-
Pe(z(Ce), {
|
|
672
|
-
type: "primary",
|
|
673
|
-
size: "large",
|
|
674
|
-
round: "",
|
|
675
|
-
icon: z(Me),
|
|
676
|
-
onClick: t
|
|
677
|
-
}, {
|
|
678
|
-
default: be(() => [
|
|
679
|
-
Fe(A(e.actionText), 1)
|
|
680
|
-
]),
|
|
681
|
-
_: 1
|
|
682
|
-
}, 8, ["icon"])
|
|
683
|
-
])
|
|
684
|
-
])
|
|
685
|
-
]));
|
|
686
|
-
}
|
|
687
|
-
}), Et = V({
|
|
637
|
+
}), at = X({
|
|
688
638
|
name: "VtjStartupContainer",
|
|
689
639
|
render() {
|
|
690
|
-
return
|
|
640
|
+
return A(be);
|
|
691
641
|
}
|
|
692
|
-
}),
|
|
693
|
-
class
|
|
642
|
+
}), se = Symbol("Provider");
|
|
643
|
+
class ct extends ie {
|
|
694
644
|
mode;
|
|
695
645
|
globals = {};
|
|
696
646
|
modules = {};
|
|
697
|
-
adapter = { request:
|
|
647
|
+
adapter = { request: Me, jsonp: _e };
|
|
698
648
|
apis = {};
|
|
699
649
|
dependencies = {};
|
|
700
650
|
materials = {};
|
|
@@ -714,25 +664,25 @@ class Pt extends le {
|
|
|
714
664
|
materials: o,
|
|
715
665
|
project: i = {},
|
|
716
666
|
adapter: a = {},
|
|
717
|
-
globals:
|
|
667
|
+
globals: u = {},
|
|
718
668
|
modules: c = {},
|
|
719
669
|
router: m = null,
|
|
720
670
|
materialPath: f = "./",
|
|
721
|
-
nodeEnv:
|
|
671
|
+
nodeEnv: l = "development"
|
|
722
672
|
} = e;
|
|
723
|
-
this.mode = s, this.modules = c, this.service = t, this.router = m, this.materialPath = f, this.nodeEnv =
|
|
673
|
+
this.mode = s, this.modules = c, this.service = t, this.router = m, this.materialPath = f, this.nodeEnv = l, n && (this.dependencies = n), o && (this.materials = o), Object.assign(this.globals, u), Object.assign(this.adapter, a), s !== w.Design && this.load(i);
|
|
724
674
|
}
|
|
725
675
|
async load(e) {
|
|
726
676
|
const t = this.modules[`.vtj/projects/${e.id}.json`];
|
|
727
677
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
|
728
678
|
throw new Error("project is null");
|
|
729
|
-
const { dependencies: s = [], apis: n } = this.project, { dependencies: o, library: i, components: a, materialPath:
|
|
679
|
+
const { dependencies: s = [], apis: n } = this.project, { dependencies: o, library: i, components: a, materialPath: u } = this, {
|
|
730
680
|
libraryExports: c,
|
|
731
681
|
libraryMap: m,
|
|
732
682
|
materials: f,
|
|
733
|
-
materialExports:
|
|
683
|
+
materialExports: l,
|
|
734
684
|
materialMapLibrary: v
|
|
735
|
-
} =
|
|
685
|
+
} = Ie(s, u);
|
|
736
686
|
for (const p of c) {
|
|
737
687
|
const y = o[p], S = window[p];
|
|
738
688
|
if (S)
|
|
@@ -742,14 +692,14 @@ class Pt extends le {
|
|
|
742
692
|
else {
|
|
743
693
|
const d = m[p] || [];
|
|
744
694
|
for (const $ of d)
|
|
745
|
-
|
|
695
|
+
K($) && await He(p, b.append($, { v: F })), z($) && await q(b.append($, { v: F })), i[p] = window[p];
|
|
746
696
|
}
|
|
747
697
|
}
|
|
748
698
|
for (const p of f)
|
|
749
|
-
await
|
|
699
|
+
await q(b.append(p, { v: F }));
|
|
750
700
|
const _ = this.materials || {};
|
|
751
|
-
for (const p of
|
|
752
|
-
const y = window[v[p]], S =
|
|
701
|
+
for (const p of l) {
|
|
702
|
+
const y = window[v[p]], S = ae[p];
|
|
753
703
|
if (S)
|
|
754
704
|
y && S.forEach((d) => {
|
|
755
705
|
a[d] = y[d];
|
|
@@ -757,29 +707,29 @@ class Pt extends le {
|
|
|
757
707
|
else {
|
|
758
708
|
const d = _[p] ? (await _[p]()).default : window[p];
|
|
759
709
|
d && y && (d.components || []).forEach(($) => {
|
|
760
|
-
a[$.name] =
|
|
710
|
+
a[$.name] = Re($, y);
|
|
761
711
|
});
|
|
762
712
|
}
|
|
763
713
|
}
|
|
764
|
-
n && (this.apis =
|
|
714
|
+
n && (this.apis = Te(n, this.adapter), Z(), this.project.config?.mock && ke(n)), this.initRouter(), this.triggerReady();
|
|
765
715
|
}
|
|
766
716
|
initRouter() {
|
|
767
717
|
const { router: e, project: t } = this;
|
|
768
718
|
e && (e.addRoute({
|
|
769
719
|
path: "/page/:id",
|
|
770
720
|
name: "VtjPage",
|
|
771
|
-
component:
|
|
721
|
+
component: U
|
|
772
722
|
}), e.addRoute({
|
|
773
723
|
path: "/",
|
|
774
724
|
name: "VtjHomepage",
|
|
775
|
-
component: t?.homepage ?
|
|
725
|
+
component: t?.homepage ? U : at
|
|
776
726
|
}));
|
|
777
727
|
}
|
|
778
728
|
install(e) {
|
|
779
729
|
const t = e.config.globalProperties.installed || {};
|
|
780
730
|
for (const [s, n] of Object.entries(this.library))
|
|
781
|
-
!t[s] &&
|
|
782
|
-
e.provide(
|
|
731
|
+
!t[s] && Ce(n) && (e.use(n), t[s] = !0);
|
|
732
|
+
e.provide(se, this), e.config.globalProperties.installed = t;
|
|
783
733
|
}
|
|
784
734
|
getFile(e) {
|
|
785
735
|
const { blocks: t = [] } = this.project || {};
|
|
@@ -810,47 +760,47 @@ class Pt extends le {
|
|
|
810
760
|
async getRenderComponent(e) {
|
|
811
761
|
const t = this.getFile(e);
|
|
812
762
|
if (!t)
|
|
813
|
-
return
|
|
763
|
+
return x.warn(`Can not find file: ${e}`), null;
|
|
814
764
|
const s = `.vtj/vue/${e}.vue`, n = this.modules[s];
|
|
815
765
|
if (n)
|
|
816
766
|
return (await n())?.default;
|
|
817
767
|
const o = await this.getDsl(t.id);
|
|
818
768
|
if (!o)
|
|
819
|
-
return
|
|
820
|
-
const { library: i, components: a, mode:
|
|
821
|
-
mode:
|
|
769
|
+
return x.warn(`Can not find dsl: ${e}`), null;
|
|
770
|
+
const { library: i, components: a, mode: u, apis: c } = this, m = {
|
|
771
|
+
mode: u,
|
|
822
772
|
Vue: i.Vue,
|
|
823
773
|
components: a,
|
|
824
774
|
libs: i,
|
|
825
775
|
apis: c,
|
|
826
776
|
window
|
|
827
|
-
}, f =
|
|
777
|
+
}, f = te({
|
|
828
778
|
getDsl: async (v) => await this.getDsl(v) || null,
|
|
829
779
|
options: m
|
|
830
|
-
}), { renderer:
|
|
780
|
+
}), { renderer: l } = ee({
|
|
831
781
|
...m,
|
|
832
782
|
dsl: o,
|
|
833
783
|
loader: f
|
|
834
784
|
});
|
|
835
|
-
return
|
|
785
|
+
return l;
|
|
836
786
|
}
|
|
837
787
|
}
|
|
838
|
-
function
|
|
839
|
-
const e = new
|
|
788
|
+
function Et(r) {
|
|
789
|
+
const e = new ct(r);
|
|
840
790
|
return {
|
|
841
791
|
provider: e,
|
|
842
792
|
onReady: (s) => e.ready(s)
|
|
843
793
|
};
|
|
844
794
|
}
|
|
845
|
-
function
|
|
846
|
-
const e =
|
|
795
|
+
function ne(r = {}) {
|
|
796
|
+
const e = we(se);
|
|
847
797
|
if (!e)
|
|
848
798
|
throw new Error("Can not find provider");
|
|
849
799
|
if (e.mode === w.Raw && e.nodeEnv === "development") {
|
|
850
800
|
const { id: t, version: s } = r;
|
|
851
801
|
t && s && (async () => {
|
|
852
802
|
const n = await e.getDsl(t);
|
|
853
|
-
n?.__VERSION__ !== s &&
|
|
803
|
+
n?.__VERSION__ !== s && N.warning({
|
|
854
804
|
title: n?.name,
|
|
855
805
|
message: "当前组件源码版本与运行时版本不一致,请重新发布组件"
|
|
856
806
|
});
|
|
@@ -858,7 +808,7 @@ function ae(r = {}) {
|
|
|
858
808
|
}
|
|
859
809
|
return e;
|
|
860
810
|
}
|
|
861
|
-
const
|
|
811
|
+
const ut = new ye({
|
|
862
812
|
settings: {
|
|
863
813
|
type: "json",
|
|
864
814
|
validSuccess: !0,
|
|
@@ -866,12 +816,12 @@ const bt = new Se({
|
|
|
866
816
|
failMessage: !0,
|
|
867
817
|
validate: (r) => r.data?.code === 0,
|
|
868
818
|
showError: (r) => {
|
|
869
|
-
|
|
819
|
+
N.error({
|
|
870
820
|
message: r || "未知错误"
|
|
871
821
|
});
|
|
872
822
|
}
|
|
873
823
|
}
|
|
874
|
-
}),
|
|
824
|
+
}), lt = (r = "/vtj/local/repository/${type}.json") => (e, t) => ut.send({
|
|
875
825
|
url: r,
|
|
876
826
|
method: "post",
|
|
877
827
|
query: { type: e },
|
|
@@ -880,10 +830,10 @@ const bt = new Se({
|
|
|
880
830
|
data: t
|
|
881
831
|
}
|
|
882
832
|
});
|
|
883
|
-
class
|
|
833
|
+
class B {
|
|
884
834
|
api;
|
|
885
835
|
constructor() {
|
|
886
|
-
this.api =
|
|
836
|
+
this.api = lt();
|
|
887
837
|
}
|
|
888
838
|
async init(e) {
|
|
889
839
|
return console.log("BaseService.init", e), {};
|
|
@@ -939,12 +889,12 @@ class L {
|
|
|
939
889
|
return await this.api("removeRawPage", e).catch(() => "");
|
|
940
890
|
}
|
|
941
891
|
}
|
|
942
|
-
const h = new
|
|
892
|
+
const h = new ge({
|
|
943
893
|
type: "local",
|
|
944
894
|
expired: 0,
|
|
945
895
|
prefix: "__VTJ_"
|
|
946
896
|
});
|
|
947
|
-
class
|
|
897
|
+
class bt extends B {
|
|
948
898
|
init(e) {
|
|
949
899
|
const t = new C(e), s = h.get(`project_${t.id}`), n = Object.assign(t.toDsl(), s || {});
|
|
950
900
|
return h.save(`project_${t.id}`, n), Promise.resolve(n);
|
|
@@ -978,7 +928,7 @@ class Jt extends L {
|
|
|
978
928
|
return Promise.resolve(!0);
|
|
979
929
|
}
|
|
980
930
|
getHistory(e) {
|
|
981
|
-
const t = h.get(`history_${e}`), s = new
|
|
931
|
+
const t = h.get(`history_${e}`), s = new W(t || { id: e });
|
|
982
932
|
return Promise.resolve(s.toDsl());
|
|
983
933
|
}
|
|
984
934
|
getHistoryItem(e, t) {
|
|
@@ -994,7 +944,7 @@ class Jt extends L {
|
|
|
994
944
|
}), Promise.resolve(!0);
|
|
995
945
|
}
|
|
996
946
|
}
|
|
997
|
-
class
|
|
947
|
+
class pt extends B {
|
|
998
948
|
projects = {};
|
|
999
949
|
materials = {};
|
|
1000
950
|
files = {};
|
|
@@ -1033,7 +983,7 @@ class It extends L {
|
|
|
1033
983
|
return Promise.resolve(!0);
|
|
1034
984
|
}
|
|
1035
985
|
getHistory(e) {
|
|
1036
|
-
const t = this.histories[e], s = new
|
|
986
|
+
const t = this.histories[e], s = new W(t || { id: e });
|
|
1037
987
|
return Promise.resolve(s);
|
|
1038
988
|
}
|
|
1039
989
|
getHistoryItem(e, t) {
|
|
@@ -1052,10 +1002,10 @@ class It extends L {
|
|
|
1052
1002
|
}
|
|
1053
1003
|
}
|
|
1054
1004
|
let H = null;
|
|
1055
|
-
function
|
|
1056
|
-
return H || (H = new
|
|
1005
|
+
function Pt() {
|
|
1006
|
+
return H || (H = new pt(), H);
|
|
1057
1007
|
}
|
|
1058
|
-
class
|
|
1008
|
+
class Ft extends B {
|
|
1059
1009
|
async init(e) {
|
|
1060
1010
|
return await this.api("init", e).catch(() => null) || {};
|
|
1061
1011
|
}
|
|
@@ -1100,7 +1050,7 @@ class qt extends L {
|
|
|
1100
1050
|
);
|
|
1101
1051
|
}
|
|
1102
1052
|
}
|
|
1103
|
-
function
|
|
1053
|
+
function oe(r = []) {
|
|
1104
1054
|
return r.map((e) => {
|
|
1105
1055
|
const { id: t, title: s, icon: n, children: o, hidden: i } = e;
|
|
1106
1056
|
return {
|
|
@@ -1109,14 +1059,14 @@ function ce(r = []) {
|
|
|
1109
1059
|
icon: n,
|
|
1110
1060
|
hidden: i,
|
|
1111
1061
|
url: `/page/${t}`,
|
|
1112
|
-
children: o && o.length ?
|
|
1062
|
+
children: o && o.length ? oe(o) : void 0
|
|
1113
1063
|
};
|
|
1114
1064
|
});
|
|
1115
1065
|
}
|
|
1116
|
-
function
|
|
1117
|
-
const r =
|
|
1118
|
-
|
|
1119
|
-
const { name: i, params: a, meta:
|
|
1066
|
+
function It() {
|
|
1067
|
+
const r = ne(), e = Y(), t = Se(!1), s = r.project;
|
|
1068
|
+
$e(() => {
|
|
1069
|
+
const { name: i, params: a, meta: u } = e;
|
|
1120
1070
|
if (i === "VtjPage") {
|
|
1121
1071
|
const c = r.getPage(a.id);
|
|
1122
1072
|
t.value = !c?.mask;
|
|
@@ -1124,9 +1074,9 @@ function Ut() {
|
|
|
1124
1074
|
const c = r.getHomepage();
|
|
1125
1075
|
t.value = !c?.mask;
|
|
1126
1076
|
} else
|
|
1127
|
-
t.value = !
|
|
1077
|
+
t.value = !u.mask;
|
|
1128
1078
|
});
|
|
1129
|
-
const n =
|
|
1079
|
+
const n = oe(s?.pages), o = s?.config;
|
|
1130
1080
|
return {
|
|
1131
1081
|
disabled: t,
|
|
1132
1082
|
logo: o?.logo,
|
|
@@ -1136,49 +1086,49 @@ function Ut() {
|
|
|
1136
1086
|
};
|
|
1137
1087
|
}
|
|
1138
1088
|
export {
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1089
|
+
Pe as BUILT_IN_DIRECTIVES,
|
|
1090
|
+
B as BaseService,
|
|
1091
|
+
J as CONTEXT_HOST,
|
|
1092
|
+
De as Context,
|
|
1143
1093
|
w as ContextMode,
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1094
|
+
Fe as DATA_TYPES,
|
|
1095
|
+
jt as JSCodeToString,
|
|
1096
|
+
wt as LIFE_CYCLES_LIST,
|
|
1097
|
+
Ft as LocalService,
|
|
1098
|
+
pt as MemoryService,
|
|
1099
|
+
ct as Provider,
|
|
1100
|
+
bt as StorageService,
|
|
1101
|
+
F as VTJ_RENDERER_VERSION,
|
|
1102
|
+
Q as adoptedStyleSheets,
|
|
1103
|
+
St as createAssetScripts,
|
|
1104
|
+
$t as createAssetsCss,
|
|
1105
|
+
Le as createDataSources,
|
|
1106
|
+
te as createLoader,
|
|
1107
|
+
Pt as createMemoryService,
|
|
1108
|
+
Et as createProvider,
|
|
1109
|
+
ee as createRenderer,
|
|
1110
|
+
Oe as createSchemaApi,
|
|
1111
|
+
Te as createSchemaApis,
|
|
1112
|
+
Xe as defaultLoader,
|
|
1113
|
+
R as fillBasePath,
|
|
1114
|
+
re as getModifiers,
|
|
1115
|
+
Re as getRawComponent,
|
|
1116
|
+
K as isCSSUrl,
|
|
1117
|
+
xe as isJSCode,
|
|
1168
1118
|
g as isJSExpression,
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1119
|
+
k as isJSFunction,
|
|
1120
|
+
z as isJSUrl,
|
|
1121
|
+
Ce as isVuePlugin,
|
|
1122
|
+
He as loadCss,
|
|
1123
|
+
Ae as mockApi,
|
|
1124
|
+
ke as mockApis,
|
|
1125
|
+
Z as mockCleanup,
|
|
1176
1126
|
O as nodeRender,
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1127
|
+
Ie as parseDeps,
|
|
1128
|
+
I as parseExpression,
|
|
1129
|
+
L as parseFunction,
|
|
1130
|
+
se as providerKey,
|
|
1131
|
+
G as toString,
|
|
1132
|
+
It as useMask,
|
|
1133
|
+
ne as useProvider
|
|
1184
1134
|
};
|
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.33",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "vue-tsc && vite build",
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
"coverage": "vitest run --coverage"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@vtj/core": "^0.7.
|
|
14
|
-
"@vtj/icons": "^0.7.
|
|
15
|
-
"@vtj/ui": "^0.7.
|
|
16
|
-
"@vtj/utils": "^0.7.
|
|
13
|
+
"@vtj/core": "^0.7.33",
|
|
14
|
+
"@vtj/icons": "^0.7.33",
|
|
15
|
+
"@vtj/ui": "^0.7.33",
|
|
16
|
+
"@vtj/utils": "^0.7.33",
|
|
17
17
|
"mockjs": "~1.1.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dist",
|
|
36
36
|
"types"
|
|
37
37
|
],
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "f8b4d10016f55e54c634f472fde12760d512e829",
|
|
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.32
|
|
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.32";
|