@vtj/renderer 0.16.3 → 0.16.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +5 -5
- package/dist/index.mjs +116 -108
- package/package.json +5 -5
- package/types/version.d.ts +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("@vtj/core"),f=require("@vtj/utils"),$=require("vue"),ge=require("vue-router");function Ze(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("@vtj/core"),f=require("@vtj/utils"),$=require("vue"),ge=require("vue-router");function Ze(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const G=Ze($);/**!
|
|
2
2
|
* Copyright (c) 2026, VTJ.PRO All rights reserved.
|
|
3
3
|
* @name @vtj/renderer
|
|
4
4
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
5
|
-
* @version 0.16.
|
|
5
|
+
* @version 0.16.5
|
|
6
6
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
7
|
-
*/const k="0.16.
|
|
7
|
+
*/const k="0.16.5";var S=(n=>(n.Runtime="Runtime",n.Design="Design",n.Raw="Raw",n.VNode="VNode",n))(S||{});const te=["$el","$emit","$nextTick","$parent","$root","$attrs","$slots","$watch","$props","$options","$forceUpdate"],et=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeUnmount","unmounted","errorCaptured","renderTracked","renderTriggered","activated","deactivated"],ye=["vIf","vElseIf","vElse","vShow","vModel","vFor","vBind","vHtml"],ve={String,Number,Boolean,Array,Object,Function,Date},F="VtjPage",L="VtjHomepage",_e="html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot,svg".split(","),Se="component,slot".split(","),tt=["h","t","t","p","s",":","/","/","a","p","p",".","v","t","j",".","p","r","o"].join(""),st={auth:["h","t","t","p","s",":","/","/","a","p","p",".","v","t","j",".","p","r","o","/","a","u","t","h",".","h","t","m","l"].join(""),storageKey:["R","R","O","_","I","D","E","_","A","C","C","E","S","S","_","S","T","O","R","A","G","E","_","_"].join(""),privateKey:"MIIBOgIBAAJBAKoIzmn1FYQ1YOhOBw9EhABxZ+PySAIaydI+zdhoKflrdgJ4A5E4/5gbQmRpk09hPWG8nvX7h+l/QLU8kXxAIBECAwEAAQJAAlgpxQY6sByLsXqzJcthC8LSGsLf2JEJkHwlnpwFqlEV8UCkoINpuZ2Wzl+aftURu5rIfAzRCQBvHmeOTW9/zQIhAO5ufWDmnSLyfAAsNo5JRNpVuLFCFodR8Xm+ulDlosR/AiEAtpAltyP9wmCABKG/v/hrtTr3mcvFNGCjoGa9bUAok28CIHbrVs9w1ijrBlvTsXYwJw46uP539uKRRT4ymZzlm9QjAiB+1KH/G9f9pEEL9rtaSOG7JF5D0JcOjlze4MGVFs+ZrQIhALKOUFBNr2zEsyJIjw2PlvEucdlG77UniszjXTROHSPd"};function H(n,e){return n.map(t=>f.isUrl(t)||t.startsWith("/")?t:`${e}${t}`)}function U(n){return/\.css$/.test(n)}function B(n){return/\.js$/.test(n)}function we(n){return/\.json$/.test(n)}function nt(n){return n.map(e=>`<script src="${f.url.append(e,{v:k})}"><\/script>`).join("")}function rt(n=[]){return n.map(e=>`<link rel="stylesheet" href="${f.url.append(e,{v:k})}" />`).join("")}function Ee(n,e=!1){return e&&n.endsWith(".prod.js")?n.replace(".prod.js",".js"):n}function be(n,e,t=!1){const s=n.filter(d=>!!d.enabled),r=[],o=[],a=[],i=[],l={},c={},p=[],u={};return s.forEach(({urls:d,assetsUrl:m,library:h,assetsLibrary:g,localeLibrary:y})=>{d?.forEach(v=>{B(v)&&r.push(Ee(v,t)),U(v)&&o.push(v)}),h&&(i.push(h),l[h]=H(d||[],e),y&&(c[h]=y)),m&&a.push(m),g&&p.push(g),h&&g&&(u[g]=h)}),{scripts:H(r,e),css:H(o,e),materials:H(a,e),libraryExports:i,materialExports:f.dedupArray(p),materialMapLibrary:u,libraryMap:l,libraryLocaleMap:c}}function $e(n,e){const{name:t,parent:s,alias:r}=n;return s?e[s]?.[r||t]:e[r||t]}function je(n=[]){const e=n.filter(s=>U(s)),t=n.filter(s=>B(s));return{css:e,js:t}}function Re(n,e){const t=c=>{const p=[];let u=0;for(;u<c.length;){if(/\s/.test(c[u])){u++;continue}if(c.substring(u,u+2)==="/*"){const v=c.indexOf("*/",u+2);if(v!==-1){u=v+2;continue}}if(c[u]==="@"){const v=u;for(;u<c.length&&c[u]!=="{"&&c[u]!==";";)u++;const w=c.substring(v,u).trim(),_=w.includes("@keyframes");if(c[u]===";")p.push({type:"simple-at-rule",content:c.substring(v,u+1)}),u++;else if(c[u]==="{"){const E=u+1;let I=1;for(u++;u<c.length&&I>0;)c[u]==="{"?I++:c[u]==="}"&&I--,u++;const Q=c.substring(v,u),A=c.substring(E,u-1);p.push({type:_?"keyframes":"at-rule",rule:w,content:Q,inner:A})}continue}const d=u;for(;u<c.length&&c[u]!=="{";)u++;if(u>=c.length)break;const m=c.substring(d,u).trim();if(!m){u++;continue}const h=u+1;let g=1;for(u++;u<c.length&&g>0;)c[u]==="{"?g++:c[u]==="}"&&g--,u++;const y=c.substring(h,u-1);p.push({type:"rule",selector:m,content:y.trim()})}return p},s=c=>{const p=c.trim();return/^(from|to|\d+(\.\d+)?%)$/.test(p)},r=c=>c.replace(/::v-deep\(/g,":deep(").replace(/::v-deep\s+/g,":deep(").replace(/\/deep\//g," ").replace(/>>>/g," ").replace(/(.*?):deep\(([^)]+)\)/g,(p,u,d)=>{const m=u.trim(),h=d.trim();return m?`${m}[${e}] ${h}`:h}),o=c=>{const p=c.trim();if(!p||p.includes(`[${e}]`)||/^(:root|:host|html|body)(\s|$|:|\.|\#|\[)/.test(p)||s(p))return p;const u=p.match(/^(.+?)((?:::?[\w-]+(?:\([^)]*\))?)*)\s*$/);if(u){const[,d,m=""]=u,h=d.trim();return h?`${h}[${e}]${m}`:p}return`${p}[${e}]`},a=c=>r(c).split(",").map(u=>o(u)).filter(u=>u.trim()).join(", "),i=c=>c.map(p=>{switch(p.type){case"simple-at-rule":return p.content;case"keyframes":return p.content;case"at-rule":try{const d=t(p.inner),m=i(d);return`${p.rule} { ${m} }`}catch{return p.content}case"rule":if(!p.selector||!p.content)return"";const u=a(p.selector);return u.trim()?`${u} { ${p.content} }`:"";default:return""}}).filter(p=>p.trim()).join(" "),l=c=>c.replace(/\s*{\s*/g," { ").replace(/\s*}\s*/g," } ").replace(/\s*;\s*/g,"; ").replace(/\s*,\s*/g,", ").replace(/\s+/g," ").replace(/^\s+|\s+$/g,"").replace(/\s*}\s*}/g," } }").trim();try{const c=n.replace(/\/\*(?!\s*!)[\s\S]*?\*\//g,"").replace(/^\s+|\s+$/gm,"").replace(/\n\s*\n/g,`
|
|
8
8
|
`),p=t(c),u=i(p);return l(u)}catch(c){return console.error("CSS scoping failed:",c),console.error("Input CSS:",n),n.replace(/\/\*[\s\S]*?\*\//g,"").replace(/(@keyframes\s+[^{]+\s*{[^{}]*(?:{[^}]*}[^{}]*)*})/g,p=>p).replace(/([^{}@]+)(?=\s*{)/g,p=>{const u=p.trim();return!u||u.startsWith("@")||u.includes(`[${e}]`)||s(u)?p:`${u}[${e}]`})}}const ot=750;function Ce(n,e,t){let s;typeof n<"u"?s=n.innerWidth||n.document.documentElement.clientWidth:(console.warn("无法获取屏幕宽度,使用默认值375"),s=375);const r=t||ot;return e*s/r}function Pe(n,e){let t=!1,s=!1,r=!1,o="";for(let a=0;a<e.length;a++){const i=e[a];if(i==="'"&&!s&&!r?t=!t:i==='"'&&!t&&!r?s=!s:e.substr(a,4).toLowerCase()==="url("&&!t&&!s?r=!0:i===")"&&r&&(r=!1),!t&&!s&&!r){const l=e.substr(a).match(/^(-?\d+(?:\.\d+)?)\s*rpx/);if(l){const c=l[1],p=parseFloat(c),d=`${Ce(n,p).toFixed(6).replace(/\.?0+$/,"")}px`;o+=d,a+=l[0].length-1;continue}}o+=i}return o}function re(n){return f.isString(n)?n:JSON.stringify(n)}function z(n,e,t,s=!1){const r=n.CSSStyleSheet,o=s?`data-v-${e}`:e,a=n.__uniConfig?Pe(n,t):t,i=s?Re(a,o):a;if(r.prototype.replaceSync){const l=new r;l.id=e,l.replaceSync(i);const c=n.document,p=c.adoptedStyleSheets,u=Array.from(p).filter(d=>d.id!==e);c.adoptedStyleSheets=[...u,l]}else{const l=n.document;let c=l.getElementById(e);c?c.innerHTML=i:(c=l.createElement("style"),c.id=e,c.innerHTML=i,l.head.appendChild(c))}}function it(n){const e=n.adoptedStyleSheets||[];let t="";if(e.forEach(s=>{try{for(const r of s.cssRules)t+=r.cssText+`
|
|
9
9
|
`}catch(r){console.error("Failed to read cssRules from adopted stylesheet:",r)}}),t){const s=n.createElement("style");s.textContent=t,n.head.appendChild(s)}}async function Ae(n,e){const t=await window.fetch(e).then(s=>s.text()).catch(()=>"");t&&z(window,n,t)}function oe(n,e=window){const t=e.document,s=e.document.head;for(const r of n)if(!t.getElementById(r)){const a=t.createElement("link");a.rel="stylesheet",a.id=r,a.href=r,s.appendChild(a)}}async function ie(n,e,t=window){const s=t.document,r=t.document.head;let o=t[e];return o?o.default||o:new Promise((a,i)=>{for(const l of n){const c=s.createElement("script");c.src=l,c.onload=()=>{o=t[e],o?a(o.default||o):i(null)},c.onerror=p=>{i(p)},r.appendChild(c)}})}function Ie(n){return f.isFunction(n)&&Object.getOwnPropertyNames(n.prototype||{}).length===0||f.isFunction(n?.install)}function Te(n){return Se.includes(n)}function Me(n){return _e.includes(n)}function x(n=window){const e=window?.Mock;if(e)return e;const t=n?.Mock;if(t&&window)return window.Mock=t,t}function at(n,e,t){Object.assign(e.meta,t.meta);const s=n?._container;t?.type==="page"&&s.classList.add("is-page"),t?.pure&&s.classList.add("is-pure")}function D(n,e,t=!1,s=!1,r=!1){try{const o=['"use strict";',"var __self = arguments[0];"];o.push("return ");let a=(n.value||"").trim();r||(a=a.replace(/this(\W|$)/g,(l,c)=>`__self${c}`)),a=o.join(`
|
|
10
10
|
`)+a;const i=r?`
|
|
11
11
|
${a}
|
|
12
|
-
`:`with(${t?"{}":"$scope || {}"}) { ${a} }`;return new Function("$scope",i)(e)}catch(o){if(f.logger.error("parseExpression.error",o,n,e?.__self??e),s)throw o}}function C(n,e,t=!1,s=!1,r=!1){const o=D(n,e,t,s,r);if(typeof o!="function"&&(f.logger.error("parseFunction.error","not a function",n,e?.__self??e),s))throw new Error(`"${n.value}" not a function`);return o}function R(n){return n&&n.type==="JSExpression"}function j(n){return typeof n=="object"&&n&&n.type==="JSFunction"}function Oe(n){return R(n)||j(n)}function ct(n){return Oe(n)?n.value:JSON.stringify(n)}const lt={session:!1,authKey:"Authorization",storageKey:"ACCESS_STORAGE",storagePrefix:"__VTJ_",unauthorized:void 0,auth:"/#/login",redirectParam:"r",unauthorizedCode:401,unauthorizedMessage:"登录已经失效,请重新登录!",noPermissionMessage:"无权限访问该页面",appName:"",statusKey:"code"},ae=Symbol("access");class V{options;data=null;mode=S.Raw;interceptResponse=!0;isTipShowing=!1;constructor(e){this.options=Object.assign({},lt,e),this.loadData()}enableIntercept(){this.interceptResponse=!0}disableIntercept(){this.interceptResponse=!1}connect(e){const{mode:t,router:s,request:r}=e;this.mode=t,s&&this.mode!==S.Design&&this.setGuard(s),r&&this.setRequest(r)}login(e){const{storageKey:t,storagePrefix:s,session:r,authKey:o}=this.options;this.setData(e),this.data&&(f.storage.save(t,e,{type:"local",prefix:s}),r&&f.cookie.set(o,this.data.token))}clear(){const{storageKey:e,storagePrefix:t,session:s,authKey:r}=this.options;this.data=null,f.storage.remove(e,{type:"local",prefix:t}),s&&f.cookie.remove(r)}logout(){this.clear(),this.toLogin()}getData(){return this.data?this.data:(this.loadData(),this.data)}getToken(){return this.data||this.loadData(),this.data?.token}can(e){const{appName:t}=this.options,{permissions:s={}}=this.data||{};return typeof e=="function"?e(s):f.toArray(e).every(o=>s[o]||s[t+"."+o])}some(e){const{appName:t}=this.options,{permissions:s={}}=this.data||{};return f.toArray(e).some(o=>s[o]||s[t+"."+o])}install(e){e.config.globalProperties.$access=this,e.provide(ae,this)}isAuthPath(e){const{auth:t,isAuth:s}=this.options;if(s)return s(e);if(e.path&&typeof t=="string"){const r=t.split("#")[1]||t;return e.path===r}return!1}toLogin(){const{auth:e,redirectParam:t}=this.options;if(!e)return;const s=t?`?${t}=${encodeURIComponent(location.href)}`:"";typeof e=="function"?e(s):location.href=t?`${e}${s}`:e}setData(e){const{privateKey:t}=this.options;if(Array.isArray(e)&&t){const s=e.map(r=>f.unRSA(r,t));try{this.data=JSON.parse(s.join(""))}catch(r){console.warn(r)}return}if(typeof e=="string")try{const s=t?f.unRSA(e,t):e;s?this.data=JSON.parse(s):console.warn("RSA解密失败或登录信息缺失")}catch(s){console.warn(s)}else this.data=e}loadData(){const{storageKey:e,storagePrefix:t}=this.options,s=f.storage.get(e,{type:"local",prefix:t});this.setData(s||null)}isLogined(){const{session:e,authKey:t}=this.options;return e&&t?!!f.cookie.get(t):!!this.getToken()}hasRoutePermission(e){if(e.name===F){const t=e.params.id;return t&&this.can(t)}return e.meta.__vtj__?this.can(e.meta.__vtj__):e.meta.permission?this.can(e.meta.permission):!0}setGuard(e){e.beforeEach((t,s,r)=>this.guard(t,r))}async guard(e,t){if(this.isWhiteList(e)||this.isAuthPath(e))return t();if(this.isLogined()){if(this.hasRoutePermission(e))return t();{const{noPermissionMessage:s="无权限访问",unauthorized:r=!1}=this.options;return await this.showTip(s),f.isFunction(r)?(r(),t(!1)):f.isString(r)?t(r):t(!1)}}t(!1),await f.delay(0),this.toLogin()}isWhiteList(e){const{whiteList:t}=this.options;return t?Array.isArray(t)?t.some(s=>e.fullPath.startsWith(s)):t(e):!1}isUnauthorized(e){const{unauthorizedCode:t=401,statusKey:s="code"}=this.options;return e.status===t||e.data?.[s]===t}async showUnauthorizedAlert(e){const{unauthorizedMessage:t="登录已失效"}=this.options;this.isUnauthorized(e)&&await this.showTip(t)&&this.toLogin()}async showTip(e){const{alert:t}=this.options;return this.isTipShowing?!1:t?(this.isTipShowing=!0,await f.delay(150),await t(e,{title:"提示",type:"warning"})?.catch(()=>!0)?.finally(()=>{this.isTipShowing=!1})):(window.alert(e),!0)}setRequest(e){e.useRequest(t=>(this.data?.token&&(t.headers[this.options.authKey]=this.data?.token),t)),e.useResponse(async t=>(this.interceptResponse&&await this.showUnauthorizedAlert(t),t),async t=>{if(!this.interceptResponse)return Promise.reject(t);const s=t.response||t||{};return await this.showUnauthorizedAlert(s),Promise.reject(t)})}}function ke(){return $.inject(ae,null)}function ut(n={}){const{notify:e,loading:t,settings:s={},Startup:r,access:o,useTitle:a,alert:i}=n;let l=null;return{request:f.createRequest({settings:{type:"form",validSuccess:!0,originResponse:!1,loading:!0,validate:p=>p.data?.code===0||!!p.data?.success,failMessage:!0,showError:p=>{e&&e(p||"未知错误")},showLoading:()=>{l&&l.close(),t&&(l=t())},hideLoading:()=>{l&&(l.close(),l=null)},...s}}),jsonp:f.jsonp,notify:e,loading:t,useTitle:a,alert:i,startupComponent:r,access:o?new V({alert:i,...o}):void 0}}function pt(n={}){return new V(n)}function Fe(n,e){const{jsonp:t,request:s}=e;if(n.method==="jsonp")return(r={})=>t(n.url,{...n.jsonpOptions,query:r});{const r=n.headers?D(n.headers,{},!0):void 0,o={url:n.url,method:n.method,settings:{...n.settings,headers:r}};return(a,i)=>(delete o.data,s.send(f.merge(o,i||{},{data:a})))}}function xe(n,e){const{metaQuery:t}=e;if(!t)return;const{code:s,queryCode:r}=n;return(o,a)=>{if(!t){console.warn("adapter.metaQuery is not defined!");return}return t(s,r,o,a)}}function De(n=[],e=[],t){const s={};for(const r of n){const o=Fe(r,t);s[r.id]=o,s[r.name]=o}for(const r of e)s[r.id]=xe(r,t);return s}async function He(n=[],e=window){const t=x(e);t&&(ce(e),n.forEach(s=>Ne(t,s)))}function Le(n,e=window){const t=j(n.mockTemplate)&&n.mockTemplate.value?C(n.mockTemplate,{},!0):void 0,s=x(e);return async(...r)=>{let o={};if(t)try{o=await t.apply(t,r)}catch(a){f.logger.warn("模拟数据模版异常",a)}return s?.mock(o)}}function Ne(n,e){if(!e.mock)return;const{url:t,mockTemplate:s}=e;if(t&&s)try{const r=f.isUrl(t)?new URL(t).pathname:t,o=f.pathToRegexp(`(.*)${r}(.*)`),a=f.pathToRegexpMatch(r,{decode:decodeURIComponent}),i=D(s,{},!0);n.mock(o,l=>{const c=f.url.parse(l.url)||{},p=l.body instanceof FormData?f.formDataToJson(l.body):l.body,u=f.isUrl(l.url)?new URL(l.url).pathname:l.url.split("?")[0],d=a(u)?.params;Object.assign(l,{data:p,params:d,query:c});try{return n.mock(i(l))}catch(m){return console.warn("[mockApi]",o,l,m),null}})}catch(r){console.warn("mockApi",r)}}function ce(n=window){const e=x(n);e&&(e._mocked={})}class Ue{__id=null;__mode;__instance=null;__contextRefs={};__refs={};context={};state={};props={};$props={};$refs={};$el=null;$emit=null;$nextTick=null;$parent=null;$root=null;$attrs=null;$slots=null;$watch=null;$options=null;$forceUpdate=null;$components={};$libs={};$apis={};$provider=null;__transform={};constructor(e){const{mode:t,dsl:s,attrs:r}=e;this.__mode=t,s&&(this.__id=s.id||null,this.__transform=s.transform||{}),r&&Object.assign(this,r)}setup(e,t=K){const s=t.getCurrentInstance();if(!s)return;this.__refs={},this.$refs={},this.context={},this.__contextRefs={},this.__instance=s.proxy;const r=s.appContext.config.globalProperties;Object.assign(this,r),Object.assign(this,e||{}),this.__proxy(),t.onMounted(()=>{this.__proxy()}),t.onUnmounted(()=>{this.__cleanup()}),t.onBeforeUpdate(()=>{this.__reset()})}__proxy(){this.__instance&&te.forEach(e=>{this[e]=this.__instance?.[e]})}__cleanup(){te.forEach(e=>{this[e]=null}),this.__reset()}__reset(){this.__refs={},this.$refs={},this.__contextRefs={},this.context={}}__parseFunction(e){if(e)if(this.__mode===S.Runtime){const{id:t,type:s}=e,r=t?this.__transform[t]??e.value:e.value;return C({type:s,value:r},this)}else return C(e,this)}__parseExpression(e){if(e)if(this.__mode===S.Runtime){const{id:t,type:s}=e,r=t?this.__transform[t]??e.value:e.value;return D({type:s,value:r},this)}else return D(e,this)}__ref(e=null,t){if(this.__mode!==S.VNode)return e&&e!==this.__id&&(this.__contextRefs[e]=this),async s=>{await f.delay(0);let r=s?.$vtjEl||s?.$el||s?._?.vnode?.el||s;if(!r){typeof t=="string"&&(delete this.$refs[t],e&&delete this.__refs[e]);return}return r.nodeType===3&&r.nextSibling&&(r=r.nextSibling),r.__vtj__=e,S.Design===this.__mode&&(r.__context__=this,r.draggable=!0),e&&(this.__refs[e]=this.__getRefEl(this.__refs,e,s)),typeof t=="function"?t(s):t&&(this.$refs[t]=this.__getRefEl(this.$refs,t,s)),s}}__getRefEl(e,t,s){const r=e[t];if(r&&s!==r){const o=new Set([].concat(r,s));return Array.from(o)}else return s}__clone(e={}){const t={...this.context,...e},s={...t,context:t};return s.context.__proto__=this.context,s.__proto__=this,s}}function J(n){const{Vue:e=K,mode:t=S.Runtime,components:s={},libs:r={},apis:o={},loader:a}=n,i=e.computed(()=>n.dsl),l={$components:s,$libs:r,$apis:o},c=new Ue({mode:t,dsl:i.value,attrs:l}),p=e.defineComponent({name:i.value.name,__scopeId:i.value.id?`data-v-${i.value.id}`:void 0,props:{...dt(i.value.props??[],c)},async setup(u){c.$props=u,c.props=u,i.value.id&&z(n.window||window,i.value.id,i.value.css||"",!0),c.state=ht(e,i.value.state??{},c);const d=mt(e,i.value.computed??{},c),m=gt(i.value.methods??{},c),h=yt(e,i.value.inject,c);for(const[v,w]of Object.entries(h||{}))h[v]=e.inject(v,w);const g=Be(i.value.dataSources||{},c),y={...h,...d,...m,...g};return c.setup(y,e),vt(e,i.value.watch??[],c),{vtj:c,state:c.state,...d,...m}},emits:ft(i.value.emits),expose:["vtj",...i.value.expose||[]],render(){if(!i.value.nodes)return null;const u=i.value.nodes||[];return u.length===1?O(u[0],c,e,a,u):u.map(d=>O(d,c,e,a,u))},..._t(i.value.lifeCycles??{},c)});return{renderer:e.markRaw(p),context:c}}function ft(n=[]){return n.map(e=>f.isString(e)?e:e.name)}function dt(n=[],e){const t=s=>s?(Array.isArray(s)?s:[s]).map(o=>ve[o]):void 0;return n.map(s=>f.isString(s)?{name:s}:{name:s.name,type:s.type,required:s.required,default:R(s.default)?e.__parseExpression(s.default):s.default}).reduce((s,r)=>(s[r.name]={type:t(r.type),required:r.required,default:r.default},s),{})}function ht(n,e,t){return n.reactive(Object.keys(e||{}).reduce((s,r)=>{let o=e[r];return R(o)?o=t.__parseExpression(o):j(o)&&(o=t.__parseFunction(o)),s[r]=o,s},{}))}function mt(n,e,t){return Object.entries(e??{}).reduce((s,[r,o])=>(s[r]=n.computed(t.__parseFunction(o)),s),{})}function gt(n,e){return Object.entries(n??{}).reduce((t,[s,r])=>(t[s]=e.__parseFunction(r),t),{})}function yt(n,e=[],t){return e.reduce((s,r)=>{const{name:o,from:a}=r||{};r.default;const i=R(a)?t.__parseExpression(a)||o:a??o,l=R(r.default)?t.__parseExpression(r.default):r.default??null;return s[o]=n.inject(i,l),s},{})}function Be(n,e){return Object.keys(n).reduce((t,s)=>{const r=n[s];if(r.type==="mock")t[s]=Le(r);else if(r.ref){const o=e.$apis[r.ref],a=j(r.transform)?r.transform.value?e.__parseFunction(r.transform):void 0:r.transform;t[s]=async(...i)=>{const l=await o.apply(e,i);return a?a(l):l}}return t},{})}function vt(n,e=[],t){e.forEach(s=>{n.watch(t.__parseExpression(s.source),t.__parseFunction(s.handler),{deep:s.deep,immediate:s.immediate})})}function _t(n,e){return Object.entries(n??{}).reduce((t,[s,r])=>{const o=e.__parseFunction(r);return t[s]=async()=>{f.isFunction(o)&&(await f.delay(0),await o())},t},{})}const qe=new f.Queue;let X=[],M={};const Je=n=>n;async function le(n,e=window){const{urls:t=[],library:s}=n,r=t.filter(i=>B(i));if(r.length===0||!s)return null;const o=t.filter(i=>U(i));return o.length&&oe(o,e),await ie(r,s,e).catch(i=>(console.warn("loadScriptUrl error",r,s,i),null))}function G(n){const{getDsl:e,getDslByUrl:t,options:s}=n;return s.window&&(X.forEach(r=>{delete s.window[r]}),X=[]),(r,o,a=K)=>{if(!o||typeof o=="string")return r;if(o.type==="Schema"&&o.id)return a.defineAsyncComponent(async()=>{const i=M[o.id]||await qe.add(o.id,()=>e(o.id));return i&&(i.name=r,M[o.id]=i),i?J({...s,Vue:a,dsl:f.cloneDeep(i),mode:S.Runtime,loader:G(n)}).renderer:null});if(o.type==="UrlSchema"&&o.url)return a.defineAsyncComponent(async()=>{const i=M[o.url]||await t(o.url);return i&&(i.name=r,M[o.url]=i),i?J({...s,Vue:a,dsl:f.cloneDeep(i),mode:S.Runtime,loader:G(n)}).renderer:null});if(o.type==="Plugin"){let i=o.library?M[o.library]:null;return i||(o.library&&X.push(o.library),i=M[o.library||Symbol()]=a.defineAsyncComponent(async()=>{const l=await le(o,s.window);return l||(console.warn("getPlugin result is null",o),null)}),i)}return r}}function St(){M={},qe.clearAllCache()}function O(n,e,t=K,s=Je,r=[],o=!1){if(!n||!n.name||n.invisible)return null;const a=t.getCurrentInstance()?.appContext,{id:i=null,directives:l=[]}=n,{vIf:c,vElseIf:p,vElse:u,vFor:d,vShow:m,vModels:h,vBind:g,vHtml:y,others:v}=Ge(l);if(!o&&(p||u))return null;if(c&&!Et(c,e))return Rt(n,e,t,s,r);const w=(_,E=0)=>{const I=_.$components,Q=(()=>{if(n.name==="component")return bt(_,n.props?.is);if(n.name==="slot")return n.name;const P=s(n.name,n.from,t);return f.isString(P)?Te(P)||Me(P)?P:I[P]??a?.app?.component(P)??P:P})(),A=$t(i,n.props??{},_),Qe=jt(t,n.events??{},_);if(n.name==="slot")return Ct(t,n,A,_,s);g&&Object.assign(A,_.__parseExpression(g.value)),m&&(A.style=Object.assign(A.style??{},At(m,_))),y&&Object.assign(A,It(y,_)),h.forEach(P=>{Object.assign(A,Tt(t,P,_))});const Ye=Mt(t,n.children??[],_,s,n),he=_?.__id?`data-v-${_.__id}`:void 0,Xe=he?{[he]:""}:{};let Y=t.createVNode(Q,{key:`${i}_${E}`,...Xe,...A,...Qe},Ye);const me=a?wt(a,v,_):[];return me.length&&(Y=t.withDirectives(Y,me)),Y};return d?Ft(d,w,e):w(e)}function wt(n,e,t){const s=n.app;return e.map(r=>{const o=typeof r.name=="string"?s.directive(r.name):t.__parseExpression(r.name);if(!o)return null;const a=[o];return r.value&&a.push(t.__parseExpression(r.value)),r.arg&&a.push(r.arg),r.modifiers&&a.push(r.modifiers),a}).filter(r=>!!r)}function Ge(n=[]){const e=n.find(p=>f.camelCase(p.name)==="vIf"),t=n.find(p=>f.camelCase(p.name)==="vElseIf"),s=n.find(p=>f.camelCase(p.name)==="vElse"),r=n.find(p=>f.camelCase(p.name)==="vFor"),o=n.find(p=>f.camelCase(p.name)==="vShow"),a=n.find(p=>f.camelCase(p.name)==="vBind"),i=n.find(p=>f.camelCase(p.name)==="vHtml"),l=n.filter(p=>f.camelCase(p.name)==="vModel"),c=n.filter(p=>!ye.includes(f.camelCase(p.name)));return{vIf:e,vElseIf:t,vElse:s,vFor:r,vShow:o,vModels:l,vBind:a,others:c,vHtml:i}}function Et(n,e){return!!e.__parseExpression(n.value)}function bt(n,e){return e?R(e)?n.__parseExpression(e):e:"div"}function $t(n,e,t){const s=se(e,t);return s.ref=t.__ref(n,s.ref),s}function se(n,e){return R(n)?e.__parseExpression(n):j(n)?e.__parseFunction(n):Array.isArray(n)?n.map(t=>se(t,e)):typeof n=="object"?Object.keys(n||{}).reduce((t,s)=>{let r=n[s];return t[s]=se(r,e),t},{}):n}function jt(n,e,t){const s=["passive","capture","once"],r={capture:"Capture",once:"Once",passive:"OnceCapture"};return Object.keys(e||{}).reduce((o,a)=>{const i=e[a],l=ue(i.modifiers),c=l.find(d=>s.includes(d)),p="on"+f.upperFirst(a)+(c&&r[c]||""),u=t.__parseFunction(i.handler);return u&&(o[p]=n.withModifiers(u,l)),o},{})}function Rt(n,e,t,s,r=[]){let o=r.findIndex(a=>a.id===n.id);for(let a=++o;a<r.length;a++){const{directives:i=[]}=r[a],{vElseIf:l,vElse:c}=Ge(i);if(l){if(e.__parseExpression(l.value))return O(r[a],e,t,s,r,!0);continue}if(c)return O(r[a],e,t,s,r,!0)}return null}function ue(n={},e=!1){const t=Object.keys(n);return e?t.map(s=>"."+s):t}function Ct(n,e,t,s,r){const{children:o}=e,a=Pt(e,s),i=s.$slots?.[a.name];return i?i(t):o?f.isString(o)?n.createTextVNode(o):R(o)?n.createTextVNode(re(s.__parseExpression(o))):Array.isArray(o)?o.map(l=>O(l,s,n,r,o)):null:null}function Pt(n,e){const{props:t}=n,s=t?.name||"default";return{name:R(s)?e.__parseExpression(s):s,params:[]}}function At(n,e){return e.__parseExpression(n.value)?{}:{display:"none"}}function It(n,e){return{innerHTML:e.__parseExpression(n.value)||""}}function Tt(n,e,t){const s={type:"JSFunction",value:e.value?.value?`(v) => {
|
|
12
|
+
`:`with(${t?"{}":"$scope || {}"}) { ${a} }`;return new Function("$scope",i)(e)}catch(o){if(f.logger.error("parseExpression.error",o,n,e?.__self??e),s)throw o}}function C(n,e,t=!1,s=!1,r=!1){const o=D(n,e,t,s,r);if(typeof o!="function"&&(f.logger.error("parseFunction.error","not a function",n,e?.__self??e),s))throw new Error(`"${n.value}" not a function`);return o}function R(n){return n&&n.type==="JSExpression"}function j(n){return typeof n=="object"&&n&&n.type==="JSFunction"}function Oe(n){return R(n)||j(n)}function ct(n){return Oe(n)?n.value:JSON.stringify(n)}const lt={session:!1,authKey:"Authorization",storageKey:"ACCESS_STORAGE",storagePrefix:"__VTJ_",unauthorized:void 0,auth:"/#/login",redirectParam:"r",unauthorizedCode:401,unauthorizedMessage:"登录已经失效,请重新登录!",noPermissionMessage:"无权限访问该页面",appName:"",statusKey:"code"},ae=Symbol("access");class V{options;data=null;mode=S.Raw;interceptResponse=!0;isTipShowing=!1;constructor(e){this.options=Object.assign({},lt,e),this.loadData()}enableIntercept(){this.interceptResponse=!0}disableIntercept(){this.interceptResponse=!1}connect(e){const{mode:t,router:s,request:r}=e;this.mode=t,s&&this.mode!==S.Design&&this.setGuard(s),r&&this.setRequest(r)}login(e){const{storageKey:t,storagePrefix:s,session:r,authKey:o}=this.options;this.setData(e),this.data&&(f.storage.save(t,e,{type:"local",prefix:s}),r&&f.cookie.set(o,this.data.token))}clear(){const{storageKey:e,storagePrefix:t,session:s,authKey:r}=this.options;this.data=null,f.storage.remove(e,{type:"local",prefix:t}),s&&f.cookie.remove(r)}logout(){this.clear(),this.toLogin()}getData(){return this.data?this.data:(this.loadData(),this.data)}getToken(){return this.data||this.loadData(),this.data?.token}can(e){const{appName:t}=this.options,{permissions:s={}}=this.data||{};return typeof e=="function"?e(s):f.toArray(e).every(o=>s[o]||s[t+"."+o])}some(e){const{appName:t}=this.options,{permissions:s={}}=this.data||{};return f.toArray(e).some(o=>s[o]||s[t+"."+o])}install(e){e.config.globalProperties.$access=this,e.provide(ae,this)}isAuthPath(e){const{auth:t,isAuth:s}=this.options;if(s)return s(e);if(e.path&&typeof t=="string"){const r=t.split("#")[1]||t;return e.path===r}return!1}toLogin(){const{auth:e,redirectParam:t}=this.options;if(!e)return;const s=t?`?${t}=${encodeURIComponent(location.href)}`:"";typeof e=="function"?e(s):location.href=t?`${e}${s}`:e}setData(e){const{privateKey:t}=this.options;if(Array.isArray(e)&&t){const s=e.map(r=>f.unRSA(r,t));try{this.data=JSON.parse(s.join(""))}catch(r){console.warn(r)}return}if(typeof e=="string")try{const s=t?f.unRSA(e,t):e;s?this.data=JSON.parse(s):console.warn("RSA解密失败或登录信息缺失")}catch(s){console.warn(s)}else this.data=e}loadData(){const{storageKey:e,storagePrefix:t}=this.options,s=f.storage.get(e,{type:"local",prefix:t});this.setData(s||null)}isLogined(){const{session:e,authKey:t}=this.options;return e&&t?!!f.cookie.get(t):!!this.getToken()}hasRoutePermission(e){if(e.name===F){const t=e.params.id;return t&&this.can(t)}return e.meta.__vtj__?this.can(e.meta.__vtj__):e.meta.permission?this.can(e.meta.permission):!0}setGuard(e){e.beforeEach((t,s,r)=>this.guard(t,r))}async guard(e,t){if(this.isWhiteList(e)||this.isAuthPath(e))return t();if(this.isLogined()){if(this.hasRoutePermission(e))return t();{const{noPermissionMessage:s="无权限访问",unauthorized:r=!1}=this.options;return await this.showTip(s),f.isFunction(r)?(r(),t(!1)):f.isString(r)?t(r):t(!1)}}t(!1),await f.delay(0),this.toLogin()}isWhiteList(e){const{whiteList:t}=this.options;return t?Array.isArray(t)?t.some(s=>e.fullPath.startsWith(s)):t(e):!1}isUnauthorized(e){const{unauthorizedCode:t=401,statusKey:s="code"}=this.options;return e.status===t||e.data?.[s]===t}async showUnauthorizedAlert(e){const{unauthorizedMessage:t="登录已失效"}=this.options;this.isUnauthorized(e)&&await this.showTip(t)&&this.toLogin()}async showTip(e){const{alert:t}=this.options;return this.isTipShowing?!1:t?(this.isTipShowing=!0,await f.delay(150),await t(e,{title:"提示",type:"warning"})?.catch(()=>!0)?.finally(()=>{this.isTipShowing=!1})):(window.alert(e),!0)}setRequest(e){e.useRequest(t=>(this.data?.token&&(t.headers[this.options.authKey]=this.data?.token),t)),e.useResponse(async t=>(this.interceptResponse&&await this.showUnauthorizedAlert(t),t),async t=>{if(!this.interceptResponse)return Promise.reject(t);const s=t.response||t||{};return await this.showUnauthorizedAlert(s),Promise.reject(t)})}}function ke(){return $.inject(ae,null)}function ut(n={}){const{notify:e,loading:t,settings:s={},Startup:r,access:o,useTitle:a,alert:i}=n;let l=null;return{request:f.createRequest({settings:{type:"form",validSuccess:!0,originResponse:!1,loading:!0,validate:p=>p.data?.code===0||!!p.data?.success,failMessage:!0,showError:p=>{e&&e(p||"未知错误")},showLoading:()=>{l&&l.close(),t&&(l=t())},hideLoading:()=>{l&&(l.close(),l=null)},...s}}),jsonp:f.jsonp,notify:e,loading:t,useTitle:a,alert:i,startupComponent:r,access:o?new V({alert:i,...o}):void 0}}function pt(n={}){return new V(n)}function Fe(n,e){const{jsonp:t,request:s}=e;if(n.method==="jsonp")return(r={})=>t(n.url,{...n.jsonpOptions,query:r});{const r=n.headers?D(n.headers,{},!0):void 0,o={url:n.url,method:n.method,settings:{...n.settings,headers:r}};return(a,i)=>(delete o.data,s.send(f.merge(o,i||{},{data:a})))}}function xe(n,e){const{metaQuery:t}=e;if(!t)return;const{code:s,queryCode:r}=n;return(o,a)=>{if(!t){console.warn("adapter.metaQuery is not defined!");return}return t(s,r,o,a)}}function De(n=[],e=[],t){const s={};for(const r of n){const o=Fe(r,t);s[r.id]=o,s[r.name]=o}for(const r of e)s[r.id]=xe(r,t);return s}async function He(n=[],e=window){const t=x(e);t&&(ce(e),n.forEach(s=>Ne(t,s)))}function Le(n,e=window){const t=j(n.mockTemplate)&&n.mockTemplate.value?C(n.mockTemplate,{},!0):void 0,s=x(e);return async(...r)=>{let o={};if(t)try{o=await t.apply(t,r)}catch(a){f.logger.warn("模拟数据模版异常",a)}return s?.mock(o)}}function Ne(n,e){if(!e.mock)return;const{url:t,mockTemplate:s}=e;if(t&&s)try{const r=f.isUrl(t)?new URL(t).pathname:t,o=f.pathToRegexp(`(.*)${r}(.*)`),a=f.pathToRegexpMatch(r,{decode:decodeURIComponent}),i=D(s,{},!0);n.mock(o,l=>{const c=f.url.parse(l.url)||{},p=l.body instanceof FormData?f.formDataToJson(l.body):l.body,u=f.isUrl(l.url)?new URL(l.url).pathname:l.url.split("?")[0],d=a(u)?.params;Object.assign(l,{data:p,params:d,query:c});try{return n.mock(i(l))}catch(m){return console.warn("[mockApi]",o,l,m),null}})}catch(r){console.warn("mockApi",r)}}function ce(n=window){const e=x(n);e&&(e._mocked={})}class Ue{__id=null;__mode;__instance=null;__contextRefs={};__refs={};context={};state={};props={};$props={};$refs={};$el=null;$emit=null;$nextTick=null;$parent=null;$root=null;$attrs=null;$slots=null;$watch=null;$options=null;$forceUpdate=null;$components={};$libs={};$apis={};$provider=null;__transform={};constructor(e){const{mode:t,dsl:s,attrs:r}=e;this.__mode=t,s&&(this.__id=s.id||null,this.__transform=s.transform||{}),r&&Object.assign(this,r)}setup(e,t=G){const s=t.getCurrentInstance();if(!s)return;this.__refs={},this.$refs={},this.context={},this.__contextRefs={},this.__instance=s.proxy;const r=s.appContext.config.globalProperties;Object.assign(this,r),Object.assign(this,e||{}),this.__proxy(),t.onMounted(()=>{this.__proxy()}),t.onUnmounted(()=>{this.__cleanup()}),t.onBeforeUpdate(()=>{this.__reset()})}__proxy(){this.__instance&&te.forEach(e=>{this[e]=this.__instance?.[e]})}__cleanup(){te.forEach(e=>{this[e]=null}),this.__reset()}__reset(){this.__refs={},this.$refs={},this.__contextRefs={},this.context={}}__parseFunction(e){if(e)if(this.__mode===S.Runtime){const{id:t,type:s}=e,r=t?this.__transform[t]??e.value:e.value;return C({type:s,value:r},this)}else return C(e,this)}__parseExpression(e){if(e)if(this.__mode===S.Runtime){const{id:t,type:s}=e,r=t?this.__transform[t]??e.value:e.value;return D({type:s,value:r},this)}else return D(e,this)}__ref(e=null,t){if(this.__mode!==S.VNode)return e&&e!==this.__id&&(this.__contextRefs[e]=this),async s=>{await f.delay(0);let r=s?.$vtjEl||s?.$el||s?._?.vnode?.el||s;if(!r){typeof t=="string"&&(delete this.$refs[t],e&&delete this.__refs[e]);return}return r.nodeType===3&&r.nextSibling&&(r=r.nextSibling),r.__vtj__=e,S.Design===this.__mode&&(r.__context__=this,r.draggable=!0),e&&(this.__refs[e]=this.__getRefEl(this.__refs,e,s)),typeof t=="function"?t(s):t&&(this.$refs[t]=this.__getRefEl(this.$refs,t,s)),s}}__getRefEl(e,t,s){const r=e[t];if(r&&s!==r){const o=new Set([].concat(r,s));return Array.from(o)}else return s}__clone(e={}){const t={...this.context,...e},s={...t,context:t};return s.context.__proto__=this.context,s.__proto__=this,s}}function J(n){const{Vue:e=G,mode:t=S.Runtime,components:s={},libs:r={},apis:o={},loader:a}=n,i=e.computed(()=>n.dsl),l={$components:s,$libs:r,$apis:o},c=new Ue({mode:t,dsl:i.value,attrs:l}),p=e.defineComponent({name:i.value.name,__scopeId:i.value.id?`data-v-${i.value.id}`:void 0,props:{...dt(i.value.props??[],c)},async setup(u){c.$props=u,c.props=u,i.value.id&&z(n.window||window,i.value.id,i.value.css||"",!0),c.state=ht(e,i.value.state??{},c);const d=mt(e,i.value.computed??{},c),m=gt(i.value.methods??{},c),h=yt(e,i.value.inject,c);for(const[v,w]of Object.entries(h||{}))h[v]=e.inject(v,w);const g=Be(i.value.dataSources||{},c),y={...h,...d,...m,...g};return c.setup(y,e),vt(e,i.value.watch??[],c),{vtj:c,state:c.state,...d,...m}},emits:ft(i.value.emits),expose:["vtj",...i.value.expose||[]],render(){if(!i.value.nodes)return null;const u=i.value.nodes||[];return u.length===1?O(u[0],c,e,a,u):u.map(d=>O(d,c,e,a,u))},..._t(i.value.lifeCycles??{},c)});return{renderer:e.markRaw(p),context:c}}function ft(n=[]){return n.map(e=>f.isString(e)?e:e.name)}function dt(n=[],e){const t=s=>s?(Array.isArray(s)?s:[s]).map(o=>ve[o]):void 0;return n.map(s=>f.isString(s)?{name:s}:{name:s.name,type:s.type,required:s.required,default:R(s.default)?e.__parseExpression(s.default):s.default}).reduce((s,r)=>(s[r.name]={type:t(r.type),required:r.required,default:r.default},s),{})}function ht(n,e,t){return n.reactive(Object.keys(e||{}).reduce((s,r)=>{let o=e[r];return R(o)?o=t.__parseExpression(o):j(o)&&(o=t.__parseFunction(o)),s[r]=o,s},{}))}function mt(n,e,t){return Object.entries(e??{}).reduce((s,[r,o])=>(s[r]=n.computed(t.__parseFunction(o)),s),{})}function gt(n,e){return Object.entries(n??{}).reduce((t,[s,r])=>(t[s]=e.__parseFunction(r),t),{})}function yt(n,e=[],t){return e.reduce((s,r)=>{const{name:o,from:a}=r||{};r.default;const i=R(a)?t.__parseExpression(a)||o:a??o,l=R(r.default)?t.__parseExpression(r.default):r.default??null;return s[o]=n.inject(i,l),s},{})}function Be(n,e){return Object.keys(n).reduce((t,s)=>{const r=n[s];if(r.type==="mock")t[s]=Le(r);else if(r.ref){const o=e.$apis[r.ref],a=j(r.transform)?r.transform.value?e.__parseFunction(r.transform):void 0:r.transform;t[s]=async(...i)=>{const l=await o.apply(e,i);return a?a(l):l}}return t},{})}function vt(n,e=[],t){e.forEach(s=>{n.watch(t.__parseExpression(s.source),t.__parseFunction(s.handler),{deep:s.deep,immediate:s.immediate})})}function _t(n,e){return Object.entries(n??{}).reduce((t,[s,r])=>{const o=e.__parseFunction(r);return t[s]=async()=>{f.isFunction(o)&&(await f.delay(0),await o())},t},{})}const qe=new f.Queue;let X=[],M={};const Je=n=>n;async function le(n,e=window){const{urls:t=[],library:s}=n,r=t.filter(i=>B(i));if(r.length===0||!s)return null;const o=t.filter(i=>U(i));return o.length&&oe(o,e),await ie(r,s,e).catch(i=>(console.warn("loadScriptUrl error",r,s,i),null))}function K(n){const{getDsl:e,getDslByUrl:t,options:s}=n;return s.window&&(X.forEach(r=>{delete s.window[r]}),X=[]),(r,o,a=G)=>{if(!o||typeof o=="string")return r;if(o.type==="Schema"&&o.id)return a.defineAsyncComponent(async()=>{const i=M[o.id]||await qe.add(o.id,()=>e(o.id));return i&&(i.name=r,M[o.id]=i),i?J({...s,Vue:a,dsl:f.cloneDeep(i),mode:S.Runtime,loader:K(n)}).renderer:null});if(o.type==="UrlSchema"&&o.url)return a.defineAsyncComponent(async()=>{const i=M[o.url]||await t(o.url);return i&&(i.name=r,M[o.url]=i),i?J({...s,Vue:a,dsl:f.cloneDeep(i),mode:S.Runtime,loader:K(n)}).renderer:null});if(o.type==="Plugin"){let i=o.library?M[o.library]:null;return i||(o.library&&X.push(o.library),i=M[o.library||Symbol()]=a.defineAsyncComponent(async()=>{const l=await le(o,s.window);return l||(console.warn("getPlugin result is null",o),null)}),i)}return r}}function St(){M={},qe.clearAllCache()}function O(n,e,t=G,s=Je,r=[],o=!1){if(!n||!n.name||n.invisible)return null;const a=t.getCurrentInstance()?.appContext,{id:i=null,directives:l=[]}=n,{vIf:c,vElseIf:p,vElse:u,vFor:d,vShow:m,vModels:h,vBind:g,vHtml:y,others:v}=Ke(l);if(!o&&(p||u))return null;if(c&&!Et(c,e))return Ct(n,e,t,s,r);const w=(_,E=0)=>{const I=_.$components,Q=(()=>{if(n.name==="component")return bt(_,n.props?.is);if(n.name==="slot")return n.name;const P=s(n.name,n.from,t);return f.isString(P)?Te(P)||Me(P)?P:I[P]??a?.app?.component(P)??P:P})(),A=$t(i,n.props??{},_),Qe=Rt(t,n.events??{},_);if(n.name==="slot")return Pt(t,n,A,_,s);g&&Object.assign(A,_.__parseExpression(g.value)),m&&(A.style=Object.assign(A.style??{},It(m,_))),y&&Object.assign(A,Tt(y,_)),h.forEach(P=>{Object.assign(A,Mt(t,P,_))});const Ye=Ot(t,n.children??[],_,s,n),he=_?.__id?`data-v-${_.__id}`:void 0,Xe=he?{[he]:""}:{};let Y=t.createVNode(Q,{key:`${i}_${E}`,...Xe,...A,...Qe},Ye);const me=a?wt(a,v,_):[];return me.length&&(Y=t.withDirectives(Y,me)),Y};return d?xt(d,w,e):w(e)}function wt(n,e,t){const s=n.app;return e.map(r=>{const o=typeof r.name=="string"?s.directive(r.name):t.__parseExpression(r.name);if(!o)return null;const a=[o];return r.value&&a.push(t.__parseExpression(r.value)),r.arg&&a.push(r.arg),r.modifiers&&a.push(r.modifiers),a}).filter(r=>!!r)}function Ke(n=[]){const e=n.find(p=>f.camelCase(p.name)==="vIf"),t=n.find(p=>f.camelCase(p.name)==="vElseIf"),s=n.find(p=>f.camelCase(p.name)==="vElse"),r=n.find(p=>f.camelCase(p.name)==="vFor"),o=n.find(p=>f.camelCase(p.name)==="vShow"),a=n.find(p=>f.camelCase(p.name)==="vBind"),i=n.find(p=>f.camelCase(p.name)==="vHtml"),l=n.filter(p=>f.camelCase(p.name)==="vModel"),c=n.filter(p=>!ye.includes(f.camelCase(p.name)));return{vIf:e,vElseIf:t,vElse:s,vFor:r,vShow:o,vModels:l,vBind:a,others:c,vHtml:i}}function Et(n,e){return!!e.__parseExpression(n.value)}function bt(n,e){return e?R(e)?n.__parseExpression(e):e:"div"}function $t(n,e,t){const s=se(e,t);return s.ref=t.__ref(n,s.ref),s}function se(n,e){return R(n)?e.__parseExpression(n):j(n)?e.__parseFunction(n):Array.isArray(n)?n.map(t=>se(t,e)):typeof n=="object"?Object.keys(n||{}).reduce((t,s)=>{let r=n[s];return t[s]=se(r,e),t},{}):n}function jt(n,e){return t=>{t?.key?.toLowerCase()===e.toLowerCase()&&n(t)}}function Rt(n,e,t){const s=["passive","capture","once"],r={capture:"Capture",once:"Once",passive:"OnceCapture"};return Object.keys(e||{}).reduce((o,a)=>{const i=e[a],l=ue(i.modifiers),c=l.find(d=>s.includes(d)),p="on"+f.upperFirst(a)+(c&&r[c]||""),u=t.__parseFunction(i.handler);return u&&(o[p]=n.withModifiers(l.includes("enter")?jt(u,"enter"):u,l)),o},{})}function Ct(n,e,t,s,r=[]){let o=r.findIndex(a=>a.id===n.id);for(let a=++o;a<r.length;a++){const{directives:i=[]}=r[a],{vElseIf:l,vElse:c}=Ke(i);if(l){if(e.__parseExpression(l.value))return O(r[a],e,t,s,r,!0);continue}if(c)return O(r[a],e,t,s,r,!0)}return null}function ue(n={},e=!1){const t=Object.keys(n);return e?t.map(s=>"."+s):t}function Pt(n,e,t,s,r){const{children:o}=e,a=At(e,s),i=s.$slots?.[a.name];return i?i(t):o?f.isString(o)?n.createTextVNode(o):R(o)?n.createTextVNode(re(s.__parseExpression(o))):Array.isArray(o)?o.map(l=>O(l,s,n,r,o)):null:null}function At(n,e){const{props:t}=n,s=t?.name||"default";return{name:R(s)?e.__parseExpression(s):s,params:[]}}function It(n,e){return e.__parseExpression(n.value)?{}:{display:"none"}}function Tt(n,e){return{innerHTML:e.__parseExpression(n.value)||""}}function Mt(n,e,t){const s={type:"JSFunction",value:e.value?.value?`(v) => {
|
|
13
13
|
${e.value.value} = v;
|
|
14
|
-
}`:"(v) => {}"},r=t.__parseFunction(s),o=ue(R(e.modifiers)?t.__parseExpression(e.modifiers):e.modifiers),a=R(e.arg)?t.__parseExpression(e.arg):e.arg||"modelValue";return{[a]:t.__parseExpression(e.value),[`onUpdate:${a}`]:o.length&&r?n.withModifiers(r,o):r}}function Mt(n,e,t,s,r){if(!e)return null;if(f.isString(e))return{default:()=>e};if(R(e))return{default:()=>re(t.__parseExpression(e))};if(Array.isArray(e)&&e.length>0){const o=Ot(e),a=(i,l)=>!i||!r?{}:r?.id&&Object.keys(i).length?l?{[l]:i}:{[`scope_${r.id}`]:i}:l?{[l]:Object.create(null)}:{};return Object.entries(o).reduce((i,[l,{nodes:c,params:p,scope:u}])=>(i[l]=d=>{const m=p.length?f.pick(d??{},p):a(d,u);return c.map(h=>O(h,t.__clone(m),n,s,c))},i),{})}return null}function Ot(n){const e={};for(const t of n){const s=kt(t.slot),r=s.name;e[r]?(e[r].nodes.push(t),e[r].params=e[r].params.concat(s.params),e[r].scope=s.scope||""):e[r]={nodes:[t],params:s.params,scope:s.scope||""}}return e}function kt(n="default"){return f.isString(n)?{name:n,params:[],scope:""}:{params:[],scope:"",...n}}function Ft(n,e,t){const{value:s,iterator:r}=n,{item:o="item",index:a="index"}=r||{};let i=t.__parseExpression(s)||[];return Number.isInteger(i)&&(i=new Array(i).fill(!0).map((l,c)=>c+1)),Array.isArray(i)?i.map((l,c)=>e(t.__clone({[o]:l,[a]:c}),c)):(console.warn("[vForRender]:",`${s?.value} is not a Arrary`),[])}const Z=$.defineComponent({name:"VtjPageContainer",async setup(){const n=de(),e=ge.useRoute(),t=e.meta.__vtj__||e.params.id,s=t?n.getPage(t):n.getHomepage(),r=s?await n.getRenderComponent(s.id):null,o=$.ref(Symbol());if(s){Object.assign(e.meta,s.meta||{},{cache:s.cache});const{useTitle:a}=n?.adapter;if(a){const i=e.meta.title||s.title||"VTJ.PRO";a(i)}}return{provider:n,component:r,file:s,query:e.query,meta:e.meta,sid:o,route:e}},render(){const{component:n,query:e,sid:t}=this;return n?$.h(n,{...e,key:t}):$.h("div","页面不存在")},activated(){this.meta.cache===!1&&(this.sid=Symbol())}}),xt=$.defineComponent({name:"VtjStartupContainer",render(){return $.h("div","page not found!")}});function N(n,e,t=[]){const s=[];for(const r of t){const{id:o,title:a,icon:i,children:l,hidden:c,layout:p}=r;if(p){const u=N(n,e,l||[]);s.push(...u)}else{const u={id:o,title:a,icon:i,hidden:c,url:`${n}/${e}/${o}`,children:l&&l.length?N(n,e,l):void 0};s.push(u)}}return s}function pe(n,e){if(!e)return n;let t=[];for(const s of n)if(s.children&&s.children.length){const r=pe(s.children,e);r.length&&(s.children=r,t.push(s))}else e.can(s.id.toString())&&t.push(s);return t}function Dt(n){const{menuPathPrefix:e="",pageRouteName:t="page",disableMenusFilter:s=!1}=n||{},r=de(),o=ge.useRoute(),a=ke(),i=$.ref(!1),l=$.ref(!1),c=r.project,p=(m,h)=>{i.value=!m?.mask,l.value=h?.pure??!!m?.pure};$.watchEffect(()=>{const{name:m,params:h,meta:g}=o;if(m===F){const y=r.getPage(h.id);p(y,g)}else if(m===L){const y=r.getHomepage();p(y,g)}else{const y=g.__vtj__;if(y){const v=r.getPage(y);p(v,g)}else i.value=!g.mask,l.value=!!g.pure}});const u=N(e,t,c?.pages),d=c?.config;return{disabled:i,logo:d?.logo,themeSwitchable:d?.themeSwitchable,title:d?.title||c?.description||c?.name||"VTJ App",menus:s?u:pe(u,a),pure:l}}function ee(n,e){const{id:t,title:s,meta:r}=n,{name:o="page",prefix:a="",component:i,routeMeta:l}=e;return{name:t,path:`${a}${o}/${t}`,component:i,meta:{title:s,...l,...r,__vtj__:t}}}function ne(n){const{name:e="page",prefix:t="",pages:s=[],component:r,loader:o,routeMeta:a,homepage:i}=n,l=[];for(const c of s){const{id:p,title:u,dir:d,layout:m,children:h,meta:g}=c;if(d){const y=ne({name:e,prefix:t,component:r,routeMeta:a,homepage:i,loader:o,pages:h||[]});l.push(...y)}else if(m){const y=ne({name:e,prefix:t,component:r,routeMeta:a,homepage:i,loader:o,pages:h||[]}),v={name:`layout_${p}`,path:t,component:()=>o(p),meta:{title:u,...a,...g,__vtj__:p},children:y};l.push(v),l.push(ee(c,n))}else if(l.push(ee(c,n)),i===p){const y=ee(c,n);y.path="",y.name=`home_${p}`,l.push(y)}}return l}function Ht(n={},e){const{css:t,store:s,enhance:r}=n,{window:o,app:a,library:i={},adapter:l,mode:c}=e,{Pinia:p}=i;a.config.globalProperties.$libs=i,z(o,"global-css",t||""),p&&s&&Lt(s,a,p),Ut(a,l,n),!l.access&&n.access&&Nt(n.access,a,c,l),Bt(a,n),r&&qt(r,a,i)}function Lt(n,e,t){const s=t.createPinia();if(e.use(s),j(n)&&n.value){const r=C(n,{},!1,!1,!0),o=t.defineStore("$store",r(e)||{});e.config.globalProperties.$store=o()}}function Nt(n,e,t,s){if(j(n)&&n.value){const r=C(n,{},!1,!1,!0),{alert:o,request:a}=s,i=new V({alert:o,storagePrefix:"__VTJ_APP_",...r(e)}),l=e.config.globalProperties.$router;i.connect({mode:t,router:l,request:a}),e.use(i)}}function Ut(n,e,t){if(!e.request)return;const{axios:s,request:r,response:o}=t;if(s&&j(s)&&s.value){const a=C(s,{},!1,!1,!0);e.request.setConfig(a(n))}if(r&&j(r)&&r.value){const a=C(r,{},!1,!1,!0),i=e.request;i.__unReq&&i.__unReq(),i.__unReq=e.request.useRequest(l=>a(l,n))}if(o&&j(o)&&o.value){const a=C(o,{},!1,!1,!0),i=e.request;i.__unRes&&i.__unRes(),i.__unRes=e.request.useResponse(l=>a(l,n))}}function Bt(n,e){const{beforeEach:t,afterEach:s}=e,r=n.config.globalProperties.$router;if(t&&j(t)&&t.value){const o=C(t,{},!1,!1,!0);r&&r.beforeEach((a,i,l)=>o(a,i,l,n))}if(s&&j(s)&&s.value){const o=C(s,{},!1,!1,!0);r&&r.afterEach((a,i,l)=>o(a,i,l,n))}}function qt(n,e,t={}){j(n)&&n.value&&C(n,{},!1,!1,!0)(e,t)}function Jt(n,e,t){if(!n||!e||!t)return;const{VueI18n:s}=e;if(s){const{locale:r,fallbackLocale:o,messages:a=[]}=t,i={};for(let c of a){const p=Object.keys(c).filter(u=>u!=="key");for(const u of p)i[u]||(i[u]={}),i[u][c.key]=c[u]}const l=s.createI18n({legacy:!1,locale:r,fallbackLocale:o,messages:i});n.use(l)}}const fe=Symbol("Provider");var Ke=(n=>(n.Production="production",n.Development="development",n))(Ke||{});class ze extends T.Base{constructor(e){super(),this.options=e;const{service:t,mode:s=S.Raw,dependencies:r,materials:o,project:a={},adapter:i={},globals:l={},modules:c={},router:p=null,materialPath:u="./",nodeEnv:d="development"}=e;this.mode=s,this.modules=c,this.service=t,this.router=p,this.materialPath=u,this.nodeEnv=d,r&&(this.dependencies=r),o&&(this.materials=o),Object.assign(this.globals,l),Object.assign(this.adapter,i);const{access:m,request:h}=this.adapter;m&&m.connect({mode:s,router:p,request:h}),a&&s!==S.Design?this.load(a):this.project=a}mode;globals={};modules={};adapter={request:f.request,jsonp:f.jsonp};apis={};dependencies={};materials={};library={};libraryLocales={};libraryLocaleMap={};service;project=null;components={};nodeEnv="development";env={};router=null;materialPath="./";urlDslCaches={};errorHandler=null;createMock(e){return async(...t)=>{let s={};if(e)try{s=await e.apply(e,t)}catch(o){f.logger.warn("模拟数据模版异常",o)}return x()?.mock(s)}}async load(e){const{vtjDir:t=".vtj"}=this.options,s=this.modules[`${t}/projects/${e.id}.json`]||this.modules[`/src/${t}/projects/${e.id}.json`];if(this.project=s?await s():await this.service.init(e),!this.project)throw new Error("project is null");const{apis:r=[],meta:o=[],env:a=[]}=this.project,i=window;i&&(i.CKEDITOR_VERSION=void 0),this.initEnv(a),this.mode===S.Raw?await this.loadDependencies(i):await this.loadAssets(i),this.initMock(i),this.apis=De(r,o,this.adapter),ce(i),He(r,i),e.platform!=="uniapp"&&this.initRouter(),this.triggerReady()}initMock(e){const t=x(e);t&&t.setup({timeout:"50-500"})}async loadDependencies(e={}){const t=Object.entries(this.dependencies);for(const[s,r]of t)e[s]||(e[s]=this.library[s]=await r())}async loadAssets(e={}){const{dependencies:t=[]}=this.project,{dependencies:s,library:r,components:o,materialPath:a,nodeEnv:i,libraryLocales:l}=this,{libraryExports:c,libraryMap:p,materials:u,materialExports:d,materialMapLibrary:m,libraryLocaleMap:h}=be(t,a,i==="development");Object.assign(this.libraryLocaleMap,h);for(const g of c){const y=s[g],v=e[g];if(v)r[g]=v;else if(y)e[g]=r[g]=await y();else{const _=p[g]||[];for(const E of _)U(E)&&await Ae(E,f.url.append(E,{v:k})),B(E)&&await f.loadScript(f.url.append(E,{v:k}));r[g]=e[g]}const w=h[g];if(w){const _=s[w];l[w]=_?await _():e[w]}}if(i==="development"){for(const y of u)await f.loadScript(f.url.append(y,{v:k}));const g=this.materials||{};for(const y of d){const v=e[m[y]],w=v?.default||v,_=T.BUILT_IN_COMPONENTS[y];if(_)w&&_.forEach(E=>{o[E]=w[E]});else{const E=g[y]?(await g[y]()).default:e[y];E&&w&&(E.components||[]).forEach(I=>{o[I.name]=$e(I,w)})}}}}initRouter(){const{router:e,project:t,options:s,adapter:r}=this;if(!e)return;const o=t?.platform==="uniapp"?"pages":"page",{routeAppendTo:a,pageRouteName:i=o,routeMeta:l}=s,c=a?"":"/",p={path:`${c}${i}/:id`,name:F,component:Z},u={path:c,name:L,component:t?.homepage?Z:r.startupComponent||xt,meta:l};if(e.hasRoute(F)&&e.removeRoute(F),e.hasRoute(L)&&e.removeRoute(L),s.enableStaticRoute){const d=t?.pages||[];ne({name:i,prefix:c,pages:d,component:Z,loader:this.getRenderComponent.bind(this),homepage:t?.homepage}).forEach(h=>{a?e.addRoute(a,h):e.addRoute(h)}),t?.homepage||(a?e.addRoute(a,u):e.addRoute(u))}else a?(e.addRoute(a,p),e.addRoute(a,u)):(e.addRoute(p),e.addRoute(u))}setErrorHandler(e){e.config.errorHandler=f.debounce((t,s,r)=>{const o=s?.$options.name,a=typeof t=="string"?t:t?.message||t?.msg||"未知错误",i=`[ ${o} ] ${a} ${r}`;["getComputedStyle","ResizeObserver"].some(c=>i.includes(c))||(console.error("[VTJ Error]:",{err:t,instance:s,info:r},t?.stack),this.errorHandler&&this.errorHandler(t),this.adapter.notify&&this.adapter.notify(i,"组件渲染错误","error"))},300)}install(e){const{libraryLocaleMap:t,libraryLocales:s}=this,{libraryOptions:r={}}=this.options,o=e.config.globalProperties.installed||{};for(const[a,i]of Object.entries(this.library))if(!o[a]&&Ie(i)){const c={locale:s[t[a]]},p=r[a]||{},u={...c,...p};e.use(i,u),o[a]=!0}e.provide(fe,this),e.config.globalProperties.$provider=this,e.config.globalProperties.$request=this.adapter?.request,this.options.install&&e.use(this.options.install),this.adapter.access&&e.use(this.adapter.access),this.project?.platform!=="uniapp"&&this.mode!==S.Design&&this.initGlobals(this.project?.globals||{},{app:e,window,adapter:this.adapter,library:this.library,mode:this.mode}),this.mode!==S.Design&&this.project?.i18n&&this.initI18n(e,this.library,this.project.i18n),this.options.enhance&&e.use(this.options.enhance,this),this.mode===S.Design&&this.setErrorHandler(e),e.config.globalProperties.installed=o}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=(r,o=[])=>{for(const a of o){if(a.id===r)return a;if(a.children&&a.children.length){const i=s(r,a.children);if(i)return i}}};return s(e,t)||null}getMenus(e="page",t=""){return N(t,e,this.project?.pages||[])}getHomepage(){const{homepage:e}=this.project||{};return e?this.getPage(e):null}async getDsl(e){const{vtjDir:t=".vtj"}=this.options,s=this.modules[`${t}/files/${e}.json`]||this.modules[`/src/${t}/files/${e}.json`];return s?await s():this.service.getFile(e,this.project||void 0).catch(()=>null)}async getDslByUrl(e){const t=this.urlDslCaches[e];return t||(this.adapter.request?this.urlDslCaches[e]=this.adapter.request.send({url:e,method:"get",settings:{validSuccess:!1,originResponse:!0}}).then(s=>s.data).catch(()=>null):null)}createDslRenderer(e,t={}){const{library:s,components:r,mode:o,apis:a}=this,i={mode:o,Vue:s.Vue,components:r,libs:s,apis:a,window,...t},l=G({getDsl:async c=>await this.getDsl(c)||null,getDslByUrl:async c=>await this.getDslByUrl(c)||null,options:i});return J({...i,dsl:e,loader:l})}async getRenderComponent(e,t){const s=this.getFile(e);if(!s)return f.logger.warn(`Can not find file: ${e}`),null;if(t&&t(s),this.mode===S.Raw){const{vtjRawDir:o=".vtj/vue"}=this.options,a=`${o}/${e}.vue`,i=this.modules[a]||this.modules[`/src/pages/${e}.vue`];return i?(await i())?.default:this.nodeEnv==="development"&&this.adapter.startupComponent||null}const r=await this.getDsl(s.id);return r?this.createDslRenderer(r).renderer:(f.logger.warn(`Can not find dsl: ${e}`),null)}defineUrlSchemaComponent(e,t){return $.defineAsyncComponent(async()=>{const s=await this.getDslByUrl(e);return s?(s.name=t||s.name,this.createDslRenderer(s).renderer):null})}definePluginComponent(e){return $.defineAsyncComponent(async()=>await le(e,window))}initGlobals(e,t){const s=Object.assign({adapter:this.adapter,window},t);Ht(e,s)}initI18n(e,t,s){Jt(e,t,s)}initEnv(e=[]){this.env=e.reduce((t,s)=>(t[s.name]=s[this.nodeEnv],t),{})}}function Gt(n){const e=new ze(n);return{provider:e,onReady:s=>e.ready(s)}}function de(n={}){const e=$.inject(fe,null);if(!e)throw new Error("Can not find provider");if(e.nodeEnv==="development"){const{id:t,version:s}=n;t&&s&&(async()=>{const r=await e.getDsl(t);r?.__VERSION__!==s&&e.adapter.notify&&e.adapter.notify(`[ ${r?.name} ] 组件源码版本与运行时版本不一致,请重新发布组件`,"版本不一致","warning")})()}return e}async function Kt(n,e=""){const{name:t,urls:s=[]}=n||{},r=s.map(i=>e+i),{css:o,js:a}=je(r);if(o.length&&oe(o),a.length)return await ie(a,t).catch(()=>{})}const Ve={type:"json",validSuccess:!0,originResponse:!1,failMessage:!0,validate:n=>n.data?.code===0},zt=(n,e="/__vtj__/api/:type.json")=>(t,s,r)=>n.send({url:e,method:"post",params:{type:t},query:r,data:{type:t,data:s},settings:Ve}),Vt=(n,e="/__vtj__/api/uploader.json")=>async(t,s)=>await n.send({url:e,method:"post",data:{files:t,projectId:s},settings:{...Ve,type:"data"}}).then(r=>r&&r[0]?r[0]:null).catch(()=>null);function Wt(n){return f.createRequest({settings:{type:"json",validSuccess:!0,originResponse:!1,failMessage:!0,validate:e=>e.data?.code===0,showError:e=>{n&&n(e||"未知错误")}}})}class W{constructor(e=f.request){this.req=e,this.api=zt(e),this.uploader=Vt(e)}api;pluginCaches={};uploader;async getExtension(){console.log("BaseService.getExtension")}async init(e){return console.log("BaseService.init",e),{}}async saveProject(e,t){return!!await this.api("saveProject",e,{type:t}).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 parseVue(e,t){return await this.api("parseVue",{project:e,...t})}async createRawPage(e){return await this.api("createRawPage",e).catch(()=>"")}async removeRawPage(e){return await this.api("removeRawPage",e).catch(()=>"")}async uploadStaticFile(e,t){return await this.uploader(e,t).catch(()=>null)}async getStaticFiles(e){return await this.api("getStaticFiles",e).catch(()=>[])}async removeStaticFile(e,t){return await this.api("removeStaticFile",{name:e,projectId:t}).catch(()=>"")}async clearStaticFiles(e){return await this.api("clearStaticFiles",e).catch(()=>"")}async getPluginMaterial(e){const{urls:t=[]}=e,s=t.filter(o=>we(o))[0];if(!s)return null;const r=this.pluginCaches[s];return r||(this.pluginCaches[s]=f.request.send({url:s,method:"get",settings:{validSuccess:!1,originResponse:!0}}).then(o=>o.data).catch(()=>null))}async genSource(e){return console.log("BaseService.genSource",e),""}}const b=new f.Storage({type:"local",expired:0,prefix:"__VTJ_"});class Qt extends W{init(e){const t=new T.ProjectModel(e),s=b.get(`project_${t.id}`),r=Object.assign(t.toDsl(),s||{});return b.save(`project_${t.id}`,r),Promise.resolve(r)}saveProject(e){const t=new T.ProjectModel(e);return b.save(`project_${t.id}`,t.toDsl()),Promise.resolve(!0)}saveMaterials(e,t){return b.save(`materials_${e.id}`,f.mapToObject(t)),Promise.resolve(!0)}saveFile(e){return b.save(`file_${e.id}`,e),Promise.resolve(!0)}getFile(e){const t=b.get(`file_${e}`);return t?Promise.resolve(t):Promise.reject(null)}removeFile(e){return b.remove(`file_${e}`),Promise.resolve(!0)}saveHistory(e){return b.save(`history_${e.id}`,e),Promise.resolve(!0)}removeHistory(e){const t=b.get(`history_${e}`);if(t){const r=(t.items||[]).map(o=>o.id);this.removeHistoryItem(e,r),b.remove(`history_${e}`)}return Promise.resolve(!0)}getHistory(e){const t=b.get(`history_${e}`),s=new T.HistoryModel(t||{id:e});return Promise.resolve(s.toDsl())}getHistoryItem(e,t){const s=b.get(`history_${e}_${t}`);return Promise.resolve(s)}saveHistoryItem(e,t){return b.save(`history_${e}_${t.id}`,t),Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(s=>{b.remove(`history_${e}_${s}`)}),Promise.resolve(!0)}}class We extends W{projects={};materials={};files={};histories={};historyItems={};init(e){const t=new T.ProjectModel(e),s=this.projects[t.id]||{},r=Object.assign(t.toDsl(),s);return this.projects[r.id]=r,Promise.resolve(r)}saveProject(e){const t=new T.ProjectModel(e);return this.projects[t.id]=t.toDsl(),Promise.resolve(!0)}saveMaterials(e,t){return e.id&&(this.materials[e.id]=f.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 r=(t.items||[]).map(o=>o.id);this.removeHistoryItem(e,r),delete this.historyItems[e]}return Promise.resolve(!0)}getHistory(e){const t=this.histories[e],s=new T.HistoryModel(t||{id:e});return Promise.resolve(s)}getHistoryItem(e,t){const s=`${e}_${t}`,r=this.historyItems[s]||{};return Promise.resolve(r)}saveHistoryItem(e,t){const s=`${e}_${t.id}`;return this.historyItems[s]=t,Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(s=>{const r=`${e}_${s}`;delete this.historyItems[r]}),Promise.resolve(!0)}}let q=null;function Yt(){return q||(q=new We,q)}class Xt extends W{getFileCaches={};async getExtension(){return await this.api("getExtension",{}).catch(()=>{})}async init(e){return await this.api("init",e).catch(()=>null)||{}}async saveProject(e,t){return!!await this.api("saveProject",e,{type:t}).catch(()=>!1)}async saveMaterials(e,t){return!!await this.api("saveMaterials",{project:e,materials:f.mapToObject(t)}).catch(()=>!1)}async saveFile(e){return!!await this.api("saveFile",e).catch(()=>!1)}async getFile(e){const t=this.getFileCaches[e];return t||(this.getFileCaches[e]=this.api("getFile",e).catch(()=>null)).finally(()=>{delete this.getFileCaches[e]})}async removeFile(e){return!!await this.api("removeFile",e).catch(()=>!1)}async saveHistory(e){return!!await this.api("saveHistory",e).catch(()=>!1)}async removeHistory(e){return!!await this.api("removeHistory",e).catch(()=>!1)}async getHistory(e){return await this.api("getHistory",e).catch(()=>null)||{}}async getHistoryItem(e,t){return await this.api("getHistoryItem",{fId:e,id:t}).catch(()=>null)||{}}async saveHistoryItem(e,t){return!!await this.api("saveHistoryItem",{fId:e,item:t}).catch(()=>!1)}async removeHistoryItem(e,t){return!!await this.api("removeHistoryItem",{fId:e,ids:t}).catch(()=>!1)}}exports.ACCESS=st;exports.ACCESS_KEY=ae;exports.Access=V;exports.BUILD_IN_TAGS=Se;exports.BUILT_IN_DIRECTIVES=ye;exports.BaseService=W;exports.CONTEXT_HOST=te;exports.Context=Ue;exports.ContextMode=S;exports.DATA_TYPES=ve;exports.HOMEPAGE_ROUTE_NAME=L;exports.HTML_TAGS=_e;exports.JSCodeToString=ct;exports.LIFE_CYCLES_LIST=et;exports.LocalService=Xt;exports.MemoryService=We;exports.NodeEnv=Ke;exports.PAGE_ROUTE_NAME=F;exports.Provider=ze;exports.REMOTE=tt;exports.StorageService=Qt;exports.VTJ_RENDERER_VERSION=k;exports.adoptStylesToInline=it;exports.adoptedStyleSheets=z;exports.clearLoaderCache=St;exports.compileScopedCSS=Re;exports.convertCssRpx=Pe;exports.createAccess=pt;exports.createAdapter=ut;exports.createAssetScripts=nt;exports.createAssetsCss=rt;exports.createDataSources=Be;exports.createLoader=G;exports.createMemoryService=Yt;exports.createMenus=N;exports.createMetaApi=xe;exports.createMock=Le;exports.createProvider=Gt;exports.createRenderer=J;exports.createSchemaApi=Fe;exports.createSchemaApis=De;exports.createServiceRequest=Wt;exports.defaultLoader=Je;exports.fillBasePath=H;exports.getMock=x;exports.getModifiers=ue;exports.getPlugin=le;exports.getRawComponent=$e;exports.isBuiltInTag=Te;exports.isCSSUrl=U;exports.isJSCode=Oe;exports.isJSExpression=R;exports.isJSFunction=j;exports.isJSON=we;exports.isJSUrl=B;exports.isNativeTag=Me;exports.isVuePlugin=Ie;exports.loadCss=Ae;exports.loadCssUrl=oe;exports.loadEnhance=Kt;exports.loadScriptUrl=ie;exports.menusFilter=pe;exports.mockApi=Ne;exports.mockApis=He;exports.mockCleanup=ce;exports.nodeRender=O;exports.parseDeps=be;exports.parseExpression=D;exports.parseFunction=C;exports.parseUrls=je;exports.providerKey=fe;exports.removeProdFlag=Ee;exports.rpxToPx=Ce;exports.setupPageSetting=at;exports.toString=re;exports.useAccess=ke;exports.useMask=Dt;exports.useProvider=de;
|
|
14
|
+
}`:"(v) => {}"},r=t.__parseFunction(s),o=ue(R(e.modifiers)?t.__parseExpression(e.modifiers):e.modifiers),a=R(e.arg)?t.__parseExpression(e.arg):e.arg||"modelValue";return{[a]:t.__parseExpression(e.value),[`onUpdate:${a}`]:o.length&&r?n.withModifiers(r,o):r}}function Ot(n,e,t,s,r){if(!e)return null;if(f.isString(e))return{default:()=>e};if(R(e))return{default:()=>re(t.__parseExpression(e))};if(Array.isArray(e)&&e.length>0){const o=kt(e),a=(i,l)=>!i||!r?{}:r?.id&&Object.keys(i).length?l?{[l]:i}:{[`scope_${r.id}`]:i}:l?{[l]:Object.create(null)}:{};return Object.entries(o).reduce((i,[l,{nodes:c,params:p,scope:u}])=>(i[l]=d=>{const m=p.length?f.pick(d??{},p):a(d,u);return c.map(h=>O(h,t.__clone(m),n,s,c))},i),{})}return null}function kt(n){const e={};for(const t of n){const s=Ft(t.slot),r=s.name;e[r]?(e[r].nodes.push(t),e[r].params=e[r].params.concat(s.params),e[r].scope=s.scope||""):e[r]={nodes:[t],params:s.params,scope:s.scope||""}}return e}function Ft(n="default"){return f.isString(n)?{name:n,params:[],scope:""}:{params:[],scope:"",...n}}function xt(n,e,t){const{value:s,iterator:r}=n,{item:o="item",index:a="index"}=r||{};let i=t.__parseExpression(s)||[];return Number.isInteger(i)&&(i=new Array(i).fill(!0).map((l,c)=>c+1)),Array.isArray(i)?i.map((l,c)=>e(t.__clone({[o]:l,[a]:c}),c)):(console.warn("[vForRender]:",`${s?.value} is not a Arrary`),[])}const Z=$.defineComponent({name:"VtjPageContainer",async setup(){const n=de(),e=ge.useRoute(),t=e.meta.__vtj__||e.params.id,s=t?n.getPage(t):n.getHomepage(),r=s?await n.getRenderComponent(s.id):null,o=$.ref(Symbol());if(s){Object.assign(e.meta,s.meta||{},{cache:s.cache});const{useTitle:a}=n?.adapter;if(a){const i=e.meta.title||s.title||"VTJ.PRO";a(i)}}return{provider:n,component:r,file:s,query:e.query,meta:e.meta,sid:o,route:e}},render(){const{component:n,query:e,sid:t}=this;return n?$.h(n,{...e,key:t}):$.h("div","页面不存在")},activated(){this.meta.cache===!1&&(this.sid=Symbol())}}),Dt=$.defineComponent({name:"VtjStartupContainer",render(){return $.h("div","page not found!")}});function N(n,e,t=[]){const s=[];for(const r of t){const{id:o,title:a,icon:i,children:l,hidden:c,layout:p}=r;if(p){const u=N(n,e,l||[]);s.push(...u)}else{const u={id:o,title:a,icon:i,hidden:c,url:`${n}/${e}/${o}`,children:l&&l.length?N(n,e,l):void 0};s.push(u)}}return s}function pe(n,e){if(!e)return n;let t=[];for(const s of n)if(s.children&&s.children.length){const r=pe(s.children,e);r.length&&(s.children=r,t.push(s))}else e.can(s.id.toString())&&t.push(s);return t}function Ht(n){const{menuPathPrefix:e="",pageRouteName:t="page",disableMenusFilter:s=!1}=n||{},r=de(),o=ge.useRoute(),a=ke(),i=$.ref(!1),l=$.ref(!1),c=r.project,p=(m,h)=>{i.value=!m?.mask,l.value=h?.pure??!!m?.pure};$.watchEffect(()=>{const{name:m,params:h,meta:g}=o;if(m===F){const y=r.getPage(h.id);p(y,g)}else if(m===L){const y=r.getHomepage();p(y,g)}else{const y=g.__vtj__;if(y){const v=r.getPage(y);p(v,g)}else i.value=!g.mask,l.value=!!g.pure}});const u=N(e,t,c?.pages),d=c?.config;return{disabled:i,logo:d?.logo,themeSwitchable:d?.themeSwitchable,title:d?.title||c?.description||c?.name||"VTJ App",menus:s?u:pe(u,a),pure:l}}function ee(n,e){const{id:t,title:s,meta:r}=n,{name:o="page",prefix:a="",component:i,routeMeta:l}=e;return{name:t,path:`${a}${o}/${t}`,component:i,meta:{title:s,...l,...r,__vtj__:t}}}function ne(n){const{name:e="page",prefix:t="",pages:s=[],component:r,loader:o,routeMeta:a,homepage:i}=n,l=[];for(const c of s){const{id:p,title:u,dir:d,layout:m,children:h,meta:g}=c;if(d){const y=ne({name:e,prefix:t,component:r,routeMeta:a,homepage:i,loader:o,pages:h||[]});l.push(...y)}else if(m){const y=ne({name:e,prefix:t,component:r,routeMeta:a,homepage:i,loader:o,pages:h||[]}),v={name:`layout_${p}`,path:t,component:()=>o(p),meta:{title:u,...a,...g,__vtj__:p},children:y};l.push(v),l.push(ee(c,n))}else if(l.push(ee(c,n)),i===p){const y=ee(c,n);y.path="",y.name=`home_${p}`,l.push(y)}}return l}function Lt(n={},e){const{css:t,store:s,enhance:r}=n,{window:o,app:a,library:i={},adapter:l,mode:c}=e,{Pinia:p}=i;a.config.globalProperties.$libs=i,z(o,"global-css",t||""),p&&s&&Nt(s,a,p),Bt(a,l,n),!l.access&&n.access&&Ut(n.access,a,c,l),qt(a,n),r&&Jt(r,a,i)}function Nt(n,e,t){const s=t.createPinia();if(e.use(s),j(n)&&n.value){const r=C(n,{},!1,!1,!0),o=t.defineStore("$store",r(e)||{});e.config.globalProperties.$store=o()}}function Ut(n,e,t,s){if(j(n)&&n.value){const r=C(n,{},!1,!1,!0),{alert:o,request:a}=s,i=new V({alert:o,storagePrefix:"__VTJ_APP_",...r(e)}),l=e.config.globalProperties.$router;i.connect({mode:t,router:l,request:a}),e.use(i)}}function Bt(n,e,t){if(!e.request)return;const{axios:s,request:r,response:o}=t;if(s&&j(s)&&s.value){const a=C(s,{},!1,!1,!0);e.request.setConfig(a(n))}if(r&&j(r)&&r.value){const a=C(r,{},!1,!1,!0),i=e.request;i.__unReq&&i.__unReq(),i.__unReq=e.request.useRequest(l=>a(l,n))}if(o&&j(o)&&o.value){const a=C(o,{},!1,!1,!0),i=e.request;i.__unRes&&i.__unRes(),i.__unRes=e.request.useResponse(l=>a(l,n))}}function qt(n,e){const{beforeEach:t,afterEach:s}=e,r=n.config.globalProperties.$router;if(t&&j(t)&&t.value){const o=C(t,{},!1,!1,!0);r&&r.beforeEach((a,i,l)=>o(a,i,l,n))}if(s&&j(s)&&s.value){const o=C(s,{},!1,!1,!0);r&&r.afterEach((a,i,l)=>o(a,i,l,n))}}function Jt(n,e,t={}){j(n)&&n.value&&C(n,{},!1,!1,!0)(e,t)}function Kt(n,e,t){if(!n||!e||!t)return;const{VueI18n:s}=e;if(s){const{locale:r,fallbackLocale:o,messages:a=[]}=t,i={};for(let c of a){const p=Object.keys(c).filter(u=>u!=="key");for(const u of p)i[u]||(i[u]={}),i[u][c.key]=c[u]}const l=s.createI18n({legacy:!1,locale:r,fallbackLocale:o,messages:i});n.use(l)}}const fe=Symbol("Provider");var Ge=(n=>(n.Production="production",n.Development="development",n))(Ge||{});class ze extends T.Base{constructor(e){super(),this.options=e;const{service:t,mode:s=S.Raw,dependencies:r,materials:o,project:a={},adapter:i={},globals:l={},modules:c={},router:p=null,materialPath:u="./",nodeEnv:d="development"}=e;this.mode=s,this.modules=c,this.service=t,this.router=p,this.materialPath=u,this.nodeEnv=d,r&&(this.dependencies=r),o&&(this.materials=o),Object.assign(this.globals,l),Object.assign(this.adapter,i);const{access:m,request:h}=this.adapter;m&&m.connect({mode:s,router:p,request:h}),a&&s!==S.Design?this.load(a):this.project=a}mode;globals={};modules={};adapter={request:f.request,jsonp:f.jsonp};apis={};dependencies={};materials={};library={};libraryLocales={};libraryLocaleMap={};service;project=null;components={};nodeEnv="development";env={};router=null;materialPath="./";urlDslCaches={};errorHandler=null;createMock(e){return async(...t)=>{let s={};if(e)try{s=await e.apply(e,t)}catch(o){f.logger.warn("模拟数据模版异常",o)}return x()?.mock(s)}}async load(e){const{vtjDir:t=".vtj"}=this.options,s=this.modules[`${t}/projects/${e.id}.json`]||this.modules[`/src/${t}/projects/${e.id}.json`];if(this.project=s?await s():await this.service.init(e),!this.project)throw new Error("project is null");const{apis:r=[],meta:o=[],env:a=[]}=this.project,i=window;i&&(i.CKEDITOR_VERSION=void 0),this.initEnv(a),this.mode===S.Raw?await this.loadDependencies(i):await this.loadAssets(i),this.initMock(i),this.apis=De(r,o,this.adapter),ce(i),He(r,i),e.platform!=="uniapp"&&this.initRouter(),this.triggerReady()}initMock(e){const t=x(e);t&&t.setup({timeout:"50-500"})}async loadDependencies(e={}){const t=Object.entries(this.dependencies);for(const[s,r]of t)e[s]||(e[s]=this.library[s]=await r())}async loadAssets(e={}){const{dependencies:t=[]}=this.project,{dependencies:s,library:r,components:o,materialPath:a,nodeEnv:i,libraryLocales:l}=this,{libraryExports:c,libraryMap:p,materials:u,materialExports:d,materialMapLibrary:m,libraryLocaleMap:h}=be(t,a,i==="development");Object.assign(this.libraryLocaleMap,h);for(const g of c){const y=s[g],v=e[g];if(v)r[g]=v;else if(y)e[g]=r[g]=await y();else{const _=p[g]||[];for(const E of _)U(E)&&await Ae(E,f.url.append(E,{v:k})),B(E)&&await f.loadScript(f.url.append(E,{v:k}));r[g]=e[g]}const w=h[g];if(w){const _=s[w];l[w]=_?await _():e[w]}}if(i==="development"){for(const y of u)await f.loadScript(f.url.append(y,{v:k}));const g=this.materials||{};for(const y of d){const v=e[m[y]],w=v?.default||v,_=T.BUILT_IN_COMPONENTS[y];if(_)w&&_.forEach(E=>{o[E]=w[E]});else{const E=g[y]?(await g[y]()).default:e[y];E&&w&&(E.components||[]).forEach(I=>{o[I.name]=$e(I,w)})}}}}initRouter(){const{router:e,project:t,options:s,adapter:r}=this;if(!e)return;const o=t?.platform==="uniapp"?"pages":"page",{routeAppendTo:a,pageRouteName:i=o,routeMeta:l}=s,c=a?"":"/",p={path:`${c}${i}/:id`,name:F,component:Z},u={path:c,name:L,component:t?.homepage?Z:r.startupComponent||Dt,meta:l};if(e.hasRoute(F)&&e.removeRoute(F),e.hasRoute(L)&&e.removeRoute(L),s.enableStaticRoute){const d=t?.pages||[];ne({name:i,prefix:c,pages:d,component:Z,loader:this.getRenderComponent.bind(this),homepage:t?.homepage}).forEach(h=>{a?e.addRoute(a,h):e.addRoute(h)}),t?.homepage||(a?e.addRoute(a,u):e.addRoute(u))}else a?(e.addRoute(a,p),e.addRoute(a,u)):(e.addRoute(p),e.addRoute(u))}setErrorHandler(e){e.config.errorHandler=f.debounce((t,s,r)=>{const o=s?.$options.name,a=typeof t=="string"?t:t?.message||t?.msg||"未知错误",i=`[ ${o} ] ${a} ${r}`;["getComputedStyle","ResizeObserver"].some(c=>i.includes(c))||(console.error("[VTJ Error]:",{err:t,instance:s,info:r},t?.stack),this.errorHandler&&this.errorHandler(t),this.adapter.notify&&this.adapter.notify(i,"组件渲染错误","error"))},300)}install(e){const{libraryLocaleMap:t,libraryLocales:s}=this,{libraryOptions:r={}}=this.options,o=e.config.globalProperties.installed||{};for(const[a,i]of Object.entries(this.library))if(!o[a]&&Ie(i)){const c={locale:s[t[a]]},p=r[a]||{},u={...c,...p};e.use(i,u),o[a]=!0}e.provide(fe,this),e.config.globalProperties.$provider=this,e.config.globalProperties.$request=this.adapter?.request,this.options.install&&e.use(this.options.install),this.adapter.access&&e.use(this.adapter.access),this.project?.platform!=="uniapp"&&this.mode!==S.Design&&this.initGlobals(this.project?.globals||{},{app:e,window,adapter:this.adapter,library:this.library,mode:this.mode}),this.mode!==S.Design&&this.project?.i18n&&this.initI18n(e,this.library,this.project.i18n),this.options.enhance&&e.use(this.options.enhance,this),this.mode===S.Design&&this.setErrorHandler(e),e.config.globalProperties.installed=o}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=(r,o=[])=>{for(const a of o){if(a.id===r)return a;if(a.children&&a.children.length){const i=s(r,a.children);if(i)return i}}};return s(e,t)||null}getMenus(e="page",t=""){return N(t,e,this.project?.pages||[])}getHomepage(){const{homepage:e}=this.project||{};return e?this.getPage(e):null}async getDsl(e){const{vtjDir:t=".vtj"}=this.options,s=this.modules[`${t}/files/${e}.json`]||this.modules[`/src/${t}/files/${e}.json`];return s?await s():this.service.getFile(e,this.project||void 0).catch(()=>null)}async getDslByUrl(e){const t=this.urlDslCaches[e];return t||(this.adapter.request?this.urlDslCaches[e]=this.adapter.request.send({url:e,method:"get",settings:{validSuccess:!1,originResponse:!0}}).then(s=>s.data).catch(()=>null):null)}createDslRenderer(e,t={}){const{library:s,components:r,mode:o,apis:a}=this,i={mode:o,Vue:s.Vue,components:r,libs:s,apis:a,window,...t},l=K({getDsl:async c=>await this.getDsl(c)||null,getDslByUrl:async c=>await this.getDslByUrl(c)||null,options:i});return J({...i,dsl:e,loader:l})}async getRenderComponent(e,t){const s=this.getFile(e);if(!s)return f.logger.warn(`Can not find file: ${e}`),null;if(t&&t(s),this.mode===S.Raw){const{vtjRawDir:o=".vtj/vue"}=this.options,a=`${o}/${e}.vue`,i=this.modules[a]||this.modules[`/src/pages/${e}.vue`];return i?(await i())?.default:this.nodeEnv==="development"&&this.adapter.startupComponent||null}const r=await this.getDsl(s.id);return r?this.createDslRenderer(r).renderer:(f.logger.warn(`Can not find dsl: ${e}`),null)}defineUrlSchemaComponent(e,t){return $.defineAsyncComponent(async()=>{const s=await this.getDslByUrl(e);return s?(s.name=t||s.name,this.createDslRenderer(s).renderer):null})}definePluginComponent(e){return $.defineAsyncComponent(async()=>await le(e,window))}initGlobals(e,t){const s=Object.assign({adapter:this.adapter,window},t);Lt(e,s)}initI18n(e,t,s){Kt(e,t,s)}initEnv(e=[]){this.env=e.reduce((t,s)=>(t[s.name]=s[this.nodeEnv],t),{})}}function Gt(n){const e=new ze(n);return{provider:e,onReady:s=>e.ready(s)}}function de(n={}){const e=$.inject(fe,null);if(!e)throw new Error("Can not find provider");if(e.nodeEnv==="development"){const{id:t,version:s}=n;t&&s&&(async()=>{const r=await e.getDsl(t);r?.__VERSION__!==s&&e.adapter.notify&&e.adapter.notify(`[ ${r?.name} ] 组件源码版本与运行时版本不一致,请重新发布组件`,"版本不一致","warning")})()}return e}async function zt(n,e=""){const{name:t,urls:s=[]}=n||{},r=s.map(i=>e+i),{css:o,js:a}=je(r);if(o.length&&oe(o),a.length)return await ie(a,t).catch(()=>{})}const Ve={type:"json",validSuccess:!0,originResponse:!1,failMessage:!0,validate:n=>n.data?.code===0},Vt=(n,e="/__vtj__/api/:type.json")=>(t,s,r)=>n.send({url:e,method:"post",params:{type:t},query:r,data:{type:t,data:s},settings:Ve}),Wt=(n,e="/__vtj__/api/uploader.json")=>async(t,s)=>await n.send({url:e,method:"post",data:{files:t,projectId:s},settings:{...Ve,type:"data"}}).then(r=>r&&r[0]?r[0]:null).catch(()=>null);function Qt(n){return f.createRequest({settings:{type:"json",validSuccess:!0,originResponse:!1,failMessage:!0,validate:e=>e.data?.code===0,showError:e=>{n&&n(e||"未知错误")}}})}class W{constructor(e=f.request){this.req=e,this.api=Vt(e),this.uploader=Wt(e)}api;pluginCaches={};uploader;async getExtension(){console.log("BaseService.getExtension")}async init(e){return console.log("BaseService.init",e),{}}async saveProject(e,t){return!!await this.api("saveProject",e,{type:t}).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 parseVue(e,t){return await this.api("parseVue",{project:e,...t})}async createRawPage(e){return await this.api("createRawPage",e).catch(()=>"")}async removeRawPage(e){return await this.api("removeRawPage",e).catch(()=>"")}async uploadStaticFile(e,t){return await this.uploader(e,t).catch(()=>null)}async getStaticFiles(e){return await this.api("getStaticFiles",e).catch(()=>[])}async removeStaticFile(e,t){return await this.api("removeStaticFile",{name:e,projectId:t}).catch(()=>"")}async clearStaticFiles(e){return await this.api("clearStaticFiles",e).catch(()=>"")}async getPluginMaterial(e){const{urls:t=[]}=e,s=t.filter(o=>we(o))[0];if(!s)return null;const r=this.pluginCaches[s];return r||(this.pluginCaches[s]=f.request.send({url:s,method:"get",settings:{validSuccess:!1,originResponse:!0}}).then(o=>o.data).catch(()=>null))}async genSource(e){return console.log("BaseService.genSource",e),""}}const b=new f.Storage({type:"local",expired:0,prefix:"__VTJ_"});class Yt extends W{init(e){const t=new T.ProjectModel(e),s=b.get(`project_${t.id}`),r=Object.assign(t.toDsl(),s||{});return b.save(`project_${t.id}`,r),Promise.resolve(r)}saveProject(e){const t=new T.ProjectModel(e);return b.save(`project_${t.id}`,t.toDsl()),Promise.resolve(!0)}saveMaterials(e,t){return b.save(`materials_${e.id}`,f.mapToObject(t)),Promise.resolve(!0)}saveFile(e){return b.save(`file_${e.id}`,e),Promise.resolve(!0)}getFile(e){const t=b.get(`file_${e}`);return t?Promise.resolve(t):Promise.reject(null)}removeFile(e){return b.remove(`file_${e}`),Promise.resolve(!0)}saveHistory(e){return b.save(`history_${e.id}`,e),Promise.resolve(!0)}removeHistory(e){const t=b.get(`history_${e}`);if(t){const r=(t.items||[]).map(o=>o.id);this.removeHistoryItem(e,r),b.remove(`history_${e}`)}return Promise.resolve(!0)}getHistory(e){const t=b.get(`history_${e}`),s=new T.HistoryModel(t||{id:e});return Promise.resolve(s.toDsl())}getHistoryItem(e,t){const s=b.get(`history_${e}_${t}`);return Promise.resolve(s)}saveHistoryItem(e,t){return b.save(`history_${e}_${t.id}`,t),Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(s=>{b.remove(`history_${e}_${s}`)}),Promise.resolve(!0)}}class We extends W{projects={};materials={};files={};histories={};historyItems={};init(e){const t=new T.ProjectModel(e),s=this.projects[t.id]||{},r=Object.assign(t.toDsl(),s);return this.projects[r.id]=r,Promise.resolve(r)}saveProject(e){const t=new T.ProjectModel(e);return this.projects[t.id]=t.toDsl(),Promise.resolve(!0)}saveMaterials(e,t){return e.id&&(this.materials[e.id]=f.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 r=(t.items||[]).map(o=>o.id);this.removeHistoryItem(e,r),delete this.historyItems[e]}return Promise.resolve(!0)}getHistory(e){const t=this.histories[e],s=new T.HistoryModel(t||{id:e});return Promise.resolve(s)}getHistoryItem(e,t){const s=`${e}_${t}`,r=this.historyItems[s]||{};return Promise.resolve(r)}saveHistoryItem(e,t){const s=`${e}_${t.id}`;return this.historyItems[s]=t,Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(s=>{const r=`${e}_${s}`;delete this.historyItems[r]}),Promise.resolve(!0)}}let q=null;function Xt(){return q||(q=new We,q)}class Zt extends W{getFileCaches={};async getExtension(){return await this.api("getExtension",{}).catch(()=>{})}async init(e){return await this.api("init",e).catch(()=>null)||{}}async saveProject(e,t){return!!await this.api("saveProject",e,{type:t}).catch(()=>!1)}async saveMaterials(e,t){return!!await this.api("saveMaterials",{project:e,materials:f.mapToObject(t)}).catch(()=>!1)}async saveFile(e){return!!await this.api("saveFile",e).catch(()=>!1)}async getFile(e){const t=this.getFileCaches[e];return t||(this.getFileCaches[e]=this.api("getFile",e).catch(()=>null)).finally(()=>{delete this.getFileCaches[e]})}async removeFile(e){return!!await this.api("removeFile",e).catch(()=>!1)}async saveHistory(e){return!!await this.api("saveHistory",e).catch(()=>!1)}async removeHistory(e){return!!await this.api("removeHistory",e).catch(()=>!1)}async getHistory(e){return await this.api("getHistory",e).catch(()=>null)||{}}async getHistoryItem(e,t){return await this.api("getHistoryItem",{fId:e,id:t}).catch(()=>null)||{}}async saveHistoryItem(e,t){return!!await this.api("saveHistoryItem",{fId:e,item:t}).catch(()=>!1)}async removeHistoryItem(e,t){return!!await this.api("removeHistoryItem",{fId:e,ids:t}).catch(()=>!1)}}exports.ACCESS=st;exports.ACCESS_KEY=ae;exports.Access=V;exports.BUILD_IN_TAGS=Se;exports.BUILT_IN_DIRECTIVES=ye;exports.BaseService=W;exports.CONTEXT_HOST=te;exports.Context=Ue;exports.ContextMode=S;exports.DATA_TYPES=ve;exports.HOMEPAGE_ROUTE_NAME=L;exports.HTML_TAGS=_e;exports.JSCodeToString=ct;exports.LIFE_CYCLES_LIST=et;exports.LocalService=Zt;exports.MemoryService=We;exports.NodeEnv=Ge;exports.PAGE_ROUTE_NAME=F;exports.Provider=ze;exports.REMOTE=tt;exports.StorageService=Yt;exports.VTJ_RENDERER_VERSION=k;exports.adoptStylesToInline=it;exports.adoptedStyleSheets=z;exports.clearLoaderCache=St;exports.compileScopedCSS=Re;exports.convertCssRpx=Pe;exports.createAccess=pt;exports.createAdapter=ut;exports.createAssetScripts=nt;exports.createAssetsCss=rt;exports.createDataSources=Be;exports.createLoader=K;exports.createMemoryService=Xt;exports.createMenus=N;exports.createMetaApi=xe;exports.createMock=Le;exports.createProvider=Gt;exports.createRenderer=J;exports.createSchemaApi=Fe;exports.createSchemaApis=De;exports.createServiceRequest=Qt;exports.defaultLoader=Je;exports.fillBasePath=H;exports.getMock=x;exports.getModifiers=ue;exports.getPlugin=le;exports.getRawComponent=$e;exports.isBuiltInTag=Te;exports.isCSSUrl=U;exports.isJSCode=Oe;exports.isJSExpression=R;exports.isJSFunction=j;exports.isJSON=we;exports.isJSUrl=B;exports.isNativeTag=Me;exports.isVuePlugin=Ie;exports.loadCss=Ae;exports.loadCssUrl=oe;exports.loadEnhance=zt;exports.loadScriptUrl=ie;exports.menusFilter=pe;exports.mockApi=Ne;exports.mockApis=He;exports.mockCleanup=ce;exports.nodeRender=O;exports.parseDeps=be;exports.parseExpression=D;exports.parseFunction=C;exports.parseUrls=je;exports.providerKey=fe;exports.removeProdFlag=Ee;exports.rpxToPx=Ce;exports.setupPageSetting=at;exports.toString=re;exports.useAccess=ke;exports.useMask=Ht;exports.useProvider=de;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Base as Je, BUILT_IN_COMPONENTS as Ke, ProjectModel as U, HistoryModel as $e } from "@vtj/core";
|
|
2
|
-
import { url as
|
|
2
|
+
import { url as F, isUrl as se, dedupArray as ze, isFunction as q, isString as I, logger as O, storage as X, cookie as Y, toArray as ge, unRSA as ye, delay as J, createRequest as be, jsonp as Ee, merge as Ge, pathToRegexp as Ve, pathToRegexpMatch as We, formDataToJson as Qe, Queue as Xe, cloneDeep as ve, camelCase as C, upperFirst as Ye, pick as Ze, request as ne, loadScript as _e, debounce as et, Storage as tt, mapToObject as ue } from "@vtj/utils";
|
|
3
3
|
import * as z from "vue";
|
|
4
4
|
import { inject as je, defineComponent as Re, h as re, ref as oe, watchEffect as st, defineAsyncComponent as we } from "vue";
|
|
5
5
|
import { useRoute as Pe } from "vue-router";
|
|
@@ -7,10 +7,10 @@ import { useRoute as Pe } from "vue-router";
|
|
|
7
7
|
* Copyright (c) 2026, VTJ.PRO All rights reserved.
|
|
8
8
|
* @name @vtj/renderer
|
|
9
9
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
10
|
-
* @version 0.16.
|
|
10
|
+
* @version 0.16.5
|
|
11
11
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
12
12
|
*/
|
|
13
|
-
const M = "0.16.
|
|
13
|
+
const M = "0.16.5";
|
|
14
14
|
var w = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(w || {});
|
|
15
15
|
const Se = [
|
|
16
16
|
"$el",
|
|
@@ -24,7 +24,7 @@ const Se = [
|
|
|
24
24
|
"$props",
|
|
25
25
|
"$options",
|
|
26
26
|
"$forceUpdate"
|
|
27
|
-
],
|
|
27
|
+
], _s = [
|
|
28
28
|
"beforeCreate",
|
|
29
29
|
"created",
|
|
30
30
|
"beforeMount",
|
|
@@ -57,7 +57,7 @@ const Se = [
|
|
|
57
57
|
Date
|
|
58
58
|
}, T = "VtjPage", N = "VtjHomepage", ot = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot,svg".split(
|
|
59
59
|
","
|
|
60
|
-
), it = "component,slot".split(","),
|
|
60
|
+
), it = "component,slot".split(","), ws = [
|
|
61
61
|
"h",
|
|
62
62
|
"t",
|
|
63
63
|
"t",
|
|
@@ -77,7 +77,7 @@ const Se = [
|
|
|
77
77
|
"p",
|
|
78
78
|
"r",
|
|
79
79
|
"o"
|
|
80
|
-
].join(""),
|
|
80
|
+
].join(""), Ss = {
|
|
81
81
|
auth: [
|
|
82
82
|
"h",
|
|
83
83
|
"t",
|
|
@@ -149,14 +149,14 @@ function V(n) {
|
|
|
149
149
|
function at(n) {
|
|
150
150
|
return /\.json$/.test(n);
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function $s(n) {
|
|
153
153
|
return n.map(
|
|
154
|
-
(e) => `<script src="${
|
|
154
|
+
(e) => `<script src="${F.append(e, { v: M })}"><\/script>`
|
|
155
155
|
).join("");
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function bs(n = []) {
|
|
158
158
|
return n.map(
|
|
159
|
-
(e) => `<link rel="stylesheet" href="${
|
|
159
|
+
(e) => `<link rel="stylesheet" href="${F.append(e, { v: M })}" />`
|
|
160
160
|
).join("");
|
|
161
161
|
}
|
|
162
162
|
function ct(n, e = !1) {
|
|
@@ -347,7 +347,7 @@ function fe(n, e, t, s = !1) {
|
|
|
347
347
|
c ? c.innerHTML = i : (c = l.createElement("style"), c.id = e, c.innerHTML = i, l.head.appendChild(c));
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
|
-
function
|
|
350
|
+
function Es(n) {
|
|
351
351
|
const e = n.adoptedStyleSheets || [];
|
|
352
352
|
let t = "";
|
|
353
353
|
if (e.forEach((s) => {
|
|
@@ -405,7 +405,7 @@ function D(n = window) {
|
|
|
405
405
|
if (t && window)
|
|
406
406
|
return window.Mock = t, t;
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function js(n, e, t) {
|
|
409
409
|
Object.assign(e.meta, t.meta);
|
|
410
410
|
const s = n?._container;
|
|
411
411
|
t?.type === "page" && s.classList.add("is-page"), t?.pure && s.classList.add("is-pure");
|
|
@@ -446,7 +446,7 @@ function b(n) {
|
|
|
446
446
|
function wt(n) {
|
|
447
447
|
return E(n) || b(n);
|
|
448
448
|
}
|
|
449
|
-
function
|
|
449
|
+
function Rs(n) {
|
|
450
450
|
return wt(n) ? n.value : JSON.stringify(n);
|
|
451
451
|
}
|
|
452
452
|
const St = {
|
|
@@ -462,7 +462,7 @@ const St = {
|
|
|
462
462
|
noPermissionMessage: "无权限访问该页面",
|
|
463
463
|
appName: "",
|
|
464
464
|
statusKey: "code"
|
|
465
|
-
},
|
|
465
|
+
}, ke = Symbol("access");
|
|
466
466
|
class pe {
|
|
467
467
|
options;
|
|
468
468
|
data = null;
|
|
@@ -514,7 +514,7 @@ class pe {
|
|
|
514
514
|
return ge(e).some((o) => s[o] || s[t + "." + o]);
|
|
515
515
|
}
|
|
516
516
|
install(e) {
|
|
517
|
-
e.config.globalProperties.$access = this, e.provide(
|
|
517
|
+
e.config.globalProperties.$access = this, e.provide(ke, this);
|
|
518
518
|
}
|
|
519
519
|
isAuthPath(e) {
|
|
520
520
|
const { auth: t, isAuth: s } = this.options;
|
|
@@ -620,9 +620,9 @@ class pe {
|
|
|
620
620
|
}
|
|
621
621
|
}
|
|
622
622
|
function $t() {
|
|
623
|
-
return je(
|
|
623
|
+
return je(ke, null);
|
|
624
624
|
}
|
|
625
|
-
function
|
|
625
|
+
function Ps(n = {}) {
|
|
626
626
|
const {
|
|
627
627
|
notify: e,
|
|
628
628
|
loading: t,
|
|
@@ -663,7 +663,7 @@ function Rs(n = {}) {
|
|
|
663
663
|
access: o ? new pe({ alert: i, ...o }) : void 0
|
|
664
664
|
};
|
|
665
665
|
}
|
|
666
|
-
function
|
|
666
|
+
function Cs(n = {}) {
|
|
667
667
|
return new pe(n);
|
|
668
668
|
}
|
|
669
669
|
function bt(n, e) {
|
|
@@ -709,7 +709,7 @@ function jt(n = [], e = [], t) {
|
|
|
709
709
|
}
|
|
710
710
|
async function Rt(n = [], e = window) {
|
|
711
711
|
const t = D(e);
|
|
712
|
-
t && (
|
|
712
|
+
t && (Fe(e), n.forEach((s) => Ct(t, s)));
|
|
713
713
|
}
|
|
714
714
|
function Pt(n, e = window) {
|
|
715
715
|
const t = b(n.mockTemplate) && n.mockTemplate.value ? j(n.mockTemplate, {}, !0) : void 0, s = D(e);
|
|
@@ -731,7 +731,7 @@ function Ct(n, e) {
|
|
|
731
731
|
try {
|
|
732
732
|
const r = se(t) ? new URL(t).pathname : t, o = Ve(`(.*)${r}(.*)`), a = We(r, { decode: decodeURIComponent }), i = H(s, {}, !0);
|
|
733
733
|
n.mock(o, (l) => {
|
|
734
|
-
const c =
|
|
734
|
+
const c = F.parse(l.url) || {}, f = l.body instanceof FormData ? Qe(l.body) : l.body, u = se(l.url) ? new URL(l.url).pathname : l.url.split("?")[0], p = a(u)?.params;
|
|
735
735
|
Object.assign(l, { data: f, params: p, query: c });
|
|
736
736
|
try {
|
|
737
737
|
return n.mock(i(l));
|
|
@@ -743,7 +743,7 @@ function Ct(n, e) {
|
|
|
743
743
|
console.warn("mockApi", r);
|
|
744
744
|
}
|
|
745
745
|
}
|
|
746
|
-
function
|
|
746
|
+
function Fe(n = window) {
|
|
747
747
|
const e = D(n);
|
|
748
748
|
e && (e._mocked = {});
|
|
749
749
|
}
|
|
@@ -867,7 +867,7 @@ function ie(n) {
|
|
|
867
867
|
name: i.value.name,
|
|
868
868
|
__scopeId: i.value.id ? `data-v-${i.value.id}` : void 0,
|
|
869
869
|
props: {
|
|
870
|
-
...
|
|
870
|
+
...kt(i.value.props ?? [], c)
|
|
871
871
|
},
|
|
872
872
|
async setup(u) {
|
|
873
873
|
c.$props = u, c.props = u, i.value.id && fe(
|
|
@@ -875,7 +875,7 @@ function ie(n) {
|
|
|
875
875
|
i.value.id,
|
|
876
876
|
i.value.css || "",
|
|
877
877
|
!0
|
|
878
|
-
), c.state =
|
|
878
|
+
), c.state = Ft(e, i.value.state ?? {}, c);
|
|
879
879
|
const p = Ot(e, i.value.computed ?? {}, c), h = xt(i.value.methods ?? {}, c), d = Mt(e, i.value.inject, c);
|
|
880
880
|
for (const [y, _] of Object.entries(d || {}))
|
|
881
881
|
d[y] = e.inject(y, _);
|
|
@@ -914,7 +914,7 @@ function ie(n) {
|
|
|
914
914
|
function It(n = []) {
|
|
915
915
|
return n.map((e) => I(e) ? e : e.name);
|
|
916
916
|
}
|
|
917
|
-
function
|
|
917
|
+
function kt(n = [], e) {
|
|
918
918
|
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((o) => rt[o]) : void 0;
|
|
919
919
|
return n.map((s) => I(s) ? {
|
|
920
920
|
name: s
|
|
@@ -932,7 +932,7 @@ function Ft(n = [], e) {
|
|
|
932
932
|
{}
|
|
933
933
|
);
|
|
934
934
|
}
|
|
935
|
-
function
|
|
935
|
+
function Ft(n, e, t) {
|
|
936
936
|
return n.reactive(
|
|
937
937
|
Object.keys(e || {}).reduce(
|
|
938
938
|
(s, r) => {
|
|
@@ -1008,7 +1008,7 @@ function Ht(n, e) {
|
|
|
1008
1008
|
);
|
|
1009
1009
|
}
|
|
1010
1010
|
const Oe = new Xe();
|
|
1011
|
-
let Z = [],
|
|
1011
|
+
let Z = [], k = {};
|
|
1012
1012
|
const Bt = (n) => n;
|
|
1013
1013
|
async function xe(n, e = window) {
|
|
1014
1014
|
const { urls: t = [], library: s } = n, r = t.filter((i) => V(i));
|
|
@@ -1026,11 +1026,11 @@ function ae(n) {
|
|
|
1026
1026
|
if (!o || typeof o == "string") return r;
|
|
1027
1027
|
if (o.type === "Schema" && o.id)
|
|
1028
1028
|
return a.defineAsyncComponent(async () => {
|
|
1029
|
-
const i =
|
|
1029
|
+
const i = k[o.id] || await Oe.add(
|
|
1030
1030
|
o.id,
|
|
1031
1031
|
() => e(o.id)
|
|
1032
1032
|
);
|
|
1033
|
-
return i && (i.name = r,
|
|
1033
|
+
return i && (i.name = r, k[o.id] = i), i ? ie({
|
|
1034
1034
|
...s,
|
|
1035
1035
|
Vue: a,
|
|
1036
1036
|
dsl: ve(i),
|
|
@@ -1040,8 +1040,8 @@ function ae(n) {
|
|
|
1040
1040
|
});
|
|
1041
1041
|
if (o.type === "UrlSchema" && o.url)
|
|
1042
1042
|
return a.defineAsyncComponent(async () => {
|
|
1043
|
-
const i =
|
|
1044
|
-
return i && (i.name = r,
|
|
1043
|
+
const i = k[o.url] || await t(o.url);
|
|
1044
|
+
return i && (i.name = r, k[o.url] = i), i ? ie({
|
|
1045
1045
|
...s,
|
|
1046
1046
|
Vue: a,
|
|
1047
1047
|
dsl: ve(i),
|
|
@@ -1050,8 +1050,8 @@ function ae(n) {
|
|
|
1050
1050
|
}).renderer : null;
|
|
1051
1051
|
});
|
|
1052
1052
|
if (o.type === "Plugin") {
|
|
1053
|
-
let i = o.library ?
|
|
1054
|
-
return i || (o.library && Z.push(o.library), i =
|
|
1053
|
+
let i = o.library ? k[o.library] : null;
|
|
1054
|
+
return i || (o.library && Z.push(o.library), i = k[o.library || Symbol()] = a.defineAsyncComponent(
|
|
1055
1055
|
async () => {
|
|
1056
1056
|
const l = await xe(o, s.window);
|
|
1057
1057
|
return l || (console.warn("getPlugin result is null", o), null);
|
|
@@ -1061,8 +1061,8 @@ function ae(n) {
|
|
|
1061
1061
|
return r;
|
|
1062
1062
|
};
|
|
1063
1063
|
}
|
|
1064
|
-
function
|
|
1065
|
-
|
|
1064
|
+
function As() {
|
|
1065
|
+
k = {}, Oe.clearAllCache();
|
|
1066
1066
|
}
|
|
1067
1067
|
function x(n, e, t = z, s = Bt, r = [], o = !1) {
|
|
1068
1068
|
if (!n || !n.name || n.invisible) return null;
|
|
@@ -1070,7 +1070,7 @@ function x(n, e, t = z, s = Bt, r = [], o = !1) {
|
|
|
1070
1070
|
if (!o && (f || u))
|
|
1071
1071
|
return null;
|
|
1072
1072
|
if (c && !Nt(c, e))
|
|
1073
|
-
return
|
|
1073
|
+
return zt(n, e, t, s, r);
|
|
1074
1074
|
const _ = (v, S = 0) => {
|
|
1075
1075
|
const A = v.$components, W = (() => {
|
|
1076
1076
|
if (n.name === "component")
|
|
@@ -1078,16 +1078,16 @@ function x(n, e, t = z, s = Bt, r = [], o = !1) {
|
|
|
1078
1078
|
if (n.name === "slot") return n.name;
|
|
1079
1079
|
const R = s(n.name, n.from, t);
|
|
1080
1080
|
return I(R) ? vt(R) || _t(R) ? R : A[R] ?? a?.app?.component(R) ?? R : R;
|
|
1081
|
-
})(), P = qt(i, n.props ?? {}, v), Ne =
|
|
1081
|
+
})(), P = qt(i, n.props ?? {}, v), Ne = Kt(t, n.events ?? {}, v);
|
|
1082
1082
|
if (n.name === "slot")
|
|
1083
|
-
return
|
|
1083
|
+
return Gt(t, n, P, v, s);
|
|
1084
1084
|
m && Object.assign(P, v.__parseExpression(m.value)), h && (P.style = Object.assign(
|
|
1085
1085
|
P.style ?? {},
|
|
1086
|
-
|
|
1087
|
-
)), g && Object.assign(P,
|
|
1088
|
-
Object.assign(P,
|
|
1086
|
+
Wt(h, v)
|
|
1087
|
+
)), g && Object.assign(P, Qt(g, v)), d.forEach((R) => {
|
|
1088
|
+
Object.assign(P, Xt(t, R, v));
|
|
1089
1089
|
});
|
|
1090
|
-
const Ue =
|
|
1090
|
+
const Ue = Yt(
|
|
1091
1091
|
t,
|
|
1092
1092
|
n.children ?? [],
|
|
1093
1093
|
v,
|
|
@@ -1102,7 +1102,7 @@ function x(n, e, t = z, s = Bt, r = [], o = !1) {
|
|
|
1102
1102
|
const me = a ? Lt(a, y, v) : [];
|
|
1103
1103
|
return me.length && (Q = t.withDirectives(Q, me)), Q;
|
|
1104
1104
|
};
|
|
1105
|
-
return p ?
|
|
1105
|
+
return p ? ts(p, _, e) : _(e);
|
|
1106
1106
|
}
|
|
1107
1107
|
function Lt(n, e, t) {
|
|
1108
1108
|
const s = n.app;
|
|
@@ -1152,7 +1152,12 @@ function ce(n, e) {
|
|
|
1152
1152
|
{}
|
|
1153
1153
|
) : n;
|
|
1154
1154
|
}
|
|
1155
|
-
function Jt(n, e
|
|
1155
|
+
function Jt(n, e) {
|
|
1156
|
+
return (t) => {
|
|
1157
|
+
t?.key?.toLowerCase() === e.toLowerCase() && n(t);
|
|
1158
|
+
};
|
|
1159
|
+
}
|
|
1160
|
+
function Kt(n, e, t) {
|
|
1156
1161
|
const s = ["passive", "capture", "once"], r = {
|
|
1157
1162
|
capture: "Capture",
|
|
1158
1163
|
once: "Once",
|
|
@@ -1161,12 +1166,15 @@ function Jt(n, e, t) {
|
|
|
1161
1166
|
return Object.keys(e || {}).reduce(
|
|
1162
1167
|
(o, a) => {
|
|
1163
1168
|
const i = e[a], l = Te(i.modifiers), c = l.find((p) => s.includes(p)), f = "on" + Ye(a) + (c && r[c] || ""), u = t.__parseFunction(i.handler);
|
|
1164
|
-
return u && (o[f] = n.withModifiers(
|
|
1169
|
+
return u && (o[f] = n.withModifiers(
|
|
1170
|
+
l.includes("enter") ? Jt(u, "enter") : u,
|
|
1171
|
+
l
|
|
1172
|
+
)), o;
|
|
1165
1173
|
},
|
|
1166
1174
|
{}
|
|
1167
1175
|
);
|
|
1168
1176
|
}
|
|
1169
|
-
function
|
|
1177
|
+
function zt(n, e, t, s, r = []) {
|
|
1170
1178
|
let o = r.findIndex((a) => a.id === n.id);
|
|
1171
1179
|
for (let a = ++o; a < r.length; a++) {
|
|
1172
1180
|
const { directives: i = [] } = r[a], { vElseIf: l, vElse: c } = Me(i);
|
|
@@ -1184,32 +1192,32 @@ function Te(n = {}, e = !1) {
|
|
|
1184
1192
|
const t = Object.keys(n);
|
|
1185
1193
|
return e ? t.map((s) => "." + s) : t;
|
|
1186
1194
|
}
|
|
1187
|
-
function
|
|
1188
|
-
const { children: o } = e, a =
|
|
1195
|
+
function Gt(n, e, t, s, r) {
|
|
1196
|
+
const { children: o } = e, a = Vt(e, s), i = s.$slots?.[a.name];
|
|
1189
1197
|
return i ? i(t) : o ? I(o) ? n.createTextVNode(o) : E(o) ? n.createTextVNode(
|
|
1190
1198
|
Ce(s.__parseExpression(o))
|
|
1191
1199
|
) : Array.isArray(o) ? o.map(
|
|
1192
1200
|
(l) => x(l, s, n, r, o)
|
|
1193
1201
|
) : null : null;
|
|
1194
1202
|
}
|
|
1195
|
-
function
|
|
1203
|
+
function Vt(n, e) {
|
|
1196
1204
|
const { props: t } = n, s = t?.name || "default";
|
|
1197
1205
|
return {
|
|
1198
1206
|
name: E(s) ? e.__parseExpression(s) : s,
|
|
1199
1207
|
params: []
|
|
1200
1208
|
};
|
|
1201
1209
|
}
|
|
1202
|
-
function
|
|
1210
|
+
function Wt(n, e) {
|
|
1203
1211
|
return e.__parseExpression(n.value) ? {} : {
|
|
1204
1212
|
display: "none"
|
|
1205
1213
|
};
|
|
1206
1214
|
}
|
|
1207
|
-
function
|
|
1215
|
+
function Qt(n, e) {
|
|
1208
1216
|
return {
|
|
1209
1217
|
innerHTML: e.__parseExpression(n.value) || ""
|
|
1210
1218
|
};
|
|
1211
1219
|
}
|
|
1212
|
-
function
|
|
1220
|
+
function Xt(n, e, t) {
|
|
1213
1221
|
const s = {
|
|
1214
1222
|
type: "JSFunction",
|
|
1215
1223
|
value: e.value?.value ? `(v) => {
|
|
@@ -1223,7 +1231,7 @@ function Qt(n, e, t) {
|
|
|
1223
1231
|
[`onUpdate:${a}`]: o.length && r ? n.withModifiers(r, o) : r
|
|
1224
1232
|
};
|
|
1225
1233
|
}
|
|
1226
|
-
function
|
|
1234
|
+
function Yt(n, e, t, s, r) {
|
|
1227
1235
|
if (!e) return null;
|
|
1228
1236
|
if (I(e))
|
|
1229
1237
|
return { default: () => e };
|
|
@@ -1232,7 +1240,7 @@ function Xt(n, e, t, s, r) {
|
|
|
1232
1240
|
default: () => Ce(t.__parseExpression(e))
|
|
1233
1241
|
};
|
|
1234
1242
|
if (Array.isArray(e) && e.length > 0) {
|
|
1235
|
-
const o =
|
|
1243
|
+
const o = Zt(e), a = (i, l) => !i || !r ? {} : r?.id && Object.keys(i).length ? l ? {
|
|
1236
1244
|
[l]: i
|
|
1237
1245
|
} : {
|
|
1238
1246
|
[`scope_${r.id}`]: i
|
|
@@ -1249,10 +1257,10 @@ function Xt(n, e, t, s, r) {
|
|
|
1249
1257
|
}
|
|
1250
1258
|
return null;
|
|
1251
1259
|
}
|
|
1252
|
-
function
|
|
1260
|
+
function Zt(n) {
|
|
1253
1261
|
const e = {};
|
|
1254
1262
|
for (const t of n) {
|
|
1255
|
-
const s =
|
|
1263
|
+
const s = es(t.slot), r = s.name;
|
|
1256
1264
|
e[r] ? (e[r].nodes.push(t), e[r].params = e[r].params.concat(s.params), e[r].scope = s.scope || "") : e[r] = {
|
|
1257
1265
|
nodes: [t],
|
|
1258
1266
|
params: s.params,
|
|
@@ -1261,10 +1269,10 @@ function Yt(n) {
|
|
|
1261
1269
|
}
|
|
1262
1270
|
return e;
|
|
1263
1271
|
}
|
|
1264
|
-
function
|
|
1272
|
+
function es(n = "default") {
|
|
1265
1273
|
return I(n) ? { name: n, params: [], scope: "" } : { params: [], scope: "", ...n };
|
|
1266
1274
|
}
|
|
1267
|
-
function
|
|
1275
|
+
function ts(n, e, t) {
|
|
1268
1276
|
const { value: s, iterator: r } = n, { item: o = "item", index: a = "index" } = r || {};
|
|
1269
1277
|
let i = t.__parseExpression(s) || [];
|
|
1270
1278
|
return Number.isInteger(i) && (i = new Array(i).fill(!0).map((l, c) => c + 1)), Array.isArray(i) ? i.map((l, c) => e(t.__clone({ [o]: l, [a]: c }), c)) : (console.warn("[vForRender]:", `${s?.value} is not a Arrary`), []);
|
|
@@ -1298,7 +1306,7 @@ const ee = Re({
|
|
|
1298
1306
|
activated() {
|
|
1299
1307
|
this.meta.cache === !1 && (this.sid = Symbol());
|
|
1300
1308
|
}
|
|
1301
|
-
}),
|
|
1309
|
+
}), ss = Re({
|
|
1302
1310
|
name: "VtjStartupContainer",
|
|
1303
1311
|
render() {
|
|
1304
1312
|
return re("div", "page not found!");
|
|
@@ -1336,7 +1344,7 @@ function De(n, e) {
|
|
|
1336
1344
|
e.can(s.id.toString()) && t.push(s);
|
|
1337
1345
|
return t;
|
|
1338
1346
|
}
|
|
1339
|
-
function
|
|
1347
|
+
function Is(n) {
|
|
1340
1348
|
const {
|
|
1341
1349
|
menuPathPrefix: e = "",
|
|
1342
1350
|
pageRouteName: t = "page",
|
|
@@ -1441,18 +1449,18 @@ function le(n) {
|
|
|
1441
1449
|
}
|
|
1442
1450
|
return l;
|
|
1443
1451
|
}
|
|
1444
|
-
function
|
|
1452
|
+
function ns(n = {}, e) {
|
|
1445
1453
|
const { css: t, store: s, enhance: r } = n, { window: o, app: a, library: i = {}, adapter: l, mode: c } = e, { Pinia: f } = i;
|
|
1446
|
-
a.config.globalProperties.$libs = i, fe(o, "global-css", t || ""), f && s &&
|
|
1454
|
+
a.config.globalProperties.$libs = i, fe(o, "global-css", t || ""), f && s && rs(s, a, f), is(a, l, n), !l.access && n.access && os(n.access, a, c, l), as(a, n), r && cs(r, a, i);
|
|
1447
1455
|
}
|
|
1448
|
-
function
|
|
1456
|
+
function rs(n, e, t) {
|
|
1449
1457
|
const s = t.createPinia();
|
|
1450
1458
|
if (e.use(s), b(n) && n.value) {
|
|
1451
1459
|
const r = j(n, {}, !1, !1, !0), o = t.defineStore("$store", r(e) || {});
|
|
1452
1460
|
e.config.globalProperties.$store = o();
|
|
1453
1461
|
}
|
|
1454
1462
|
}
|
|
1455
|
-
function
|
|
1463
|
+
function os(n, e, t, s) {
|
|
1456
1464
|
if (b(n) && n.value) {
|
|
1457
1465
|
const r = j(n, {}, !1, !1, !0), { alert: o, request: a } = s, i = new pe({
|
|
1458
1466
|
alert: o,
|
|
@@ -1462,7 +1470,7 @@ function rs(n, e, t, s) {
|
|
|
1462
1470
|
i.connect({ mode: t, router: l, request: a }), e.use(i);
|
|
1463
1471
|
}
|
|
1464
1472
|
}
|
|
1465
|
-
function
|
|
1473
|
+
function is(n, e, t) {
|
|
1466
1474
|
if (!e.request) return;
|
|
1467
1475
|
const { axios: s, request: r, response: o } = t;
|
|
1468
1476
|
if (s && b(s) && s.value) {
|
|
@@ -1478,7 +1486,7 @@ function os(n, e, t) {
|
|
|
1478
1486
|
i.__unRes && i.__unRes(), i.__unRes = e.request.useResponse((l) => a(l, n));
|
|
1479
1487
|
}
|
|
1480
1488
|
}
|
|
1481
|
-
function
|
|
1489
|
+
function as(n, e) {
|
|
1482
1490
|
const { beforeEach: t, afterEach: s } = e, r = n.config.globalProperties.$router;
|
|
1483
1491
|
if (t && b(t) && t.value) {
|
|
1484
1492
|
const o = j(t, {}, !1, !1, !0);
|
|
@@ -1489,10 +1497,10 @@ function is(n, e) {
|
|
|
1489
1497
|
r && r.afterEach((a, i, l) => o(a, i, l, n));
|
|
1490
1498
|
}
|
|
1491
1499
|
}
|
|
1492
|
-
function
|
|
1500
|
+
function cs(n, e, t = {}) {
|
|
1493
1501
|
b(n) && n.value && j(n, {}, !1, !1, !0)(e, t);
|
|
1494
1502
|
}
|
|
1495
|
-
function
|
|
1503
|
+
function ls(n, e, t) {
|
|
1496
1504
|
if (!n || !e || !t) return;
|
|
1497
1505
|
const { VueI18n: s } = e;
|
|
1498
1506
|
if (s) {
|
|
@@ -1512,8 +1520,8 @@ function cs(n, e, t) {
|
|
|
1512
1520
|
}
|
|
1513
1521
|
}
|
|
1514
1522
|
const He = Symbol("Provider");
|
|
1515
|
-
var
|
|
1516
|
-
class
|
|
1523
|
+
var us = /* @__PURE__ */ ((n) => (n.Production = "production", n.Development = "development", n))(us || {});
|
|
1524
|
+
class fs extends Je {
|
|
1517
1525
|
/**
|
|
1518
1526
|
* 创建Provider实例
|
|
1519
1527
|
* @param options 配置选项
|
|
@@ -1601,7 +1609,7 @@ class us extends Je {
|
|
|
1601
1609
|
if (this.project = s ? await s() : await this.service.init(e), !this.project)
|
|
1602
1610
|
throw new Error("project is null");
|
|
1603
1611
|
const { apis: r = [], meta: o = [], env: a = [] } = this.project, i = window;
|
|
1604
|
-
i && (i.CKEDITOR_VERSION = void 0), this.initEnv(a), this.mode === w.Raw ? await this.loadDependencies(i) : await this.loadAssets(i), this.initMock(i), this.apis = jt(r, o, this.adapter),
|
|
1612
|
+
i && (i.CKEDITOR_VERSION = void 0), this.initEnv(a), this.mode === w.Raw ? await this.loadDependencies(i) : await this.loadAssets(i), this.initMock(i), this.apis = jt(r, o, this.adapter), Fe(i), Rt(r, i), e.platform !== "uniapp" && this.initRouter(), this.triggerReady();
|
|
1605
1613
|
}
|
|
1606
1614
|
initMock(e) {
|
|
1607
1615
|
const t = D(e);
|
|
@@ -1645,7 +1653,7 @@ class us extends Je {
|
|
|
1645
1653
|
else {
|
|
1646
1654
|
const v = f[m] || [];
|
|
1647
1655
|
for (const S of v)
|
|
1648
|
-
G(S) && await gt(S,
|
|
1656
|
+
G(S) && await gt(S, F.append(S, { v: M })), V(S) && await _e(F.append(S, { v: M }));
|
|
1649
1657
|
r[m] = e[m];
|
|
1650
1658
|
}
|
|
1651
1659
|
const _ = d[m];
|
|
@@ -1656,7 +1664,7 @@ class us extends Je {
|
|
|
1656
1664
|
}
|
|
1657
1665
|
if (i === "development") {
|
|
1658
1666
|
for (const g of u)
|
|
1659
|
-
await _e(
|
|
1667
|
+
await _e(F.append(g, { v: M }));
|
|
1660
1668
|
const m = this.materials || {};
|
|
1661
1669
|
for (const g of p) {
|
|
1662
1670
|
const y = e[h[g]], _ = y?.default || y, v = Ke[g];
|
|
@@ -1687,7 +1695,7 @@ class us extends Je {
|
|
|
1687
1695
|
}, u = {
|
|
1688
1696
|
path: c,
|
|
1689
1697
|
name: N,
|
|
1690
|
-
component: t?.homepage ? ee : r.startupComponent ||
|
|
1698
|
+
component: t?.homepage ? ee : r.startupComponent || ss,
|
|
1691
1699
|
meta: l
|
|
1692
1700
|
};
|
|
1693
1701
|
if (e.hasRoute(T) && e.removeRoute(T), e.hasRoute(N) && e.removeRoute(N), s.enableStaticRoute) {
|
|
@@ -1872,10 +1880,10 @@ class us extends Je {
|
|
|
1872
1880
|
},
|
|
1873
1881
|
t
|
|
1874
1882
|
);
|
|
1875
|
-
|
|
1883
|
+
ns(e, s);
|
|
1876
1884
|
}
|
|
1877
1885
|
initI18n(e, t, s) {
|
|
1878
|
-
|
|
1886
|
+
ls(e, t, s);
|
|
1879
1887
|
}
|
|
1880
1888
|
initEnv(e = []) {
|
|
1881
1889
|
this.env = e.reduce(
|
|
@@ -1884,8 +1892,8 @@ class us extends Je {
|
|
|
1884
1892
|
);
|
|
1885
1893
|
}
|
|
1886
1894
|
}
|
|
1887
|
-
function
|
|
1888
|
-
const e = new
|
|
1895
|
+
function ks(n) {
|
|
1896
|
+
const e = new fs(n);
|
|
1889
1897
|
return {
|
|
1890
1898
|
provider: e,
|
|
1891
1899
|
onReady: (s) => e.ready(s)
|
|
@@ -1922,7 +1930,7 @@ const Le = {
|
|
|
1922
1930
|
originResponse: !1,
|
|
1923
1931
|
failMessage: !0,
|
|
1924
1932
|
validate: (n) => n.data?.code === 0
|
|
1925
|
-
},
|
|
1933
|
+
}, ps = (n, e = "/__vtj__/api/:type.json") => (t, s, r) => n.send({
|
|
1926
1934
|
url: e,
|
|
1927
1935
|
method: "post",
|
|
1928
1936
|
params: { type: t },
|
|
@@ -1932,7 +1940,7 @@ const Le = {
|
|
|
1932
1940
|
data: s
|
|
1933
1941
|
},
|
|
1934
1942
|
settings: Le
|
|
1935
|
-
}),
|
|
1943
|
+
}), ds = (n, e = "/__vtj__/api/uploader.json") => async (t, s) => await n.send({
|
|
1936
1944
|
url: e,
|
|
1937
1945
|
method: "post",
|
|
1938
1946
|
data: {
|
|
@@ -1944,7 +1952,7 @@ const Le = {
|
|
|
1944
1952
|
type: "data"
|
|
1945
1953
|
}
|
|
1946
1954
|
}).then((r) => r && r[0] ? r[0] : null).catch(() => null);
|
|
1947
|
-
function
|
|
1955
|
+
function Os(n) {
|
|
1948
1956
|
return be({
|
|
1949
1957
|
settings: {
|
|
1950
1958
|
type: "json",
|
|
@@ -1960,7 +1968,7 @@ function ks(n) {
|
|
|
1960
1968
|
}
|
|
1961
1969
|
class de {
|
|
1962
1970
|
constructor(e = ne) {
|
|
1963
|
-
this.req = e, this.api =
|
|
1971
|
+
this.req = e, this.api = ps(e), this.uploader = ds(e);
|
|
1964
1972
|
}
|
|
1965
1973
|
api;
|
|
1966
1974
|
pluginCaches = {};
|
|
@@ -2065,7 +2073,7 @@ const $ = new tt({
|
|
|
2065
2073
|
expired: 0,
|
|
2066
2074
|
prefix: "__VTJ_"
|
|
2067
2075
|
});
|
|
2068
|
-
class
|
|
2076
|
+
class xs extends de {
|
|
2069
2077
|
init(e) {
|
|
2070
2078
|
const t = new U(e), s = $.get(`project_${t.id}`), r = Object.assign(t.toDsl(), s || {});
|
|
2071
2079
|
return $.save(`project_${t.id}`, r), Promise.resolve(r);
|
|
@@ -2115,7 +2123,7 @@ class Os extends de {
|
|
|
2115
2123
|
}), Promise.resolve(!0);
|
|
2116
2124
|
}
|
|
2117
2125
|
}
|
|
2118
|
-
class
|
|
2126
|
+
class hs extends de {
|
|
2119
2127
|
projects = {};
|
|
2120
2128
|
materials = {};
|
|
2121
2129
|
files = {};
|
|
@@ -2173,10 +2181,10 @@ class ds extends de {
|
|
|
2173
2181
|
}
|
|
2174
2182
|
}
|
|
2175
2183
|
let L = null;
|
|
2176
|
-
function
|
|
2177
|
-
return L || (L = new
|
|
2184
|
+
function Ms() {
|
|
2185
|
+
return L || (L = new hs(), L);
|
|
2178
2186
|
}
|
|
2179
|
-
class
|
|
2187
|
+
class Ts extends de {
|
|
2180
2188
|
getFileCaches = {};
|
|
2181
2189
|
async getExtension() {
|
|
2182
2190
|
return await this.api("getExtension", {}).catch(() => {
|
|
@@ -2234,8 +2242,8 @@ class Ms extends de {
|
|
|
2234
2242
|
}
|
|
2235
2243
|
}
|
|
2236
2244
|
export {
|
|
2237
|
-
|
|
2238
|
-
|
|
2245
|
+
Ss as ACCESS,
|
|
2246
|
+
ke as ACCESS_KEY,
|
|
2239
2247
|
pe as Access,
|
|
2240
2248
|
it as BUILD_IN_TAGS,
|
|
2241
2249
|
nt as BUILT_IN_DIRECTIVES,
|
|
@@ -2246,36 +2254,36 @@ export {
|
|
|
2246
2254
|
rt as DATA_TYPES,
|
|
2247
2255
|
N as HOMEPAGE_ROUTE_NAME,
|
|
2248
2256
|
ot as HTML_TAGS,
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2257
|
+
Rs as JSCodeToString,
|
|
2258
|
+
_s as LIFE_CYCLES_LIST,
|
|
2259
|
+
Ts as LocalService,
|
|
2260
|
+
hs as MemoryService,
|
|
2261
|
+
us as NodeEnv,
|
|
2254
2262
|
T as PAGE_ROUTE_NAME,
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2263
|
+
fs as Provider,
|
|
2264
|
+
ws as REMOTE,
|
|
2265
|
+
xs as StorageService,
|
|
2258
2266
|
M as VTJ_RENDERER_VERSION,
|
|
2259
|
-
|
|
2267
|
+
Es as adoptStylesToInline,
|
|
2260
2268
|
fe as adoptedStyleSheets,
|
|
2261
|
-
|
|
2269
|
+
As as clearLoaderCache,
|
|
2262
2270
|
pt as compileScopedCSS,
|
|
2263
2271
|
mt as convertCssRpx,
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2272
|
+
Cs as createAccess,
|
|
2273
|
+
Ps as createAdapter,
|
|
2274
|
+
$s as createAssetScripts,
|
|
2275
|
+
bs as createAssetsCss,
|
|
2268
2276
|
Tt as createDataSources,
|
|
2269
2277
|
ae as createLoader,
|
|
2270
|
-
|
|
2278
|
+
Ms as createMemoryService,
|
|
2271
2279
|
K as createMenus,
|
|
2272
2280
|
Et as createMetaApi,
|
|
2273
2281
|
Pt as createMock,
|
|
2274
|
-
|
|
2282
|
+
ks as createProvider,
|
|
2275
2283
|
ie as createRenderer,
|
|
2276
2284
|
bt as createSchemaApi,
|
|
2277
2285
|
jt as createSchemaApis,
|
|
2278
|
-
|
|
2286
|
+
Os as createServiceRequest,
|
|
2279
2287
|
Bt as defaultLoader,
|
|
2280
2288
|
B as fillBasePath,
|
|
2281
2289
|
D as getMock,
|
|
@@ -2298,7 +2306,7 @@ export {
|
|
|
2298
2306
|
De as menusFilter,
|
|
2299
2307
|
Ct as mockApi,
|
|
2300
2308
|
Rt as mockApis,
|
|
2301
|
-
|
|
2309
|
+
Fe as mockCleanup,
|
|
2302
2310
|
x as nodeRender,
|
|
2303
2311
|
lt as parseDeps,
|
|
2304
2312
|
H as parseExpression,
|
|
@@ -2307,9 +2315,9 @@ export {
|
|
|
2307
2315
|
He as providerKey,
|
|
2308
2316
|
ct as removeProdFlag,
|
|
2309
2317
|
ht as rpxToPx,
|
|
2310
|
-
|
|
2318
|
+
js as setupPageSetting,
|
|
2311
2319
|
Ce as toString,
|
|
2312
2320
|
$t as useAccess,
|
|
2313
|
-
|
|
2321
|
+
Is as useMask,
|
|
2314
2322
|
Be as useProvider
|
|
2315
2323
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vtj/renderer",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.16.
|
|
4
|
+
"version": "0.16.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"低代码引擎",
|
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
"author": "chenhuachun",
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@vtj/
|
|
25
|
-
"@vtj/
|
|
24
|
+
"@vtj/core": "~0.16.5",
|
|
25
|
+
"@vtj/utils": "~0.16.5"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"vue": "~3.5.5",
|
|
29
29
|
"vue-router": "~4.6.0",
|
|
30
|
-
"@vtj/ui": "~0.16.3",
|
|
31
30
|
"@vtj/cli": "~0.12.18",
|
|
32
|
-
"@vtj/
|
|
31
|
+
"@vtj/ui": "~0.16.5",
|
|
32
|
+
"@vtj/icons": "~0.16.5"
|
|
33
33
|
},
|
|
34
34
|
"exports": {
|
|
35
35
|
".": {
|
package/types/version.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) 2026, VTJ.PRO All rights reserved.
|
|
3
3
|
* @name @vtj/renderer
|
|
4
4
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
5
|
-
* @version 0.16.
|
|
5
|
+
* @version 0.16.4
|
|
6
6
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
7
7
|
*/
|
|
8
|
-
export declare const version = "0.16.
|
|
8
|
+
export declare const version = "0.16.4";
|