@vtj/renderer 0.16.26 → 0.16.27
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 +6 -6
- package/dist/index.mjs +154 -144
- package/package.json +5 -5
- package/types/version.d.ts +2 -2
package/dist/index.cjs
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
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.27
|
|
6
6
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
7
|
-
*/const D="0.16.
|
|
7
|
+
*/const D="0.16.27";var S=(n=>(n.Runtime="Runtime",n.Design="Design",n.Raw="Raw",n.VNode="VNode",n))(S||{});const ie=["$el","$emit","$nextTick","$parent","$root","$attrs","$slots","$watch","$props","$options","$forceUpdate"],it=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeUnmount","unmounted","errorCaptured","renderTracked","renderTriggered","activated","deactivated"],$e=["vIf","vElseIf","vElse","vShow","vModel","vFor","vBind","vHtml"],be={String,Number,Boolean,Array,Object,Function,Date},x="VtjPage",U="VtjHomepage",le="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(","),je="component,slot".split(","),at=["h","t","t","p","s",":","/","/","a","p","p",".","v","t","j",".","p","r","o"].join(""),ct={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 N(n,e){return n.map(t=>f.isUrl(t)||t.startsWith("/")?t:`${e}${t}`)}function B(n){return/\.css$/.test(n)}function J(n){return/\.js$/.test(n)}function Ce(n){return/\.json$/.test(n)}function lt(n){return n.map(e=>`<script src="${f.url.append(e,{v:D})}"><\/script>`).join("")}function ut(n=[]){return n.map(e=>`<link rel="stylesheet" href="${f.url.append(e,{v:D})}" />`).join("")}function Re(n,e=!1){return e&&n.endsWith(".prod.js")?n.replace(".prod.js",".js"):n}function Pe(n,e,t=!1){const s=n.filter(d=>!!d.enabled),r=[],o=[],i=[],a=[],u={},c={},l=[],p={};return s.forEach(({urls:d,assetsUrl:h,library:g,assetsLibrary:m,localeLibrary:_})=>{d?.forEach(y=>{J(y)&&r.push(Re(y,t)),B(y)&&o.push(y)}),g&&(a.push(g),u[g]=N(d||[],e),_&&(c[g]=_)),h&&i.push(h),m&&l.push(m),g&&m&&(p[m]=g)}),{scripts:N(r,e),css:N(o,e),materials:N(i,e),libraryExports:a,materialExports:f.dedupArray(l),materialMapLibrary:p,libraryMap:u,libraryLocaleMap:c}}function Ae(n,e){const{name:t,parent:s,alias:r}=n;return s?e[s]?.[r||t]:e[r||t]}function Ie(n=[]){const e=n.filter(s=>B(s)),t=n.filter(s=>J(s));return{css:e,js:t}}function Te(n,e){const t=c=>{const l=[];let p=0;for(;p<c.length;){if(/\s/.test(c[p])){p++;continue}if(c.substring(p,p+2)==="/*"){const y=c.indexOf("*/",p+2);if(y!==-1){p=y+2;continue}}if(c[p]==="@"){const y=p;for(;p<c.length&&c[p]!=="{"&&c[p]!==";";)p++;const w=c.substring(y,p).trim(),C=w.includes("@keyframes");if(c[p]===";")l.push({type:"simple-at-rule",content:c.substring(y,p+1)}),p++;else if(c[p]==="{"){const v=p+1;let A=1;for(p++;p<c.length&&A>0;)c[p]==="{"?A++:c[p]==="}"&&A--,p++;const Z=c.substring(y,p),ee=c.substring(v,p-1);l.push({type:C?"keyframes":"at-rule",rule:w,content:Z,inner:ee})}continue}const d=p;for(;p<c.length&&c[p]!=="{";)p++;if(p>=c.length)break;const h=c.substring(d,p).trim();if(!h){p++;continue}const g=p+1;let m=1;for(p++;p<c.length&&m>0;)c[p]==="{"?m++:c[p]==="}"&&m--,p++;const _=c.substring(g,p-1);l.push({type:"rule",selector:h,content:_.trim()})}return l},s=c=>{const l=c.trim();return/^(from|to|\d+(\.\d+)?%)$/.test(l)},r=c=>c.replace(/::v-deep\(/g,":deep(").replace(/::v-deep\s+/g,":deep(").replace(/\/deep\//g," ").replace(/>>>/g," ").replace(/(.*?):deep\(([^)]+)\)/g,(l,p,d)=>{const h=p.trim(),g=d.trim();return h?`${h}[${e}] ${g}`:g}),o=c=>{const l=c.trim();if(!l||l.includes(`[${e}]`)||/^(:root|:host|html|body)(\s|$|:|\.|\#|\[)/.test(l)||s(l))return l;const p=l.match(/^(.+?)((?:::?[\w-]+(?:\([^)]*\))?)*)\s*$/);if(p){const[,d,h=""]=p,g=d.trim();return g?`${g}[${e}]${h}`:l}return`${l}[${e}]`},i=c=>r(c).split(",").map(p=>o(p)).filter(p=>p.trim()).join(", "),a=c=>c.map(l=>{switch(l.type){case"simple-at-rule":return l.content;case"keyframes":return l.content;case"at-rule":try{const d=t(l.inner),h=a(d);return`${l.rule} { ${h} }`}catch{return l.content}case"rule":if(!l.selector||!l.content)return"";const p=i(l.selector);return p.trim()?`${p} { ${l.content} }`:"";default:return""}}).filter(l=>l.trim()).join(" "),u=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
|
`),l=t(c),p=a(l);return u(p)}catch(c){return console.error("CSS scoping failed:",c),console.error("Input CSS:",n),n.replace(/\/\*[\s\S]*?\*\//g,"").replace(/(@keyframes\s+[^{]+\s*{[^{}]*(?:{[^}]*}[^{}]*)*})/g,l=>l).replace(/([^{}@]+)(?=\s*{)/g,l=>{const p=l.trim();return!p||p.startsWith("@")||p.includes(`[${e}]`)||s(p)?l:`${p}[${e}]`})}}const pt=750;function Me(n,e,t){let s;typeof n<"u"?s=n.innerWidth||n.document.documentElement.clientWidth:(console.warn("无法获取屏幕宽度,使用默认值375"),s=375);const r=t||pt;return e*s/r}function Oe(n,e){let t=!1,s=!1,r=!1,o="";for(let i=0;i<e.length;i++){const a=e[i];if(a==="'"&&!s&&!r?t=!t:a==='"'&&!t&&!r?s=!s:e.substr(i,4).toLowerCase()==="url("&&!t&&!s?r=!0:a===")"&&r&&(r=!1),!t&&!s&&!r){const u=e.substr(i).match(/^(-?\d+(?:\.\d+)?)\s*rpx/);if(u){const c=u[1],l=parseFloat(c),d=`${Me(n,l).toFixed(6).replace(/\.?0+$/,"")}px`;o+=d,i+=u[0].length-1;continue}}o+=a}return o}function ue(n){return f.isString(n)?n:JSON.stringify(n)}function Q(n,e,t,s=!1){const r=n.CSSStyleSheet,o=s?`data-v-${e}`:e,i=n.__uniConfig?Oe(n,t):t,a=s?Te(i,o):i,u=!!n.__uniConfig;if(r.prototype.replaceSync&&!u){const c=new r;c.id=e,c.replaceSync(a);const l=n.document,p=l.adoptedStyleSheets,d=Array.from(p).filter(h=>h.id!==e);l.adoptedStyleSheets=[...d,c]}else{const c=n.document;let l=c.getElementById(e);l?l.innerHTML=a:(l=c.createElement("style"),l.id=e,l.innerHTML=a,c.head.appendChild(l))}}function ft(n){const e=n.adoptedStyleSheets||[];let t="";if(e.forEach(s=>{try{for(const r of s.cssRules)t+=r.cssText+`
|
|
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 Fe(n,e){const t=await window.fetch(e).then(s=>s.text()).catch(()=>"");t&&Q(window,n,t)}function pe(n,e=window){const t=e.document,s=e.document.head;for(const r of n)if(!t.getElementById(r)){const i=t.createElement("link");i.rel="stylesheet",i.id=r,i.href=r,s.appendChild(i)}}async function fe(n,e,t=window){const s=t.document,r=t.document.head;let o=t[e];return o?o.default||o:new Promise((i,a)=>{for(const u of n){const c=s.createElement("script");c.src=u,c.onload=()=>{o=t[e],o?i(o.default||o):a(null)},c.onerror=l=>{a(l)},r.appendChild(c)}})}function De(n){return f.isFunction(n)&&Object.getOwnPropertyNames(n.prototype||{}).length===0||f.isFunction(n?.install)}function xe(n){return je.includes(n)}function ke(n){return le.includes(n)}function k(n=window){const e=window?.Mock;if(e)return e;const t=n?.Mock;if(t&&window)return window.Mock=t,t}function dt(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 H(n,e,t=!1,s=!1,r=!1){try{const o=['"use strict";',"var __self = arguments[0];"];o.push("return ");let i=(n.value||"").trim();r||(i=i.replace(/this(\W|$)/g,(u,c)=>`__self${c}`)),i=o.join(`
|
|
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 Fe(n,e){const t=await window.fetch(e).then(s=>s.text()).catch(()=>"");t&&Q(window,n,t)}function pe(n,e=window){const t=e.document,s=e.document.head;for(const r of n)if(!t.getElementById(r)){const i=t.createElement("link");i.rel="stylesheet",i.id=r,i.href=r,s.appendChild(i)}}async function fe(n,e,t=window){const s=t.document,r=t.document.head;let o=t[e];return o?o.default||o:new Promise((i,a)=>{for(const u of n){const c=s.createElement("script");c.src=u,c.onload=()=>{o=t[e],o?i(o.default||o):a(null)},c.onerror=l=>{a(l)},r.appendChild(c)}})}function De(n){return f.isFunction(n)&&Object.getOwnPropertyNames(n.prototype||{}).length===0||f.isFunction(n?.install)}function xe(n){return je.includes(n)}function ke(n){return le.includes(n)}function k(n=window){const e=window?.Mock;if(e)return e;const t=n?.Mock;if(t&&window)return window.Mock=t,t}function dt(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 ht(n){if(typeof window>"u")return;const e=window[0]||window;if(e.__simulator__)try{const t=e.__simulator__.engine.provider.errorHandler;t&&t(n)}catch{}}function H(n,e,t=!1,s=!1,r=!1){try{const o=['"use strict";',"var __self = arguments[0];"];o.push("return ");let i=(n.value||"").trim();r||(i=i.replace(/this(\W|$)/g,(u,c)=>`__self${c}`)),i=o.join(`
|
|
10
10
|
`)+i;const a=r?`
|
|
11
11
|
${i}
|
|
12
|
-
`:`with(${t?"{}":"$scope || {}"}) { ${i} }`;return new Function("$scope",a)(e)}catch(o){if(f.logger.error("parseExpression.error",o,n,e?.__self??e),s)throw o}}function R(n,e,t=!1,s=!1,r=!1){const o=H(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 j(n){return n&&n.type==="JSExpression"}function b(n){return typeof n=="object"&&n&&n.type==="JSFunction"}function He(n){return j(n)||b(n)}function ht(n){return He(n)?n.value:JSON.stringify(n)}const mt={session:!1,authKey:"Authorization",storageKey:"ACCESS_STORAGE",storagePrefix:"__VTJ_",unauthorized:void 0,auth:"/#/login",redirectParam:"r",unauthorizedCode:401,unauthorizedMessage:"登录已经失效,请重新登录!",noPermissionMessage:"无权限访问该页面",appName:"",statusKey:"code"},de=Symbol("access");class Y{options;data=null;mode=S.Raw;interceptResponse=!0;isTipShowing=!1;constructor(e){this.options=Object.assign({},mt,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(de,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===x){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 Ne(){return $.inject(de,null)}function gt(n={}){const{notify:e,loading:t,settings:s={},Startup:r,access:o,useTitle:i,alert:a}=n;let u=null;return{request:f.createRequest({settings:{type:"form",validSuccess:!0,originResponse:!1,loading:!0,validate:l=>l.data?.code===0||!!l.data?.success,failMessage:!0,showError:l=>{e&&e(l||"未知错误")},showLoading:()=>{u&&u.close(),t&&(u=t())},hideLoading:()=>{u&&(u.close(),u=null)},...s}}),jsonp:f.jsonp,notify:e,loading:t,useTitle:i,alert:a,startupComponent:r,access:o?new Y({alert:a,...o}):void 0}}function _t(n={}){return new Y(n)}function Le(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?H(n.headers,{},!0):void 0,o={url:n.url,method:n.method,settings:{...n.settings,headers:r}};return(i,a)=>(delete o.data,s.send(f.merge(o,a||{},{data:i})))}}function Ue(n,e){const{metaQuery:t}=e;if(!t)return;const{code:s,queryCode:r}=n;return(o,i)=>{if(!t){console.warn("adapter.metaQuery is not defined!");return}return t(s,r,o,i)}}function qe(n=[],e=[],t){const s={};for(const r of n){const o=Le(r,t);s[r.id]=o,s[r.name]=o}for(const r of e)s[r.id]=Ue(r,t);return s}async function Be(n=[],e=window){const t=k(e);t&&(he(e),n.forEach(s=>Ke(t,s)))}function Je(n,e=window){const t=b(n.mockTemplate)&&n.mockTemplate.value?R(n.mockTemplate,{},!0):void 0,s=k(e);return async(...r)=>{let o={};if(t)try{o=await t.apply(t,r)}catch(i){f.logger.warn("模拟数据模版异常",i)}return s?.mock(o)}}function Ke(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}(.*)`),i=f.pathToRegexpMatch(r,{decode:decodeURIComponent}),a=H(s,{},!0);n.mock(o,u=>{const c=f.url.parse(u.url)||{},l=u.body instanceof FormData?f.formDataToJson(u.body):u.body,p=f.isUrl(u.url)?new URL(u.url).pathname:u.url.split("?")[0],d=i(p)?.params;Object.assign(u,{data:l,params:d,query:c});try{return n.mock(a(u))}catch(h){return console.warn("[mockApi]",o,u,h),null}})}catch(r){console.warn("mockApi",r)}}function he(n=window){const e=k(n);e&&(e._mocked={})}class Ge{__id=null;__mode;__instance=null;__contextRefs={};__refs={};__refCaches={};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=W){const s=t.getCurrentInstance();if(!s)return;this.__refs={},this.__refCaches={},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&&ie.forEach(e=>{this[e]=this.__instance?.[e]})}__cleanup(){ie.forEach(e=>{this[e]=null}),this.__reset()}__reset(){this.__refs={},this.__refCaches={},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 R({type:s,value:r},this)}else return R(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 H({type:s,value:r},this)}else return H(e,this)}__ref(e=null,t){if(this.__mode===S.VNode)return;e&&e!==this.__id&&(this.__contextRefs[e]=this);let s=e?this.__refCaches[e]:null;return s||(s=async r=>{await f.delay(0);let o=r?.$vtjEl||r?.$el||r?._?.vnode?.el||r;if(!o){typeof t=="string"&&(delete this.$refs[t],e&&delete this.__refs[e]);return}return o.nodeType===3&&o.nextSibling&&(o=o.nextSibling),o.__vtj__=e,S.Design===this.__mode&&(o.__context__=this,o.draggable=!0),e&&(this.__refs[e]=this.__getRefEl(this.__refs,e,r)),typeof t=="function"?t(r):t&&(this.$refs[t]=this.__getRefEl(this.$refs,t,r)),r},e&&(this.__refCaches[e]=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 z(n){const{Vue:e=W,mode:t=S.Runtime,components:s={},libs:r={},apis:o={},loader:i}=n,a=e.computed(()=>n.dsl),u={$components:s,$libs:r,$apis:o},c=new Ge({mode:t,dsl:a.value,attrs:u}),l=e.defineComponent({name:a.value.name,__scopeId:a.value.id?`data-v-${a.value.id}`:void 0,props:{...yt(a.value.props??[],c)},async setup(p={}){c.$props=p,c.props=p,a.value.id&&Q(n.window||window,a.value.id,a.value.css||"",!0),c.state=St(e,a.value.state??{},c);const d=wt(e,a.value.computed??{},c),h=Et(a.value.methods??{},c),g=$t(e,a.value.inject,c);for(const[y,w]of Object.entries(g||{}))g[y]=e.inject(y,w);const m=ze(a.value.dataSources||{},c),_={...g,...d,...h,...m};return c.setup(_,e),bt(e,a.value.watch??[],c),{vtj:c,state:c.state,...p,...d,...h}},emits:vt(a.value.emits),expose:["vtj",...a.value.expose||[]],render(){if(!a.value.nodes)return null;const p=a.value.nodes||[];if(p.length===1)return O(p[0],c,e,i,p);{const d=p.map(h=>O(h,c,e,i,p));return e.createVNode("div",{},d)}},...jt(a.value.lifeCycles??{},c)});return{renderer:e.markRaw(l),context:c}}function vt(n=[]){return n.map(e=>f.isString(e)?e:e.name)}function yt(n=[],e){const t=s=>s?(Array.isArray(s)?s:[s]).map(o=>be[o]):void 0;return n.map(s=>f.isString(s)?{name:s}:{name:s.name,type:s.type,required:s.required,default:j(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 St(n,e,t){return n.reactive(Object.keys(e||{}).reduce((s,r)=>{let o=e[r];return j(o)?o=t.__parseExpression(o):b(o)&&(o=t.__parseFunction(o)),s[r]=o,s},{}))}function wt(n,e,t){return Object.entries(e??{}).reduce((s,[r,o])=>(s[r]=n.computed(t.__parseFunction(o)),s),{})}function Et(n,e){return Object.entries(n??{}).reduce((t,[s,r])=>(t[s]=e.__parseFunction(r),t),{})}function $t(n,e=[],t){return e.reduce((s,r)=>{const{name:o,from:i}=r||{};r.default;const a=j(i)?t.__parseExpression(i)||o:i??o,u=j(r.default)?t.__parseExpression(r.default):r.default??null;return s[o]=n.inject(a,u),s},{})}function ze(n,e){return Object.keys(n).reduce((t,s)=>{const r=n[s];if(r.type==="mock")t[s]=Je(r);else if(r.ref){const o=e.$apis[r.ref],i=b(r.transform)?r.transform.value?e.__parseFunction(r.transform):void 0:r.transform;t[s]=async(...a)=>{const u=await o.apply(e,a);return i?i(u):u}}return t},{})}function bt(n,e=[],t){e.forEach(s=>{n.watch(t.__parseExpression(s.source),t.__parseFunction(s.handler),{deep:s.deep,immediate:s.immediate})})}function jt(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},{})}class Ct{__props={};__events={};__nodes={};constructor(){}setProps(e,t){this.__props[e]=t}getProps(e){return this.__props[e]}loadProps(e,t){const s=e?this.getProps(e):null;return s||(e&&this.setProps(e,t),t)}setEvents(e,t){}getEvents(e){return this.__events[e]}loadEvents(e,t){const s=e?this.getEvents(e):null;return s||(e&&this.setEvents(e,t),t)}setNode(e,t){this.__nodes[e]=t}getNode(e){return this.__nodes[e]}loadNode(e,t){const s=e?this.getNode(e):null;return s||(e&&this.setNode(e,t),t)}isEqual(e,t){return f.isEqual(e,t)}clear(){this.__props={},this.__events={},this.__nodes={}}}const F=new Ct,Ve=new f.Queue;let ne=[],M={},L={};const We=(n,e)=>e;async function me(n,e=window){const{urls:t=[],library:s}=n,r=t.filter(a=>J(a));if(r.length===0||!s)return null;const o=t.filter(a=>B(a));return o.length&&pe(o,e),await fe(r,s,e).catch(a=>(console.warn("loadScriptUrl error",r,s,a),null))}function V(n){const{getDsl:e,getDslByUrl:t,options:s}=n;return s.window&&(ne.forEach(r=>{delete s.window[r]}),ne=[]),(r,o,i,a=W)=>{if(!i||typeof i=="string")return o;let u="";if(i.type==="Schema"&&i.id)return u=i.id+"_"+r,L[u]||(L[u]=a.defineAsyncComponent(async()=>{const c=M[i.id]||await Ve.add(i.id,()=>e(i.id));return c&&(c.name=o,M[i.id]=c),c?z({Vue:a,mode:S.Runtime,...s,dsl:f.cloneDeep(c),loader:V(n)}).renderer:null}));if(i.type==="UrlSchema"&&i.url)return u=i.url+"_"+r,L[u]||(L[u]=a.defineAsyncComponent(async()=>{const c=M[i.url]||await t(i.url);return c&&(c.name=o,M[i.url]=c),c?z({...s,Vue:a,dsl:f.cloneDeep(c),mode:S.Runtime,loader:V(n)}).renderer:null}));if(i.type==="Plugin"){let c=i.library?M[i.library]:null;return c||(i.library&&ne.push(i.library),c=M[i.library||Symbol()]=a.defineAsyncComponent(async()=>{const l=await me(i,s.window);return l||(console.warn("getPlugin result is null",i),null)}),c)}return o}}function Rt(){M={},L={},Ve.clearAllCache(),F.clear()}function O(n,e,t=W,s=We,r=[],o=!1,i=0){if(!n||!n.name||n.invisible)return null;const a=t.getCurrentInstance()?.appContext,{id:u=null,directives:c=[]}=n,{vIf:l,vElseIf:p,vElse:d,vFor:h,vShow:g,vModels:m,vBind:_,vHtml:y,others:w}=Qe(c);if(!o&&(p||d))return null;if(l&&!At(l,e))return Ft(n,e,t,s,r);const C=(v,A=0)=>{const Z=v.$components,ee=(()=>{if(n.name==="component")return It(v,n.props?.is);if(n.name==="slot")return n.name;const P=s(`${n.id}_${A}`,n.name,n.from,t);return f.isString(P)?xe(P)||ke(P)?P:Z[P]??a?.app?.component(P)??P:P})(),I=Tt(u,n.props??{},v),tt=Ot(t,n.id,n.events??{},v);if(n.name==="slot")return Dt(t,n,I,v,s);_&&Object.assign(I,v.__parseExpression(_.value)),g&&(I.style=Object.assign(I.style??{},kt(g,v))),y&&Object.assign(I,Ht(y,v)),m.forEach(P=>{le.includes(n.name)?Object.assign(I,Nt(P,v)):Object.assign(I,Lt(t,P,v))});const st=Ut(t,n.children??[],v,s,n),Se=v?.__id?`data-v-${v.__id}`:void 0,nt=Se?{[Se]:""}:{},rt=v.__mode===S.Design?{"data-vtj":u}:{},K=`${u}_${A}`,te={key:K,...nt,...rt,...I,...tt};F.isEqual(te,F.getNode(K))||F.setNode(K,te);let se=t.createVNode(ee,F.getNode(K)||te||{},st);const we=a?Pt(a,w,v):[];return we.length&&(se=t.withDirectives(se,we)),se};return h?Jt(h,C,e):C(e,i)}function Pt(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 i=[o];return r.value&&i.push(t.__parseExpression(r.value)),r.arg&&i.push(r.arg),r.modifiers&&i.push(r.modifiers),i}).filter(r=>!!r)}function Qe(n=[]){const e=n.find(l=>f.camelCase(l.name)==="vIf"),t=n.find(l=>f.camelCase(l.name)==="vElseIf"),s=n.find(l=>f.camelCase(l.name)==="vElse"),r=n.find(l=>f.camelCase(l.name)==="vFor"),o=n.find(l=>f.camelCase(l.name)==="vShow"),i=n.find(l=>f.camelCase(l.name)==="vBind"),a=n.find(l=>f.camelCase(l.name)==="vHtml"),u=n.filter(l=>f.camelCase(l.name)==="vModel"),c=n.filter(l=>!$e.includes(f.camelCase(l.name)));return{vIf:e,vElseIf:t,vElse:s,vFor:r,vShow:o,vModels:u,vBind:i,others:c,vHtml:a}}function At(n,e){return!!e.__parseExpression(n.value)}function It(n,e){return e?j(e)?n.__parseExpression(e):e:"div"}function Tt(n,e,t){const s=ae(e,t);return s.ref=t.__ref(n,s.ref),s}function ae(n,e){return j(n)?e.__parseExpression(n):b(n)?e.__parseFunction(n):Array.isArray(n)?n.map(t=>ae(t,e)):typeof n=="object"?Object.keys(n||{}).reduce((t,s)=>{let r=n[s];return t[s]=ae(r,e),t},{}):n}function Mt(n,e){return t=>{t?.key?.toLowerCase()===e.toLowerCase()&&n(t)}}function Ot(n,e,t,s){const r=["passive","capture","once"],o={capture:"Capture",once:"Once",passive:"OnceCapture"};return Object.keys(t||{}).reduce((a,u)=>{const c=t[u],l=ge(c.modifiers),p=l.find(g=>r.includes(g)),d="on"+f.upperFirstCamelCase(u)+(p&&o[p]||""),h=s.__parseFunction(c.handler);return h&&(a[d]=n.withModifiers(l.includes("enter")?Mt(h,"enter"):h,l)),a},{})}function Ft(n,e,t,s,r=[]){let o=r.findIndex(i=>i.id===n.id);for(let i=++o;i<r.length;i++){const{directives:a=[]}=r[i],{vElseIf:u,vElse:c}=Qe(a);if(u){if(e.__parseExpression(u.value))return O(r[i],e,t,s,r,!0);continue}if(c)return O(r[i],e,t,s,r,!0)}return null}function ge(n={},e=!1){const t=Object.keys(n);return e?t.map(s=>"."+s):t}function Dt(n,e,t,s,r){const{children:o}=e,i=xt(e,s),a=s.$slots?.[i.name];return a?a(t):o?f.isString(o)?n.createTextVNode(o):j(o)?n.createTextVNode(ue(s.__parseExpression(o))):Array.isArray(o)?o.map((u,c)=>O(u,s,n,r,o,!1,c)):null:null}function xt(n,e){const{props:t}=n,s=t?.name||"default";return{name:j(s)?e.__parseExpression(s):s,params:[]}}function kt(n,e){return e.__parseExpression(n.value)?{}:{display:"none"}}function Ht(n,e){return{innerHTML:e.__parseExpression(n.value)||""}}function Nt(n,e){const t={type:"JSFunction",value:n.value?.value?`(v) => {
|
|
12
|
+
`:`with(${t?"{}":"$scope || {}"}) { ${i} }`;return new Function("$scope",a)(e)}catch(o){if(f.logger.error("parseExpression.error",o,n,e?.__self??e),ht(o),s)throw o}}function R(n,e,t=!1,s=!1,r=!1){const o=H(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 j(n){return n&&n.type==="JSExpression"}function b(n){return typeof n=="object"&&n&&n.type==="JSFunction"}function He(n){return j(n)||b(n)}function mt(n){return He(n)?n.value:JSON.stringify(n)}const gt={session:!1,authKey:"Authorization",storageKey:"ACCESS_STORAGE",storagePrefix:"__VTJ_",unauthorized:void 0,auth:"/#/login",redirectParam:"r",unauthorizedCode:401,unauthorizedMessage:"登录已经失效,请重新登录!",noPermissionMessage:"无权限访问该页面",appName:"",statusKey:"code"},de=Symbol("access");class Y{options;data=null;mode=S.Raw;interceptResponse=!0;isTipShowing=!1;constructor(e){this.options=Object.assign({},gt,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(de,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===x){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 Ne(){return $.inject(de,null)}function _t(n={}){const{notify:e,loading:t,settings:s={},Startup:r,access:o,useTitle:i,alert:a}=n;let u=null;return{request:f.createRequest({settings:{type:"form",validSuccess:!0,originResponse:!1,loading:!0,validate:l=>l.data?.code===0||!!l.data?.success,failMessage:!0,showError:l=>{e&&e(l||"未知错误")},showLoading:()=>{u&&u.close(),t&&(u=t())},hideLoading:()=>{u&&(u.close(),u=null)},...s}}),jsonp:f.jsonp,notify:e,loading:t,useTitle:i,alert:a,startupComponent:r,access:o?new Y({alert:a,...o}):void 0}}function vt(n={}){return new Y(n)}function Le(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?H(n.headers,{},!0):void 0,o={url:n.url,method:n.method,settings:{...n.settings,headers:r}};return(i,a)=>(delete o.data,s.send(f.merge(o,a||{},{data:i})))}}function Ue(n,e){const{metaQuery:t}=e;if(!t)return;const{code:s,queryCode:r}=n;return(o,i)=>{if(!t){console.warn("adapter.metaQuery is not defined!");return}return t(s,r,o,i)}}function qe(n=[],e=[],t){const s={};for(const r of n){const o=Le(r,t);s[r.id]=o,s[r.name]=o}for(const r of e)s[r.id]=Ue(r,t);return s}async function Be(n=[],e=window){const t=k(e);t&&(he(e),n.forEach(s=>Ke(t,s)))}function Je(n,e=window){const t=b(n.mockTemplate)&&n.mockTemplate.value?R(n.mockTemplate,{},!0):void 0,s=k(e);return async(...r)=>{let o={};if(t)try{o=await t.apply(t,r)}catch(i){f.logger.warn("模拟数据模版异常",i)}return s?.mock(o)}}function Ke(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}(.*)`),i=f.pathToRegexpMatch(r,{decode:decodeURIComponent}),a=H(s,{},!0);n.mock(o,u=>{const c=f.url.parse(u.url)||{},l=u.body instanceof FormData?f.formDataToJson(u.body):u.body,p=f.isUrl(u.url)?new URL(u.url).pathname:u.url.split("?")[0],d=i(p)?.params;Object.assign(u,{data:l,params:d,query:c});try{return n.mock(a(u))}catch(h){return console.warn("[mockApi]",o,u,h),null}})}catch(r){console.warn("mockApi",r)}}function he(n=window){const e=k(n);e&&(e._mocked={})}class Ge{__id=null;__mode;__instance=null;__contextRefs={};__refs={};__refCaches={};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=W){const s=t.getCurrentInstance();if(!s)return;this.__refs={},this.__refCaches={},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&&ie.forEach(e=>{this[e]=this.__instance?.[e]})}__cleanup(){ie.forEach(e=>{this[e]=null}),this.__reset()}__reset(){this.__refs={},this.__refCaches={},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 R({type:s,value:r},this)}else return R(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 H({type:s,value:r},this)}else return H(e,this)}__ref(e=null,t){if(this.__mode===S.VNode)return;e&&e!==this.__id&&(this.__contextRefs[e]=this);let s=e?this.__refCaches[e]:null;return s||(s=async r=>{await f.delay(0);let o=r?.$vtjEl||r?.$el||r?._?.vnode?.el||r;if(!o){typeof t=="string"&&(delete this.$refs[t],e&&delete this.__refs[e]);return}return o.nodeType===3&&o.nextSibling&&(o=o.nextSibling),o.__vtj__=e,S.Design===this.__mode&&(o.__context__=this,o.draggable=!0),e&&(this.__refs[e]=this.__getRefEl(this.__refs,e,r)),typeof t=="function"?t(r):t&&(this.$refs[t]=this.__getRefEl(this.$refs,t,r)),r},e&&(this.__refCaches[e]=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 z(n){const{Vue:e=W,mode:t=S.Runtime,components:s={},libs:r={},apis:o={},loader:i}=n,a=e.computed(()=>n.dsl),u={$components:s,$libs:r,$apis:o},c=new Ge({mode:t,dsl:a.value,attrs:u}),l=e.defineComponent({name:a.value.name,__scopeId:a.value.id?`data-v-${a.value.id}`:void 0,props:{...St(a.value.props??[],c)},async setup(p={}){c.$props=p,c.props=p,a.value.id&&Q(n.window||window,a.value.id,a.value.css||"",!0),c.state=wt(e,a.value.state??{},c);const d=Et(e,a.value.computed??{},c),h=$t(a.value.methods??{},c),g=bt(e,a.value.inject,c);for(const[y,w]of Object.entries(g||{}))g[y]=e.inject(y,w);const m=ze(a.value.dataSources||{},c),_={...g,...d,...h,...m};return c.setup(_,e),jt(e,a.value.watch??[],c),{vtj:c,state:c.state,...p,...d,...h}},emits:yt(a.value.emits),expose:["vtj",...a.value.expose||[]],render(){if(!a.value.nodes)return null;const p=a.value.nodes||[];if(p.length===1)return O(p[0],c,e,i,p);{const d=p.map(h=>O(h,c,e,i,p));return e.createVNode("div",{},d)}},...Ct(a.value.lifeCycles??{},c)});return{renderer:e.markRaw(l),context:c}}function yt(n=[]){return n.map(e=>f.isString(e)?e:e.name)}function St(n=[],e){const t=s=>s?(Array.isArray(s)?s:[s]).map(o=>be[o]):void 0;return n.map(s=>f.isString(s)?{name:s}:{name:s.name,type:s.type,required:s.required,default:j(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 wt(n,e,t){return n.reactive(Object.keys(e||{}).reduce((s,r)=>{let o=e[r];return j(o)?o=t.__parseExpression(o):b(o)&&(o=t.__parseFunction(o)),s[r]=o,s},{}))}function Et(n,e,t){return Object.entries(e??{}).reduce((s,[r,o])=>(s[r]=n.computed(t.__parseFunction(o)),s),{})}function $t(n,e){return Object.entries(n??{}).reduce((t,[s,r])=>(t[s]=e.__parseFunction(r),t),{})}function bt(n,e=[],t){return e.reduce((s,r)=>{const{name:o,from:i}=r||{};r.default;const a=j(i)?t.__parseExpression(i)||o:i??o,u=j(r.default)?t.__parseExpression(r.default):r.default??null;return s[o]=n.inject(a,u),s},{})}function ze(n,e){return Object.keys(n).reduce((t,s)=>{const r=n[s];if(r.type==="mock")t[s]=Je(r);else if(r.ref){const o=e.$apis[r.ref],i=b(r.transform)?r.transform.value?e.__parseFunction(r.transform):void 0:r.transform;t[s]=async(...a)=>{const u=await o.apply(e,a);return i?i(u):u}}return t},{})}function jt(n,e=[],t){e.forEach(s=>{n.watch(t.__parseExpression(s.source),t.__parseFunction(s.handler),{deep:s.deep,immediate:s.immediate})})}function Ct(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},{})}class Rt{__props={};__events={};__nodes={};constructor(){}setProps(e,t){this.__props[e]=t}getProps(e){return this.__props[e]}loadProps(e,t){const s=e?this.getProps(e):null;return s||(e&&this.setProps(e,t),t)}setEvents(e,t){}getEvents(e){return this.__events[e]}loadEvents(e,t){const s=e?this.getEvents(e):null;return s||(e&&this.setEvents(e,t),t)}setNode(e,t){this.__nodes[e]=t}getNode(e){return this.__nodes[e]}loadNode(e,t){const s=e?this.getNode(e):null;return s||(e&&this.setNode(e,t),t)}isEqual(e,t){return f.isEqual(e,t)}clear(){this.__props={},this.__events={},this.__nodes={}}}const F=new Rt,Ve=new f.Queue;let ne=[],M={},L={};const We=(n,e)=>e;async function me(n,e=window){const{urls:t=[],library:s}=n,r=t.filter(a=>J(a));if(r.length===0||!s)return null;const o=t.filter(a=>B(a));return o.length&&pe(o,e),await fe(r,s,e).catch(a=>(console.warn("loadScriptUrl error",r,s,a),null))}function V(n){const{getDsl:e,getDslByUrl:t,options:s}=n;return s.window&&(ne.forEach(r=>{delete s.window[r]}),ne=[]),(r,o,i,a=W)=>{if(!i||typeof i=="string")return o;let u="";if(i.type==="Schema"&&i.id)return u=i.id+"_"+r,L[u]||(L[u]=a.defineAsyncComponent(async()=>{const c=M[i.id]||await Ve.add(i.id,()=>e(i.id));return c&&(c.name=o,M[i.id]=c),c?z({Vue:a,mode:S.Runtime,...s,dsl:f.cloneDeep(c),loader:V(n)}).renderer:null}));if(i.type==="UrlSchema"&&i.url)return u=i.url+"_"+r,L[u]||(L[u]=a.defineAsyncComponent(async()=>{const c=M[i.url]||await t(i.url);return c&&(c.name=o,M[i.url]=c),c?z({...s,Vue:a,dsl:f.cloneDeep(c),mode:S.Runtime,loader:V(n)}).renderer:null}));if(i.type==="Plugin"){let c=i.library?M[i.library]:null;return c||(i.library&&ne.push(i.library),c=M[i.library||Symbol()]=a.defineAsyncComponent(async()=>{const l=await me(i,s.window);return l||(console.warn("getPlugin result is null",i),null)}),c)}return o}}function Pt(){M={},L={},Ve.clearAllCache(),F.clear()}function O(n,e,t=W,s=We,r=[],o=!1,i=0){if(!n||!n.name||n.invisible)return null;const a=t.getCurrentInstance()?.appContext,{id:u=null,directives:c=[]}=n,{vIf:l,vElseIf:p,vElse:d,vFor:h,vShow:g,vModels:m,vBind:_,vHtml:y,others:w}=Qe(c);if(!o&&(p||d))return null;if(l&&!It(l,e))return Dt(n,e,t,s,r);const C=(v,A=0)=>{const Z=v.$components,ee=(()=>{if(n.name==="component")return Tt(v,n.props?.is);if(n.name==="slot")return n.name;const P=s(`${n.id}_${A}`,n.name,n.from,t);return f.isString(P)?xe(P)||ke(P)?P:Z[P]??a?.app?.component(P)??P:P})(),I=Mt(u,n.props??{},v),tt=Ft(t,n.id,n.events??{},v);if(n.name==="slot")return xt(t,n,I,v,s);_&&Object.assign(I,v.__parseExpression(_.value)),g&&(I.style=Object.assign(I.style??{},Ht(g,v))),y&&Object.assign(I,Nt(y,v)),m.forEach(P=>{le.includes(n.name)?Object.assign(I,Lt(P,v)):Object.assign(I,Ut(t,P,v))});const st=qt(t,n.children??[],v,s,n),Se=v?.__id?`data-v-${v.__id}`:void 0,nt=Se?{[Se]:""}:{},rt=v.__mode===S.Design?{"data-vtj":u}:{},K=`${u}_${A}`,te={key:K,...nt,...rt,...I,...tt};F.isEqual(te,F.getNode(K))||F.setNode(K,te);let se=t.createVNode(ee,F.getNode(K)||te||{},st);const we=a?At(a,w,v):[];return we.length&&(se=t.withDirectives(se,we)),se};return h?Kt(h,C,e):C(e,i)}function At(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 i=[o];return r.value&&i.push(t.__parseExpression(r.value)),r.arg&&i.push(r.arg),r.modifiers&&i.push(r.modifiers),i}).filter(r=>!!r)}function Qe(n=[]){const e=n.find(l=>f.camelCase(l.name)==="vIf"),t=n.find(l=>f.camelCase(l.name)==="vElseIf"),s=n.find(l=>f.camelCase(l.name)==="vElse"),r=n.find(l=>f.camelCase(l.name)==="vFor"),o=n.find(l=>f.camelCase(l.name)==="vShow"),i=n.find(l=>f.camelCase(l.name)==="vBind"),a=n.find(l=>f.camelCase(l.name)==="vHtml"),u=n.filter(l=>f.camelCase(l.name)==="vModel"),c=n.filter(l=>!$e.includes(f.camelCase(l.name)));return{vIf:e,vElseIf:t,vElse:s,vFor:r,vShow:o,vModels:u,vBind:i,others:c,vHtml:a}}function It(n,e){return!!e.__parseExpression(n.value)}function Tt(n,e){return e?j(e)?n.__parseExpression(e):e:"div"}function Mt(n,e,t){const s=ae(e,t);return s.ref=t.__ref(n,s.ref),s}function ae(n,e){return j(n)?e.__parseExpression(n):b(n)?e.__parseFunction(n):Array.isArray(n)?n.map(t=>ae(t,e)):typeof n=="object"?Object.keys(n||{}).reduce((t,s)=>{let r=n[s];return t[s]=ae(r,e),t},{}):n}function Ot(n,e){return t=>{t?.key?.toLowerCase()===e.toLowerCase()&&n(t)}}function Ft(n,e,t,s){const r=["passive","capture","once"],o={capture:"Capture",once:"Once",passive:"OnceCapture"};return Object.keys(t||{}).reduce((a,u)=>{const c=t[u],l=ge(c.modifiers),p=l.find(g=>r.includes(g)),d="on"+f.upperFirstCamelCase(u)+(p&&o[p]||""),h=s.__parseFunction(c.handler);return h&&(a[d]=n.withModifiers(l.includes("enter")?Ot(h,"enter"):h,l)),a},{})}function Dt(n,e,t,s,r=[]){let o=r.findIndex(i=>i.id===n.id);for(let i=++o;i<r.length;i++){const{directives:a=[]}=r[i],{vElseIf:u,vElse:c}=Qe(a);if(u){if(e.__parseExpression(u.value))return O(r[i],e,t,s,r,!0);continue}if(c)return O(r[i],e,t,s,r,!0)}return null}function ge(n={},e=!1){const t=Object.keys(n);return e?t.map(s=>"."+s):t}function xt(n,e,t,s,r){const{children:o}=e,i=kt(e,s),a=s.$slots?.[i.name];return a?a(t):o?f.isString(o)?n.createTextVNode(o):j(o)?n.createTextVNode(ue(s.__parseExpression(o))):Array.isArray(o)?o.map((u,c)=>O(u,s,n,r,o,!1,c)):null:null}function kt(n,e){const{props:t}=n,s=t?.name||"default";return{name:j(s)?e.__parseExpression(s):s,params:[]}}function Ht(n,e){return e.__parseExpression(n.value)?{}:{display:"none"}}function Nt(n,e){return{innerHTML:e.__parseExpression(n.value)||""}}function Lt(n,e){const t={type:"JSFunction",value:n.value?.value?`(v) => {
|
|
13
13
|
${n.value.value} = v?.target.value;
|
|
14
|
-
}`:"(v) => {}"};return{[j(n.arg)?e.__parseExpression(n.arg):n.arg||"value"]:e.__parseExpression(n.value),onInput:e.__parseFunction(t)}}function
|
|
14
|
+
}`:"(v) => {}"};return{[j(n.arg)?e.__parseExpression(n.arg):n.arg||"value"]:e.__parseExpression(n.value),onInput:e.__parseFunction(t)}}function Ut(n,e,t){const s={type:"JSFunction",value:e.value?.value?`(v) => {
|
|
15
15
|
${e.value.value} = v;
|
|
16
|
-
}`:"(v) => {}"},r=t.__parseFunction(s),o=ge(j(e.modifiers)?t.__parseExpression(e.modifiers):e.modifiers),i=j(e.arg)?t.__parseExpression(e.arg):e.arg||"modelValue";return{[i]:t.__parseExpression(e.value),[`onUpdate:${i}`]:o.length&&r?n.withModifiers(r,o):r}}function Ut(n,e,t,s,r){if(!e)return null;if(f.isString(e))return{default:()=>e};if(j(e))return{default:()=>ue(t.__parseExpression(e))};if(Array.isArray(e)&&e.length>0){const o=qt(e),i=(a,u)=>!a||!r?{}:r?.id&&Object.keys(a).length?u?{[u]:a}:{[`scope_${r.id}`]:a}:u?{[u]:Object.create(null)}:{};return Object.entries(o).reduce((a,[u,{nodes:c,params:l,scope:p}])=>(a[u]=d=>{const h=l.length?f.pick(d??{},l):i(d,p);return c.map((g,m)=>O(g,t.__clone(h),n,s,c,!1,m))},a),{})}return null}function qt(n){const e={};for(const t of n){const s=Bt(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 Bt(n="default"){return f.isString(n)?{name:n,params:[],scope:""}:{params:[],scope:"",...n}}function Jt(n,e,t){const{value:s,iterator:r}=n,{item:o="item",index:i="index"}=r||{};let a=t.__parseExpression(s)||[];return Number.isInteger(a)&&(a=new Array(a).fill(!0).map((u,c)=>c+1)),Array.isArray(a)?a.map((u,c)=>e(t.__clone({[o]:u,[i]:c}),c)):(console.warn("[vForRender]:",`${s?.value} is not a Arrary`),[])}const re=$.defineComponent({name:"VtjPageContainer",async setup(){const n=ye(),e=Ee.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:i}=n?.adapter;if(i){const a=e.meta.title||s.title||"VTJ.PRO";i(a)}}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",{style:{padding:"10px"}},"找不到组件,组件不存在或未发布!")},activated(){this.meta.cache===!1&&(this.sid=Symbol())}}),Kt=$.defineComponent({name:"VtjStartupContainer",render(){return $.h("div","page not found!")}});function q(n,e,t=[]){const s=[];for(const r of t){const{id:o,title:i,icon:a,children:u,hidden:c,layout:l}=r;if(l){const p=q(n,e,u||[]);s.push(...p)}else{const p={id:o,title:i,icon:a,hidden:c,url:`${n}/${e}/${o}`,children:u&&u.length?q(n,e,u):void 0};s.push(p)}}return s}function _e(n,e){if(!e)return n;let t=[];for(const s of n)if(s.children&&s.children.length){const r=_e(s.children,e);r.length&&(s.children=r,t.push(s))}else e.can(s.id.toString())&&t.push(s);return t}function Gt(n){const{menuPathPrefix:e="",pageRouteName:t="page",disableMenusFilter:s=!1}=n||{},r=ye(),o=Ee.useRoute(),i=Ne(),a=$.ref(!1),u=$.ref(!1),c=r.project,l=(h,g)=>{a.value=!h?.mask,u.value=g?.pure??!!h?.pure};$.watchEffect(()=>{const{name:h,params:g,meta:m}=o;if(h===x){const _=r.getPage(g.id);l(_,m)}else if(h===U){const _=r.getHomepage();l(_,m)}else{const _=m.__vtj__;if(_){const y=r.getPage(_);l(y,m)}else a.value=!m.mask,u.value=!!m.pure}});const p=q(e,t,c?.pages),d=c?.config;return{disabled:a,logo:d?.logo,themeSwitchable:d?.themeSwitchable,title:d?.title||c?.description||c?.name||"VTJ App",menus:s?p:_e(p,i),pure:u}}function oe(n,e){const{id:t,title:s,meta:r}=n,{name:o="page",prefix:i="",component:a,routeMeta:u}=e;return{name:t,path:`${i}${o}/${t}`,component:a,meta:{title:s,...u,...r,__vtj__:t}}}function ce(n){const{name:e="page",prefix:t="",pages:s=[],component:r,loader:o,routeMeta:i,homepage:a}=n,u=[];for(const c of s){const{id:l,title:p,dir:d,layout:h,children:g,meta:m}=c;if(d){const _=ce({name:e,prefix:t,component:r,routeMeta:i,homepage:a,loader:o,pages:g||[]});u.push(..._)}else if(h){const _=ce({name:e,prefix:t,component:r,routeMeta:i,homepage:a,loader:o,pages:g||[]}),y={name:`layout_${l}`,path:t,component:()=>o(l),meta:{title:p,...i,...m,__vtj__:l},children:_};u.push(y),u.push(oe(c,n))}else if(u.push(oe(c,n)),a===l){const _=oe(c,n);_.path="",_.name=`home_${l}`,u.push(_)}}return u}function zt(n={},e){const{css:t,store:s,enhance:r}=n,{window:o,app:i,library:a={},adapter:u,mode:c}=e,{Pinia:l}=a;i.config.globalProperties.$libs=a,Q(o,"global-css",t||""),l&&s&&Vt(s,i,l),Qt(i,u,n),!u.access&&n.access&&Wt(n.access,i,c,u),Yt(i,n),r&&Xt(r,i,a)}function Vt(n,e,t){const s=t.createPinia();if(e.use(s),b(n)&&n.value){const r=R(n,{},!1,!1,!0),o=t.defineStore("$store",r(e)||{});e.config.globalProperties.$store=o()}}function Wt(n,e,t,s){if(b(n)&&n.value){const r=R(n,{},!1,!1,!0),{alert:o,request:i}=s,a=new Y({alert:o,storagePrefix:"__VTJ_APP_",...r(e)}),u=e.config.globalProperties.$router;a.connect({mode:t,router:u,request:i}),e.use(a)}}function Qt(n,e,t){if(!e.request)return;const{axios:s,request:r,response:o}=t;if(s&&b(s)&&s.value){const i=R(s,{},!1,!1,!0);e.request.setConfig(i(n))}if(r&&b(r)&&r.value){const i=R(r,{},!1,!1,!0),a=e.request;a.__unReq&&a.__unReq(),a.__unReq=e.request.useRequest(u=>i(u,n))}if(o&&b(o)&&o.value){const i=R(o,{},!1,!1,!0),a=e.request;a.__unRes&&a.__unRes(),a.__unRes=e.request.useResponse(u=>i(u,n))}}function Yt(n,e){const{beforeEach:t,afterEach:s}=e,r=n.config.globalProperties.$router;if(t&&b(t)&&t.value){const o=R(t,{},!1,!1,!0);r&&r.beforeEach((i,a,u)=>o(i,a,u,n))}if(s&&b(s)&&s.value){const o=R(s,{},!1,!1,!0);r&&r.afterEach((i,a,u)=>o(i,a,u,n))}}function Xt(n,e,t={}){b(n)&&n.value&&R(n,{},!1,!1,!0)(e,t)}function Zt(n,e,t){if(!n||!e||!t)return;const{VueI18n:s}=e;if(s){const{locale:r,fallbackLocale:o,messages:i=[]}=t,a={};for(let c of i){const l=Object.keys(c).filter(p=>p!=="key");for(const p of l)a[p]||(a[p]={}),a[p][c.key]=c[p]}const u=s.createI18n({legacy:!1,locale:r,fallbackLocale:o,messages:a});n.use(u)}}const ve=Symbol("Provider");var Ye=(n=>(n.Production="production",n.Development="development",n))(Ye||{});class Xe extends T.Base{constructor(e){super(),this.options=e;const{service:t,mode:s=S.Raw,dependencies:r,materials:o,project:i={},adapter:a={},globals:u={},modules:c={},router:l=null,materialPath:p="./",nodeEnv:d="development"}=e;this.mode=s,this.modules=c,this.service=t,this.router=l,this.materialPath=p,this.nodeEnv=d,r&&(this.dependencies=r),o&&(this.materials=o),Object.assign(this.globals,u),Object.assign(this.adapter,a);const{access:h,request:g}=this.adapter;h&&h.connect({mode:s,router:l,request:g}),i&&s!==S.Design?this.load(i):this.project=i}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 k()?.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:i=[]}=this.project,a=window;a&&(a.CKEDITOR_VERSION=void 0),this.initEnv(i),this.mode===S.Raw?await this.loadDependencies(a):await this.loadAssets(a),this.initMock(a),this.apis=qe(r,o,this.adapter),he(a),Be(r,a),e.platform!=="uniapp"&&this.initRouter(),this.triggerReady()}initMock(e){const t=k(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:i,nodeEnv:a,libraryLocales:u}=this,{libraryExports:c,libraryMap:l,materials:p,materialExports:d,materialMapLibrary:h,libraryLocaleMap:g}=Pe(t,i,a==="development");Object.assign(this.libraryLocaleMap,g);for(const m of c){const _=s[m],y=e[m];if(y)r[m]=y;else if(_)e[m]=r[m]=await _();else{const C=l[m]||[];for(const v of C)B(v)&&await Fe(v,f.url.append(v,{v:D})),J(v)&&await f.loadScript(f.url.append(v,{v:D}));r[m]=e[m]}const w=g[m];if(w){const C=s[w];u[w]=C?await C():e[w]}}if(a==="development"){for(const _ of p)await f.loadScript(f.url.append(_,{v:D}));const m=this.materials||{};for(const _ of d){const y=e[h[_]],w=y?.default||y,C=T.BUILT_IN_COMPONENTS[_];if(C)w&&C.forEach(v=>{o[v]=w[v]});else{const v=m[_]?(await m[_]()).default:e[_];v&&w&&(v.components||[]).forEach(A=>{o[A.name]=Ae(A,w)})}}}}initRouter(){const{router:e,project:t,options:s,adapter:r}=this;if(!e)return;const o=t?.platform==="uniapp"?"pages":"page",{routeAppendTo:i,pageRouteName:a=o,routeMeta:u}=s,c=i?"":"/",l={path:`${c}${a}/:id`,name:x,component:re},p=this.getHomepage(),d={path:c,name:U,component:p?re:r.startupComponent||Kt,meta:u};if(e.hasRoute(x)&&e.removeRoute(x),e.hasRoute(U)&&e.removeRoute(U),s.enableStaticRoute){const h=t?.pages||[];ce({name:a,prefix:c,pages:h,component:re,loader:this.getRenderComponent.bind(this),homepage:p?.id}).forEach(m=>{i?e.addRoute(i,m):e.addRoute(m)}),p||(i?e.addRoute(i,d):e.addRoute(d))}else i?(e.addRoute(i,l),e.addRoute(i,d)):(e.addRoute(l),e.addRoute(d))}setErrorHandler(e){e.config.errorHandler=f.debounce((t,s,r)=>{const o=s?.$options.name,i=typeof t=="string"?t:t?.message||t?.msg||"未知错误",a=`[ ${o} ] ${i} ${r}`;["getComputedStyle","ResizeObserver"].some(c=>a.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(a,"组件渲染错误","error"))},300)}install(e){const{libraryLocaleMap:t,libraryLocales:s}=this,{libraryOptions:r={}}=this.options,o=e.config.globalProperties.installed||{};for(const[i,a]of Object.entries(this.library))if(!o[i]&&De(a)){const c={locale:s[t[i]]},l=r[i]||{},p={...c,...l};e.use(a,p),o[i]=!0}e.provide(ve,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 i of o){if(i.id===r)return i;if(i.children&&i.children.length){const a=s(r,i.children);if(a)return a}}};return s(e,t)||null}getFirstPage(){const{pages:e=[]}=this.project||{};if(!e.length)return null;const t=(s=[])=>{for(const r of s){if(r.type==="page"&&!r.dir&&!r.layout)return r;if(r.children&&r.children.length){const o=t(r.children);if(o)return o}}};return t(e)||null}getMenus(e="page",t=""){return q(t,e,this.project?.pages||[])}getHomepage(){const{homepage:e}=this.project||{};return e?this.getPage(e):this.getFirstPage()}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:i}=this,a={mode:o,Vue:s.Vue,components:r,libs:s,apis:i,window,...t},u=V({getDsl:async c=>await this.getDsl(c)||null,getDslByUrl:async c=>await this.getDslByUrl(c)||null,options:a});return z({...a,dsl:e,loader:u})}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,i=`${o}/${e}.vue`,a=this.modules[i]||this.modules[`/src/pages/${e}.vue`];return a?(await a())?.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 me(e,window))}initGlobals(e,t){const s=Object.assign({adapter:this.adapter,window},t);zt(e,s)}initI18n(e,t,s){Zt(e,t,s)}initEnv(e=[]){this.env=e.reduce((t,s)=>(t[s.name]=s[this.nodeEnv],t),{})}}function es(n){const e=new Xe(n);return{provider:e,onReady:s=>e.ready(s)}}function ye(n={}){const e=$.inject(ve,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 ts(n,e=""){const{name:t,urls:s=[]}=n||{},r=s.map(a=>e+a),{css:o,js:i}=Ie(r);if(o.length&&pe(o),i.length)return await fe(i,t).catch(()=>{})}const Ze={type:"json",validSuccess:!0,originResponse:!1,failMessage:!0,validate:n=>n.data?.code===0},ss=(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:Ze}),ns=(n,e="/__vtj__/api/uploader.json")=>async(t,s)=>await n.send({url:e,method:"post",data:{files:t,projectId:s},settings:{...Ze,type:"data"}}).then(r=>r&&r[0]?r[0]:null).catch(()=>null);function rs(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 X{constructor(e=f.request){this.req=e,this.api=ss(e),this.uploader=ns(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=>Ce(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 E=new f.Storage({type:"local",expired:0,prefix:"__VTJ_"});class os extends X{init(e){const t=new T.ProjectModel(e),s=E.get(`project_${t.id}`),r=Object.assign(t.toDsl(),s||{});return E.save(`project_${t.id}`,r),Promise.resolve(r)}saveProject(e){const t=new T.ProjectModel(e);return E.save(`project_${t.id}`,t.toDsl()),Promise.resolve(!0)}saveMaterials(e,t){return E.save(`materials_${e.id}`,f.mapToObject(t)),Promise.resolve(!0)}saveFile(e){return E.save(`file_${e.id}`,e),Promise.resolve(!0)}getFile(e){const t=E.get(`file_${e}`);return t?Promise.resolve(t):Promise.reject(null)}removeFile(e){return E.remove(`file_${e}`),Promise.resolve(!0)}saveHistory(e){return E.save(`history_${e.id}`,e),Promise.resolve(!0)}removeHistory(e){const t=E.get(`history_${e}`);if(t){const r=(t.items||[]).map(o=>o.id);this.removeHistoryItem(e,r),E.remove(`history_${e}`)}return Promise.resolve(!0)}getHistory(e){const t=E.get(`history_${e}`),s=new T.HistoryModel(t||{id:e});return Promise.resolve(s.toDsl())}getHistoryItem(e,t){const s=E.get(`history_${e}_${t}`);return Promise.resolve(s)}saveHistoryItem(e,t){return E.save(`history_${e}_${t.id}`,t),Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(s=>{E.remove(`history_${e}_${s}`)}),Promise.resolve(!0)}}class et extends X{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 G=null;function is(){return G||(G=new et,G)}class as extends X{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=ct;exports.ACCESS_KEY=de;exports.Access=Y;exports.BUILD_IN_TAGS=je;exports.BUILT_IN_DIRECTIVES=$e;exports.BaseService=X;exports.CONTEXT_HOST=ie;exports.Context=Ge;exports.ContextMode=S;exports.DATA_TYPES=be;exports.HOMEPAGE_ROUTE_NAME=U;exports.HTML_TAGS=le;exports.JSCodeToString=ht;exports.LIFE_CYCLES_LIST=it;exports.LocalService=as;exports.MemoryService=et;exports.NodeEnv=Ye;exports.PAGE_ROUTE_NAME=x;exports.Provider=Xe;exports.REMOTE=at;exports.StorageService=os;exports.VTJ_RENDERER_VERSION=D;exports.adoptStylesToInline=ft;exports.adoptedStyleSheets=Q;exports.clearLoaderCache=Rt;exports.compileScopedCSS=Te;exports.convertCssRpx=Oe;exports.createAccess=_t;exports.createAdapter=gt;exports.createAssetScripts=lt;exports.createAssetsCss=ut;exports.createDataSources=ze;exports.createLoader=V;exports.createMemoryService=is;exports.createMenus=q;exports.createMetaApi=Ue;exports.createMock=Je;exports.createProvider=es;exports.createRenderer=z;exports.createSchemaApi=Le;exports.createSchemaApis=qe;exports.createServiceRequest=rs;exports.defaultLoader=We;exports.fillBasePath=N;exports.getMock=k;exports.getModifiers=ge;exports.getPlugin=me;exports.getRawComponent=Ae;exports.isBuiltInTag=xe;exports.isCSSUrl=B;exports.isJSCode=He;exports.isJSExpression=j;exports.isJSFunction=b;exports.isJSON=Ce;exports.isJSUrl=J;exports.isNativeTag=ke;exports.isVuePlugin=De;exports.loadCss=Fe;exports.loadCssUrl=pe;exports.loadEnhance=ts;exports.loadScriptUrl=fe;exports.menusFilter=_e;exports.mockApi=Ke;exports.mockApis=Be;exports.mockCleanup=he;exports.nodeCache=F;exports.nodeRender=O;exports.parseDeps=Pe;exports.parseExpression=H;exports.parseFunction=R;exports.parseUrls=Ie;exports.providerKey=ve;exports.removeProdFlag=Re;exports.rpxToPx=Me;exports.setupPageSetting=dt;exports.toString=ue;exports.useAccess=Ne;exports.useMask=Gt;exports.useProvider=ye;
|
|
16
|
+
}`:"(v) => {}"},r=t.__parseFunction(s),o=ge(j(e.modifiers)?t.__parseExpression(e.modifiers):e.modifiers),i=j(e.arg)?t.__parseExpression(e.arg):e.arg||"modelValue";return{[i]:t.__parseExpression(e.value),[`onUpdate:${i}`]:o.length&&r?n.withModifiers(r,o):r}}function qt(n,e,t,s,r){if(!e)return null;if(f.isString(e))return{default:()=>e};if(j(e))return{default:()=>ue(t.__parseExpression(e))};if(Array.isArray(e)&&e.length>0){const o=Bt(e),i=(a,u)=>!a||!r?{}:r?.id&&Object.keys(a).length?u?{[u]:a}:{[`scope_${r.id}`]:a}:u?{[u]:Object.create(null)}:{};return Object.entries(o).reduce((a,[u,{nodes:c,params:l,scope:p}])=>(a[u]=d=>{const h=l.length?f.pick(d??{},l):i(d,p);return c.map((g,m)=>O(g,t.__clone(h),n,s,c,!1,m))},a),{})}return null}function Bt(n){const e={};for(const t of n){const s=Jt(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 Jt(n="default"){return f.isString(n)?{name:n,params:[],scope:""}:{params:[],scope:"",...n}}function Kt(n,e,t){const{value:s,iterator:r}=n,{item:o="item",index:i="index"}=r||{};let a=t.__parseExpression(s)||[];return Number.isInteger(a)&&(a=new Array(a).fill(!0).map((u,c)=>c+1)),Array.isArray(a)?a.map((u,c)=>e(t.__clone({[o]:u,[i]:c}),c)):(console.warn("[vForRender]:",`${s?.value} is not a Arrary`),[])}const re=$.defineComponent({name:"VtjPageContainer",async setup(){const n=ye(),e=Ee.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:i}=n?.adapter;if(i){const a=e.meta.title||s.title||"VTJ.PRO";i(a)}}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",{style:{padding:"10px"}},"找不到组件,组件不存在或未发布!")},activated(){this.meta.cache===!1&&(this.sid=Symbol())}}),Gt=$.defineComponent({name:"VtjStartupContainer",render(){return $.h("div","page not found!")}});function q(n,e,t=[]){const s=[];for(const r of t){const{id:o,title:i,icon:a,children:u,hidden:c,layout:l}=r;if(l){const p=q(n,e,u||[]);s.push(...p)}else{const p={id:o,title:i,icon:a,hidden:c,url:`${n}/${e}/${o}`,children:u&&u.length?q(n,e,u):void 0};s.push(p)}}return s}function _e(n,e){if(!e)return n;let t=[];for(const s of n)if(s.children&&s.children.length){const r=_e(s.children,e);r.length&&(s.children=r,t.push(s))}else e.can(s.id.toString())&&t.push(s);return t}function zt(n){const{menuPathPrefix:e="",pageRouteName:t="page",disableMenusFilter:s=!1}=n||{},r=ye(),o=Ee.useRoute(),i=Ne(),a=$.ref(!1),u=$.ref(!1),c=r.project,l=(h,g)=>{a.value=!h?.mask,u.value=g?.pure??!!h?.pure};$.watchEffect(()=>{const{name:h,params:g,meta:m}=o;if(h===x){const _=r.getPage(g.id);l(_,m)}else if(h===U){const _=r.getHomepage();l(_,m)}else{const _=m.__vtj__;if(_){const y=r.getPage(_);l(y,m)}else a.value=!m.mask,u.value=!!m.pure}});const p=q(e,t,c?.pages),d=c?.config;return{disabled:a,logo:d?.logo,themeSwitchable:d?.themeSwitchable,title:d?.title||c?.description||c?.name||"VTJ App",menus:s?p:_e(p,i),pure:u}}function oe(n,e){const{id:t,title:s,meta:r}=n,{name:o="page",prefix:i="",component:a,routeMeta:u}=e;return{name:t,path:`${i}${o}/${t}`,component:a,meta:{title:s,...u,...r,__vtj__:t}}}function ce(n){const{name:e="page",prefix:t="",pages:s=[],component:r,loader:o,routeMeta:i,homepage:a}=n,u=[];for(const c of s){const{id:l,title:p,dir:d,layout:h,children:g,meta:m}=c;if(d){const _=ce({name:e,prefix:t,component:r,routeMeta:i,homepage:a,loader:o,pages:g||[]});u.push(..._)}else if(h){const _=ce({name:e,prefix:t,component:r,routeMeta:i,homepage:a,loader:o,pages:g||[]}),y={name:`layout_${l}`,path:t,component:()=>o(l),meta:{title:p,...i,...m,__vtj__:l},children:_};u.push(y),u.push(oe(c,n))}else if(u.push(oe(c,n)),a===l){const _=oe(c,n);_.path="",_.name=`home_${l}`,u.push(_)}}return u}function Vt(n={},e){const{css:t,store:s,enhance:r}=n,{window:o,app:i,library:a={},adapter:u,mode:c}=e,{Pinia:l}=a;i.config.globalProperties.$libs=a,Q(o,"global-css",t||""),l&&s&&Wt(s,i,l),Yt(i,u,n),!u.access&&n.access&&Qt(n.access,i,c,u),Xt(i,n),r&&Zt(r,i,a)}function Wt(n,e,t){const s=t.createPinia();if(e.use(s),b(n)&&n.value){const r=R(n,{},!1,!1,!0),o=t.defineStore("$store",r(e)||{});e.config.globalProperties.$store=o()}}function Qt(n,e,t,s){if(b(n)&&n.value){const r=R(n,{},!1,!1,!0),{alert:o,request:i}=s,a=new Y({alert:o,storagePrefix:"__VTJ_APP_",...r(e)}),u=e.config.globalProperties.$router;a.connect({mode:t,router:u,request:i}),e.use(a)}}function Yt(n,e,t){if(!e.request)return;const{axios:s,request:r,response:o}=t;if(s&&b(s)&&s.value){const i=R(s,{},!1,!1,!0);e.request.setConfig(i(n))}if(r&&b(r)&&r.value){const i=R(r,{},!1,!1,!0),a=e.request;a.__unReq&&a.__unReq(),a.__unReq=e.request.useRequest(u=>i(u,n))}if(o&&b(o)&&o.value){const i=R(o,{},!1,!1,!0),a=e.request;a.__unRes&&a.__unRes(),a.__unRes=e.request.useResponse(u=>i(u,n))}}function Xt(n,e){const{beforeEach:t,afterEach:s}=e,r=n.config.globalProperties.$router;if(t&&b(t)&&t.value){const o=R(t,{},!1,!1,!0);r&&r.beforeEach((i,a,u)=>o(i,a,u,n))}if(s&&b(s)&&s.value){const o=R(s,{},!1,!1,!0);r&&r.afterEach((i,a,u)=>o(i,a,u,n))}}function Zt(n,e,t={}){b(n)&&n.value&&R(n,{},!1,!1,!0)(e,t)}function es(n,e,t){if(!n||!e||!t)return;const{VueI18n:s}=e;if(s){const{locale:r,fallbackLocale:o,messages:i=[]}=t,a={};for(let c of i){const l=Object.keys(c).filter(p=>p!=="key");for(const p of l)a[p]||(a[p]={}),a[p][c.key]=c[p]}const u=s.createI18n({legacy:!1,locale:r,fallbackLocale:o,messages:a});n.use(u)}}const ve=Symbol("Provider");var Ye=(n=>(n.Production="production",n.Development="development",n))(Ye||{});class Xe extends T.Base{constructor(e){super(),this.options=e;const{service:t,mode:s=S.Raw,dependencies:r,materials:o,project:i={},adapter:a={},globals:u={},modules:c={},router:l=null,materialPath:p="./",nodeEnv:d="development"}=e;this.mode=s,this.modules=c,this.service=t,this.router=l,this.materialPath=p,this.nodeEnv=d,r&&(this.dependencies=r),o&&(this.materials=o),Object.assign(this.globals,u),Object.assign(this.adapter,a);const{access:h,request:g}=this.adapter;h&&h.connect({mode:s,router:l,request:g}),i&&s!==S.Design?this.load(i):this.project=i}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 k()?.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:i=[]}=this.project,a=window;a&&(a.CKEDITOR_VERSION=void 0),this.initEnv(i),this.mode===S.Raw?await this.loadDependencies(a):await this.loadAssets(a),this.initMock(a),this.apis=qe(r,o,this.adapter),he(a),Be(r,a),e.platform!=="uniapp"&&this.initRouter(),this.triggerReady()}initMock(e){const t=k(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:i,nodeEnv:a,libraryLocales:u}=this,{libraryExports:c,libraryMap:l,materials:p,materialExports:d,materialMapLibrary:h,libraryLocaleMap:g}=Pe(t,i,a==="development");Object.assign(this.libraryLocaleMap,g);for(const m of c){const _=s[m],y=e[m];if(y)r[m]=y;else if(_)e[m]=r[m]=await _();else{const C=l[m]||[];for(const v of C)B(v)&&await Fe(v,f.url.append(v,{v:D})),J(v)&&await f.loadScript(f.url.append(v,{v:D}));r[m]=e[m]}const w=g[m];if(w){const C=s[w];u[w]=C?await C():e[w]}}if(a==="development"){for(const _ of p)await f.loadScript(f.url.append(_,{v:D}));const m=this.materials||{};for(const _ of d){const y=e[h[_]],w=y?.default||y,C=T.BUILT_IN_COMPONENTS[_];if(C)w&&C.forEach(v=>{o[v]=w[v]});else{const v=m[_]?(await m[_]()).default:e[_];v&&w&&(v.components||[]).forEach(A=>{o[A.name]=Ae(A,w)})}}}}initRouter(){const{router:e,project:t,options:s,adapter:r}=this;if(!e)return;const o=t?.platform==="uniapp"?"pages":"page",{routeAppendTo:i,pageRouteName:a=o,routeMeta:u}=s,c=i?"":"/",l={path:`${c}${a}/:id`,name:x,component:re},p=this.getHomepage(),d={path:c,name:U,component:p?re:r.startupComponent||Gt,meta:u};if(e.hasRoute(x)&&e.removeRoute(x),e.hasRoute(U)&&e.removeRoute(U),s.enableStaticRoute){const h=t?.pages||[];ce({name:a,prefix:c,pages:h,component:re,loader:this.getRenderComponent.bind(this),homepage:p?.id}).forEach(m=>{i?e.addRoute(i,m):e.addRoute(m)}),p||(i?e.addRoute(i,d):e.addRoute(d))}else i?(e.addRoute(i,l),e.addRoute(i,d)):(e.addRoute(l),e.addRoute(d))}setErrorHandler(e){e.config.errorHandler=f.debounce((t,s,r)=>{const o=s?.$options.name,i=typeof t=="string"?t:t?.message||t?.msg||"未知错误",a=`[ ${o} ] ${i} ${r}`;["getComputedStyle","ResizeObserver"].some(c=>a.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(a,"组件渲染错误","error"))},300)}install(e){const{libraryLocaleMap:t,libraryLocales:s}=this,{libraryOptions:r={}}=this.options,o=e.config.globalProperties.installed||{};for(const[i,a]of Object.entries(this.library))if(!o[i]&&De(a)){const c={locale:s[t[i]]},l=r[i]||{},p={...c,...l};e.use(a,p),o[i]=!0}e.provide(ve,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 i of o){if(i.id===r)return i;if(i.children&&i.children.length){const a=s(r,i.children);if(a)return a}}};return s(e,t)||null}getFirstPage(){const{pages:e=[]}=this.project||{};if(!e.length)return null;const t=(s=[])=>{for(const r of s){if(r.type==="page"&&!r.dir&&!r.layout)return r;if(r.children&&r.children.length){const o=t(r.children);if(o)return o}}};return t(e)||null}getMenus(e="page",t=""){return q(t,e,this.project?.pages||[])}getHomepage(){const{homepage:e}=this.project||{};return e?this.getPage(e):this.getFirstPage()}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:i}=this,a={mode:o,Vue:s.Vue,components:r,libs:s,apis:i,window,...t},u=V({getDsl:async c=>await this.getDsl(c)||null,getDslByUrl:async c=>await this.getDslByUrl(c)||null,options:a});return z({...a,dsl:e,loader:u})}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,i=`${o}/${e}.vue`,a=this.modules[i]||this.modules[`/src/pages/${e}.vue`];return a?(await a())?.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 me(e,window))}initGlobals(e,t){const s=Object.assign({adapter:this.adapter,window},t);Vt(e,s)}initI18n(e,t,s){es(e,t,s)}initEnv(e=[]){this.env=e.reduce((t,s)=>(t[s.name]=s[this.nodeEnv],t),{})}}function ts(n){const e=new Xe(n);return{provider:e,onReady:s=>e.ready(s)}}function ye(n={}){const e=$.inject(ve,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 ss(n,e=""){const{name:t,urls:s=[]}=n||{},r=s.map(a=>e+a),{css:o,js:i}=Ie(r);if(o.length&&pe(o),i.length)return await fe(i,t).catch(()=>{})}const Ze={type:"json",validSuccess:!0,originResponse:!1,failMessage:!0,validate:n=>n.data?.code===0},ns=(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:Ze}),rs=(n,e="/__vtj__/api/uploader.json")=>async(t,s)=>await n.send({url:e,method:"post",data:{files:t,projectId:s},settings:{...Ze,type:"data"}}).then(r=>r&&r[0]?r[0]:null).catch(()=>null);function os(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 X{constructor(e=f.request){this.req=e,this.api=ns(e),this.uploader=rs(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=>Ce(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 E=new f.Storage({type:"local",expired:0,prefix:"__VTJ_"});class is extends X{init(e){const t=new T.ProjectModel(e),s=E.get(`project_${t.id}`),r=Object.assign(t.toDsl(),s||{});return E.save(`project_${t.id}`,r),Promise.resolve(r)}saveProject(e){const t=new T.ProjectModel(e);return E.save(`project_${t.id}`,t.toDsl()),Promise.resolve(!0)}saveMaterials(e,t){return E.save(`materials_${e.id}`,f.mapToObject(t)),Promise.resolve(!0)}saveFile(e){return E.save(`file_${e.id}`,e),Promise.resolve(!0)}getFile(e){const t=E.get(`file_${e}`);return t?Promise.resolve(t):Promise.reject(null)}removeFile(e){return E.remove(`file_${e}`),Promise.resolve(!0)}saveHistory(e){return E.save(`history_${e.id}`,e),Promise.resolve(!0)}removeHistory(e){const t=E.get(`history_${e}`);if(t){const r=(t.items||[]).map(o=>o.id);this.removeHistoryItem(e,r),E.remove(`history_${e}`)}return Promise.resolve(!0)}getHistory(e){const t=E.get(`history_${e}`),s=new T.HistoryModel(t||{id:e});return Promise.resolve(s.toDsl())}getHistoryItem(e,t){const s=E.get(`history_${e}_${t}`);return Promise.resolve(s)}saveHistoryItem(e,t){return E.save(`history_${e}_${t.id}`,t),Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(s=>{E.remove(`history_${e}_${s}`)}),Promise.resolve(!0)}}class et extends X{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 G=null;function as(){return G||(G=new et,G)}class cs extends X{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=ct;exports.ACCESS_KEY=de;exports.Access=Y;exports.BUILD_IN_TAGS=je;exports.BUILT_IN_DIRECTIVES=$e;exports.BaseService=X;exports.CONTEXT_HOST=ie;exports.Context=Ge;exports.ContextMode=S;exports.DATA_TYPES=be;exports.HOMEPAGE_ROUTE_NAME=U;exports.HTML_TAGS=le;exports.JSCodeToString=mt;exports.LIFE_CYCLES_LIST=it;exports.LocalService=cs;exports.MemoryService=et;exports.NodeEnv=Ye;exports.PAGE_ROUTE_NAME=x;exports.Provider=Xe;exports.REMOTE=at;exports.StorageService=is;exports.VTJ_RENDERER_VERSION=D;exports.adoptStylesToInline=ft;exports.adoptedStyleSheets=Q;exports.clearLoaderCache=Pt;exports.compileScopedCSS=Te;exports.convertCssRpx=Oe;exports.createAccess=vt;exports.createAdapter=_t;exports.createAssetScripts=lt;exports.createAssetsCss=ut;exports.createDataSources=ze;exports.createLoader=V;exports.createMemoryService=as;exports.createMenus=q;exports.createMetaApi=Ue;exports.createMock=Je;exports.createProvider=ts;exports.createRenderer=z;exports.createSchemaApi=Le;exports.createSchemaApis=qe;exports.createServiceRequest=os;exports.defaultLoader=We;exports.fillBasePath=N;exports.getMock=k;exports.getModifiers=ge;exports.getPlugin=me;exports.getRawComponent=Ae;exports.isBuiltInTag=xe;exports.isCSSUrl=B;exports.isJSCode=He;exports.isJSExpression=j;exports.isJSFunction=b;exports.isJSON=Ce;exports.isJSUrl=J;exports.isNativeTag=ke;exports.isVuePlugin=De;exports.loadCss=Fe;exports.loadCssUrl=pe;exports.loadEnhance=ss;exports.loadScriptUrl=fe;exports.menusFilter=_e;exports.mockApi=Ke;exports.mockApis=Be;exports.mockCleanup=he;exports.nodeCache=F;exports.nodeRender=O;exports.parseDeps=Pe;exports.parseExpression=H;exports.parseFunction=R;exports.parseUrls=Ie;exports.providerKey=ve;exports.removeProdFlag=Re;exports.rpxToPx=Me;exports.setupPageSetting=dt;exports.toString=ue;exports.useAccess=Ne;exports.useMask=zt;exports.useProvider=ye;
|
package/dist/index.mjs
CHANGED
|
@@ -7,10 +7,10 @@ import { useRoute as Oe } 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.27
|
|
11
11
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
12
12
|
*/
|
|
13
|
-
const k = "0.16.
|
|
13
|
+
const k = "0.16.27";
|
|
14
14
|
var y = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(y || {});
|
|
15
15
|
const Re = [
|
|
16
16
|
"$el",
|
|
@@ -24,7 +24,7 @@ const Re = [
|
|
|
24
24
|
"$props",
|
|
25
25
|
"$options",
|
|
26
26
|
"$forceUpdate"
|
|
27
|
-
],
|
|
27
|
+
], As = [
|
|
28
28
|
"beforeCreate",
|
|
29
29
|
"created",
|
|
30
30
|
"beforeMount",
|
|
@@ -57,7 +57,7 @@ const Re = [
|
|
|
57
57
|
Date
|
|
58
58
|
}, H = "VtjPage", J = "VtjHomepage", Me = "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
|
-
), dt = "component,slot".split(","),
|
|
60
|
+
), dt = "component,slot".split(","), Is = [
|
|
61
61
|
"h",
|
|
62
62
|
"t",
|
|
63
63
|
"t",
|
|
@@ -77,7 +77,7 @@ const Re = [
|
|
|
77
77
|
"p",
|
|
78
78
|
"r",
|
|
79
79
|
"o"
|
|
80
|
-
].join(""),
|
|
80
|
+
].join(""), Fs = {
|
|
81
81
|
auth: [
|
|
82
82
|
"h",
|
|
83
83
|
"t",
|
|
@@ -149,12 +149,12 @@ function X(n) {
|
|
|
149
149
|
function ht(n) {
|
|
150
150
|
return /\.json$/.test(n);
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function Os(n) {
|
|
153
153
|
return n.map(
|
|
154
154
|
(e) => `<script src="${O.append(e, { v: k })}"><\/script>`
|
|
155
155
|
).join("");
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function Ms(n = []) {
|
|
158
158
|
return n.map(
|
|
159
159
|
(e) => `<link rel="stylesheet" href="${O.append(e, { v: k })}" />`
|
|
160
160
|
).join("");
|
|
@@ -347,7 +347,7 @@ function ge(n, e, t, s = !1) {
|
|
|
347
347
|
l ? l.innerHTML = a : (l = c.createElement("style"), l.id = e, l.innerHTML = a, c.head.appendChild(l));
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
|
-
function
|
|
350
|
+
function Ts(n) {
|
|
351
351
|
const e = n.adoptedStyleSheets || [];
|
|
352
352
|
let t = "";
|
|
353
353
|
if (e.forEach((s) => {
|
|
@@ -405,11 +405,21 @@ function N(n = window) {
|
|
|
405
405
|
if (t && window)
|
|
406
406
|
return window.Mock = t, t;
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function xs(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");
|
|
412
412
|
}
|
|
413
|
+
function Ct(n) {
|
|
414
|
+
if (typeof window > "u") return;
|
|
415
|
+
const e = window[0] || window;
|
|
416
|
+
if (e.__simulator__)
|
|
417
|
+
try {
|
|
418
|
+
const t = e.__simulator__.engine.provider.errorHandler;
|
|
419
|
+
t && t(n);
|
|
420
|
+
} catch {
|
|
421
|
+
}
|
|
422
|
+
}
|
|
413
423
|
function B(n, e, t = !1, s = !1, r = !1) {
|
|
414
424
|
try {
|
|
415
425
|
const i = ['"use strict";', "var __self = arguments[0];"];
|
|
@@ -422,7 +432,7 @@ ${o}
|
|
|
422
432
|
` : `with(${t ? "{}" : "$scope || {}"}) { ${o} }`;
|
|
423
433
|
return new Function("$scope", a)(e);
|
|
424
434
|
} catch (i) {
|
|
425
|
-
if (M.error("parseExpression.error", i, n, e?.__self ?? e), s)
|
|
435
|
+
if (M.error("parseExpression.error", i, n, e?.__self ?? e), Ct(i), s)
|
|
426
436
|
throw i;
|
|
427
437
|
}
|
|
428
438
|
}
|
|
@@ -443,13 +453,13 @@ function E(n) {
|
|
|
443
453
|
function $(n) {
|
|
444
454
|
return typeof n == "object" && n && n.type === "JSFunction";
|
|
445
455
|
}
|
|
446
|
-
function
|
|
456
|
+
function Pt(n) {
|
|
447
457
|
return E(n) || $(n);
|
|
448
458
|
}
|
|
449
|
-
function
|
|
450
|
-
return
|
|
459
|
+
function Ds(n) {
|
|
460
|
+
return Pt(n) ? n.value : JSON.stringify(n);
|
|
451
461
|
}
|
|
452
|
-
const
|
|
462
|
+
const At = {
|
|
453
463
|
session: !1,
|
|
454
464
|
authKey: "Authorization",
|
|
455
465
|
storageKey: "ACCESS_STORAGE",
|
|
@@ -470,7 +480,7 @@ class _e {
|
|
|
470
480
|
interceptResponse = !0;
|
|
471
481
|
isTipShowing = !1;
|
|
472
482
|
constructor(e) {
|
|
473
|
-
this.options = Object.assign({},
|
|
483
|
+
this.options = Object.assign({}, At, e), this.loadData();
|
|
474
484
|
}
|
|
475
485
|
enableIntercept() {
|
|
476
486
|
this.interceptResponse = !0;
|
|
@@ -619,10 +629,10 @@ class _e {
|
|
|
619
629
|
);
|
|
620
630
|
}
|
|
621
631
|
}
|
|
622
|
-
function
|
|
632
|
+
function It() {
|
|
623
633
|
return Ie(ke, null);
|
|
624
634
|
}
|
|
625
|
-
function
|
|
635
|
+
function ks(n = {}) {
|
|
626
636
|
const {
|
|
627
637
|
notify: e,
|
|
628
638
|
loading: t,
|
|
@@ -663,10 +673,10 @@ function Ds(n = {}) {
|
|
|
663
673
|
access: i ? new _e({ alert: a, ...i }) : void 0
|
|
664
674
|
};
|
|
665
675
|
}
|
|
666
|
-
function
|
|
676
|
+
function Hs(n = {}) {
|
|
667
677
|
return new _e(n);
|
|
668
678
|
}
|
|
669
|
-
function
|
|
679
|
+
function Ft(n, e) {
|
|
670
680
|
const { jsonp: t, request: s } = e;
|
|
671
681
|
if (n.method === "jsonp")
|
|
672
682
|
return (r = {}) => t(n.url, {
|
|
@@ -685,7 +695,7 @@ function It(n, e) {
|
|
|
685
695
|
return (o, a) => (delete i.data, s.send(et(i, a || {}, { data: o })));
|
|
686
696
|
}
|
|
687
697
|
}
|
|
688
|
-
function
|
|
698
|
+
function Ot(n, e) {
|
|
689
699
|
const { metaQuery: t } = e;
|
|
690
700
|
if (!t) return;
|
|
691
701
|
const { code: s, queryCode: r } = n;
|
|
@@ -697,21 +707,21 @@ function Ft(n, e) {
|
|
|
697
707
|
return t(s, r, i, o);
|
|
698
708
|
};
|
|
699
709
|
}
|
|
700
|
-
function
|
|
710
|
+
function Mt(n = [], e = [], t) {
|
|
701
711
|
const s = {};
|
|
702
712
|
for (const r of n) {
|
|
703
|
-
const i =
|
|
713
|
+
const i = Ft(r, t);
|
|
704
714
|
s[r.id] = i, s[r.name] = i;
|
|
705
715
|
}
|
|
706
716
|
for (const r of e)
|
|
707
|
-
s[r.id] =
|
|
717
|
+
s[r.id] = Ot(r, t);
|
|
708
718
|
return s;
|
|
709
719
|
}
|
|
710
|
-
async function
|
|
720
|
+
async function Tt(n = [], e = window) {
|
|
711
721
|
const t = N(e);
|
|
712
|
-
t && (He(e), n.forEach((s) =>
|
|
722
|
+
t && (He(e), n.forEach((s) => Dt(t, s)));
|
|
713
723
|
}
|
|
714
|
-
function
|
|
724
|
+
function xt(n, e = window) {
|
|
715
725
|
const t = $(n.mockTemplate) && n.mockTemplate.value ? R(n.mockTemplate, {}, !0) : void 0, s = N(e);
|
|
716
726
|
return async (...r) => {
|
|
717
727
|
let i = {};
|
|
@@ -724,7 +734,7 @@ function Tt(n, e = window) {
|
|
|
724
734
|
return s?.mock(i);
|
|
725
735
|
};
|
|
726
736
|
}
|
|
727
|
-
function
|
|
737
|
+
function Dt(n, e) {
|
|
728
738
|
if (!e.mock) return;
|
|
729
739
|
const { url: t, mockTemplate: s } = e;
|
|
730
740
|
if (t && s)
|
|
@@ -747,7 +757,7 @@ function He(n = window) {
|
|
|
747
757
|
const e = N(n);
|
|
748
758
|
e && (e._mocked = {});
|
|
749
759
|
}
|
|
750
|
-
class
|
|
760
|
+
class kt {
|
|
751
761
|
__id = null;
|
|
752
762
|
__mode;
|
|
753
763
|
__instance = null;
|
|
@@ -863,7 +873,7 @@ function fe(n) {
|
|
|
863
873
|
$components: s,
|
|
864
874
|
$libs: r,
|
|
865
875
|
$apis: i
|
|
866
|
-
}, c = new
|
|
876
|
+
}, c = new kt({
|
|
867
877
|
mode: t,
|
|
868
878
|
dsl: a.value,
|
|
869
879
|
attrs: u
|
|
@@ -871,7 +881,7 @@ function fe(n) {
|
|
|
871
881
|
name: a.value.name,
|
|
872
882
|
__scopeId: a.value.id ? `data-v-${a.value.id}` : void 0,
|
|
873
883
|
props: {
|
|
874
|
-
...
|
|
884
|
+
...Nt(a.value.props ?? [], c)
|
|
875
885
|
},
|
|
876
886
|
async setup(f = {}) {
|
|
877
887
|
c.$props = f, c.props = f, a.value.id && ge(
|
|
@@ -879,11 +889,11 @@ function fe(n) {
|
|
|
879
889
|
a.value.id,
|
|
880
890
|
a.value.css || "",
|
|
881
891
|
!0
|
|
882
|
-
), c.state =
|
|
883
|
-
const p =
|
|
892
|
+
), c.state = Bt(e, a.value.state ?? {}, c);
|
|
893
|
+
const p = Lt(e, a.value.computed ?? {}, c), d = qt(a.value.methods ?? {}, c), m = Ut(e, a.value.inject, c);
|
|
884
894
|
for (const [v, w] of Object.entries(m || {}))
|
|
885
895
|
m[v] = e.inject(v, w);
|
|
886
|
-
const h =
|
|
896
|
+
const h = Jt(
|
|
887
897
|
a.value.dataSources || {},
|
|
888
898
|
c
|
|
889
899
|
), g = {
|
|
@@ -892,7 +902,7 @@ function fe(n) {
|
|
|
892
902
|
...d,
|
|
893
903
|
...h
|
|
894
904
|
};
|
|
895
|
-
return c.setup(g, e),
|
|
905
|
+
return c.setup(g, e), Kt(e, a.value.watch ?? [], c), {
|
|
896
906
|
vtj: c,
|
|
897
907
|
state: c.state,
|
|
898
908
|
...f,
|
|
@@ -900,7 +910,7 @@ function fe(n) {
|
|
|
900
910
|
...d
|
|
901
911
|
};
|
|
902
912
|
},
|
|
903
|
-
emits:
|
|
913
|
+
emits: Ht(a.value.emits),
|
|
904
914
|
expose: ["vtj", ...a.value.expose || []],
|
|
905
915
|
render() {
|
|
906
916
|
if (!a.value.nodes) return null;
|
|
@@ -914,17 +924,17 @@ function fe(n) {
|
|
|
914
924
|
return e.createVNode("div", {}, p);
|
|
915
925
|
}
|
|
916
926
|
},
|
|
917
|
-
...
|
|
927
|
+
...zt(a.value.lifeCycles ?? {}, c)
|
|
918
928
|
});
|
|
919
929
|
return {
|
|
920
930
|
renderer: e.markRaw(l),
|
|
921
931
|
context: c
|
|
922
932
|
};
|
|
923
933
|
}
|
|
924
|
-
function
|
|
934
|
+
function Ht(n = []) {
|
|
925
935
|
return n.map((e) => I(e) ? e : e.name);
|
|
926
936
|
}
|
|
927
|
-
function
|
|
937
|
+
function Nt(n = [], e) {
|
|
928
938
|
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((i) => pt[i]) : void 0;
|
|
929
939
|
return n.map((s) => I(s) ? {
|
|
930
940
|
name: s
|
|
@@ -942,7 +952,7 @@ function Ht(n = [], e) {
|
|
|
942
952
|
{}
|
|
943
953
|
);
|
|
944
954
|
}
|
|
945
|
-
function
|
|
955
|
+
function Bt(n, e, t) {
|
|
946
956
|
return n.reactive(
|
|
947
957
|
Object.keys(e || {}).reduce(
|
|
948
958
|
(s, r) => {
|
|
@@ -953,19 +963,19 @@ function Nt(n, e, t) {
|
|
|
953
963
|
)
|
|
954
964
|
);
|
|
955
965
|
}
|
|
956
|
-
function
|
|
966
|
+
function Lt(n, e, t) {
|
|
957
967
|
return Object.entries(e ?? {}).reduce(
|
|
958
968
|
(s, [r, i]) => (s[r] = n.computed(t.__parseFunction(i)), s),
|
|
959
969
|
{}
|
|
960
970
|
);
|
|
961
971
|
}
|
|
962
|
-
function
|
|
972
|
+
function qt(n, e) {
|
|
963
973
|
return Object.entries(n ?? {}).reduce(
|
|
964
974
|
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
|
965
975
|
{}
|
|
966
976
|
);
|
|
967
977
|
}
|
|
968
|
-
function
|
|
978
|
+
function Ut(n, e = [], t) {
|
|
969
979
|
return e.reduce(
|
|
970
980
|
(s, r) => {
|
|
971
981
|
const { name: i, from: o } = r || {};
|
|
@@ -976,12 +986,12 @@ function qt(n, e = [], t) {
|
|
|
976
986
|
{}
|
|
977
987
|
);
|
|
978
988
|
}
|
|
979
|
-
function
|
|
989
|
+
function Jt(n, e) {
|
|
980
990
|
return Object.keys(n).reduce(
|
|
981
991
|
(t, s) => {
|
|
982
992
|
const r = n[s];
|
|
983
993
|
if (r.type === "mock")
|
|
984
|
-
t[s] =
|
|
994
|
+
t[s] = xt(r);
|
|
985
995
|
else if (r.ref) {
|
|
986
996
|
const i = e.$apis[r.ref], o = $(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
|
|
987
997
|
t[s] = async (...a) => {
|
|
@@ -994,7 +1004,7 @@ function Ut(n, e) {
|
|
|
994
1004
|
{}
|
|
995
1005
|
);
|
|
996
1006
|
}
|
|
997
|
-
function
|
|
1007
|
+
function Kt(n, e = [], t) {
|
|
998
1008
|
e.forEach((s) => {
|
|
999
1009
|
n.watch(
|
|
1000
1010
|
t.__parseExpression(s.source),
|
|
@@ -1006,7 +1016,7 @@ function Jt(n, e = [], t) {
|
|
|
1006
1016
|
);
|
|
1007
1017
|
});
|
|
1008
1018
|
}
|
|
1009
|
-
function
|
|
1019
|
+
function zt(n, e) {
|
|
1010
1020
|
return Object.entries(n ?? {}).reduce(
|
|
1011
1021
|
(t, [s, r]) => {
|
|
1012
1022
|
const i = e.__parseFunction(r);
|
|
@@ -1017,7 +1027,7 @@ function Kt(n, e) {
|
|
|
1017
1027
|
{}
|
|
1018
1028
|
);
|
|
1019
1029
|
}
|
|
1020
|
-
class
|
|
1030
|
+
class Gt {
|
|
1021
1031
|
__props = {};
|
|
1022
1032
|
__events = {};
|
|
1023
1033
|
__nodes = {};
|
|
@@ -1059,9 +1069,9 @@ class zt {
|
|
|
1059
1069
|
this.__props = {}, this.__events = {}, this.__nodes = {};
|
|
1060
1070
|
}
|
|
1061
1071
|
}
|
|
1062
|
-
const x = new
|
|
1072
|
+
const x = new Gt(), Ne = new it();
|
|
1063
1073
|
let re = [], F = {}, D = {};
|
|
1064
|
-
const
|
|
1074
|
+
const Vt = (n, e) => e;
|
|
1065
1075
|
async function Be(n, e = window) {
|
|
1066
1076
|
const { urls: t = [], library: s } = n, r = t.filter((a) => X(a));
|
|
1067
1077
|
if (r.length === 0 || !s) return null;
|
|
@@ -1114,38 +1124,38 @@ function pe(n) {
|
|
|
1114
1124
|
return i;
|
|
1115
1125
|
};
|
|
1116
1126
|
}
|
|
1117
|
-
function
|
|
1127
|
+
function Ns() {
|
|
1118
1128
|
F = {}, D = {}, Ne.clearAllCache(), x.clear();
|
|
1119
1129
|
}
|
|
1120
|
-
function T(n, e, t = W, s =
|
|
1130
|
+
function T(n, e, t = W, s = Vt, r = [], i = !1, o = 0) {
|
|
1121
1131
|
if (!n || !n.name || n.invisible) return null;
|
|
1122
1132
|
const a = t.getCurrentInstance()?.appContext, { id: u = null, directives: c = [] } = n, { vIf: l, vElseIf: f, vElse: p, vFor: d, vShow: m, vModels: h, vBind: g, vHtml: v, others: w } = Le(c);
|
|
1123
1133
|
if (!i && (f || p))
|
|
1124
1134
|
return null;
|
|
1125
|
-
if (l && !
|
|
1126
|
-
return
|
|
1135
|
+
if (l && !Qt(l, e))
|
|
1136
|
+
return ts(n, e, t, s, r);
|
|
1127
1137
|
const b = (_, C = 0) => {
|
|
1128
1138
|
const Y = _.$components, Z = (() => {
|
|
1129
1139
|
if (n.name === "component")
|
|
1130
|
-
return
|
|
1140
|
+
return Xt(_, n.props?.is);
|
|
1131
1141
|
if (n.name === "slot") return n.name;
|
|
1132
1142
|
const j = s(`${n.id}_${C}`, n.name, n.from, t);
|
|
1133
1143
|
return I(j) ? jt(j) || Rt(j) ? j : Y[j] ?? a?.app?.component(j) ?? j : j;
|
|
1134
|
-
})(), A =
|
|
1144
|
+
})(), A = Yt(u, n.props ?? {}, _), Ge = es(
|
|
1135
1145
|
t,
|
|
1136
1146
|
n.id,
|
|
1137
1147
|
n.events ?? {},
|
|
1138
1148
|
_
|
|
1139
1149
|
);
|
|
1140
1150
|
if (n.name === "slot")
|
|
1141
|
-
return
|
|
1151
|
+
return ss(t, n, A, _, s);
|
|
1142
1152
|
g && Object.assign(A, _.__parseExpression(g.value)), m && (A.style = Object.assign(
|
|
1143
1153
|
A.style ?? {},
|
|
1144
|
-
|
|
1145
|
-
)), v && Object.assign(A,
|
|
1146
|
-
Me.includes(n.name) ? Object.assign(A,
|
|
1154
|
+
rs(m, _)
|
|
1155
|
+
)), v && Object.assign(A, is(v, _)), h.forEach((j) => {
|
|
1156
|
+
Me.includes(n.name) ? Object.assign(A, os(j, _)) : Object.assign(A, as(t, j, _));
|
|
1147
1157
|
});
|
|
1148
|
-
const Ve =
|
|
1158
|
+
const Ve = cs(
|
|
1149
1159
|
t,
|
|
1150
1160
|
n.children ?? [],
|
|
1151
1161
|
_,
|
|
@@ -1164,12 +1174,12 @@ function T(n, e, t = W, s = Gt, r = [], i = !1, o = 0) {
|
|
|
1164
1174
|
x.getNode(L) || ee || {},
|
|
1165
1175
|
Ve
|
|
1166
1176
|
);
|
|
1167
|
-
const we = a ?
|
|
1177
|
+
const we = a ? Wt(a, w, _) : [];
|
|
1168
1178
|
return we.length && (te = t.withDirectives(te, we)), te;
|
|
1169
1179
|
};
|
|
1170
|
-
return d ?
|
|
1180
|
+
return d ? fs(d, b, e) : b(e, o);
|
|
1171
1181
|
}
|
|
1172
|
-
function
|
|
1182
|
+
function Wt(n, e, t) {
|
|
1173
1183
|
const s = n.app;
|
|
1174
1184
|
return e.map((r) => {
|
|
1175
1185
|
const i = typeof r.name == "string" ? s.directive(r.name) : t.__parseExpression(r.name);
|
|
@@ -1198,13 +1208,13 @@ function Le(n = []) {
|
|
|
1198
1208
|
vHtml: a
|
|
1199
1209
|
};
|
|
1200
1210
|
}
|
|
1201
|
-
function
|
|
1211
|
+
function Qt(n, e) {
|
|
1202
1212
|
return !!e.__parseExpression(n.value);
|
|
1203
1213
|
}
|
|
1204
|
-
function
|
|
1214
|
+
function Xt(n, e) {
|
|
1205
1215
|
return e ? E(e) ? n.__parseExpression(e) : e : "div";
|
|
1206
1216
|
}
|
|
1207
|
-
function
|
|
1217
|
+
function Yt(n, e, t) {
|
|
1208
1218
|
const s = de(e, t);
|
|
1209
1219
|
return s.ref = t.__ref(n, s.ref), s;
|
|
1210
1220
|
}
|
|
@@ -1217,12 +1227,12 @@ function de(n, e) {
|
|
|
1217
1227
|
{}
|
|
1218
1228
|
) : n;
|
|
1219
1229
|
}
|
|
1220
|
-
function
|
|
1230
|
+
function Zt(n, e) {
|
|
1221
1231
|
return (t) => {
|
|
1222
1232
|
t?.key?.toLowerCase() === e.toLowerCase() && n(t);
|
|
1223
1233
|
};
|
|
1224
1234
|
}
|
|
1225
|
-
function
|
|
1235
|
+
function es(n, e, t, s) {
|
|
1226
1236
|
const r = ["passive", "capture", "once"], i = {
|
|
1227
1237
|
capture: "Capture",
|
|
1228
1238
|
once: "Once",
|
|
@@ -1232,14 +1242,14 @@ function Zt(n, e, t, s) {
|
|
|
1232
1242
|
(a, u) => {
|
|
1233
1243
|
const c = t[u], l = qe(c.modifiers), f = l.find((m) => r.includes(m)), p = "on" + ot(u) + (f && i[f] || ""), d = s.__parseFunction(c.handler);
|
|
1234
1244
|
return d && (a[p] = n.withModifiers(
|
|
1235
|
-
l.includes("enter") ?
|
|
1245
|
+
l.includes("enter") ? Zt(d, "enter") : d,
|
|
1236
1246
|
l
|
|
1237
1247
|
)), a;
|
|
1238
1248
|
},
|
|
1239
1249
|
{}
|
|
1240
1250
|
);
|
|
1241
1251
|
}
|
|
1242
|
-
function
|
|
1252
|
+
function ts(n, e, t, s, r = []) {
|
|
1243
1253
|
let i = r.findIndex((o) => o.id === n.id);
|
|
1244
1254
|
for (let o = ++i; o < r.length; o++) {
|
|
1245
1255
|
const { directives: a = [] } = r[o], { vElseIf: u, vElse: c } = Le(a);
|
|
@@ -1257,32 +1267,32 @@ function qe(n = {}, e = !1) {
|
|
|
1257
1267
|
const t = Object.keys(n);
|
|
1258
1268
|
return e ? t.map((s) => "." + s) : t;
|
|
1259
1269
|
}
|
|
1260
|
-
function
|
|
1261
|
-
const { children: i } = e, o =
|
|
1270
|
+
function ss(n, e, t, s, r) {
|
|
1271
|
+
const { children: i } = e, o = ns(e, s), a = s.$slots?.[o.name];
|
|
1262
1272
|
return a ? a(t) : i ? I(i) ? n.createTextVNode(i) : E(i) ? n.createTextVNode(
|
|
1263
1273
|
Te(s.__parseExpression(i))
|
|
1264
1274
|
) : Array.isArray(i) ? i.map(
|
|
1265
1275
|
(u, c) => T(u, s, n, r, i, !1, c)
|
|
1266
1276
|
) : null : null;
|
|
1267
1277
|
}
|
|
1268
|
-
function
|
|
1278
|
+
function ns(n, e) {
|
|
1269
1279
|
const { props: t } = n, s = t?.name || "default";
|
|
1270
1280
|
return {
|
|
1271
1281
|
name: E(s) ? e.__parseExpression(s) : s,
|
|
1272
1282
|
params: []
|
|
1273
1283
|
};
|
|
1274
1284
|
}
|
|
1275
|
-
function
|
|
1285
|
+
function rs(n, e) {
|
|
1276
1286
|
return e.__parseExpression(n.value) ? {} : {
|
|
1277
1287
|
display: "none"
|
|
1278
1288
|
};
|
|
1279
1289
|
}
|
|
1280
|
-
function
|
|
1290
|
+
function is(n, e) {
|
|
1281
1291
|
return {
|
|
1282
1292
|
innerHTML: e.__parseExpression(n.value) || ""
|
|
1283
1293
|
};
|
|
1284
1294
|
}
|
|
1285
|
-
function
|
|
1295
|
+
function os(n, e) {
|
|
1286
1296
|
const t = {
|
|
1287
1297
|
type: "JSFunction",
|
|
1288
1298
|
value: n.value?.value ? `(v) => {
|
|
@@ -1294,7 +1304,7 @@ function is(n, e) {
|
|
|
1294
1304
|
onInput: e.__parseFunction(t)
|
|
1295
1305
|
};
|
|
1296
1306
|
}
|
|
1297
|
-
function
|
|
1307
|
+
function as(n, e, t) {
|
|
1298
1308
|
const s = {
|
|
1299
1309
|
type: "JSFunction",
|
|
1300
1310
|
value: e.value?.value ? `(v) => {
|
|
@@ -1308,7 +1318,7 @@ function os(n, e, t) {
|
|
|
1308
1318
|
[`onUpdate:${o}`]: i.length && r ? n.withModifiers(r, i) : r
|
|
1309
1319
|
};
|
|
1310
1320
|
}
|
|
1311
|
-
function
|
|
1321
|
+
function cs(n, e, t, s, r) {
|
|
1312
1322
|
if (!e) return null;
|
|
1313
1323
|
if (I(e))
|
|
1314
1324
|
return { default: () => e };
|
|
@@ -1317,7 +1327,7 @@ function as(n, e, t, s, r) {
|
|
|
1317
1327
|
default: () => Te(t.__parseExpression(e))
|
|
1318
1328
|
};
|
|
1319
1329
|
if (Array.isArray(e) && e.length > 0) {
|
|
1320
|
-
const i =
|
|
1330
|
+
const i = ls(e), o = (a, u) => !a || !r ? {} : r?.id && Object.keys(a).length ? u ? {
|
|
1321
1331
|
[u]: a
|
|
1322
1332
|
} : {
|
|
1323
1333
|
[`scope_${r.id}`]: a
|
|
@@ -1342,10 +1352,10 @@ function as(n, e, t, s, r) {
|
|
|
1342
1352
|
}
|
|
1343
1353
|
return null;
|
|
1344
1354
|
}
|
|
1345
|
-
function
|
|
1355
|
+
function ls(n) {
|
|
1346
1356
|
const e = {};
|
|
1347
1357
|
for (const t of n) {
|
|
1348
|
-
const s =
|
|
1358
|
+
const s = us(t.slot), r = s.name;
|
|
1349
1359
|
e[r] ? (e[r].nodes.push(t), e[r].params = e[r].params.concat(s.params), e[r].scope = s.scope || "") : e[r] = {
|
|
1350
1360
|
nodes: [t],
|
|
1351
1361
|
params: s.params,
|
|
@@ -1354,10 +1364,10 @@ function cs(n) {
|
|
|
1354
1364
|
}
|
|
1355
1365
|
return e;
|
|
1356
1366
|
}
|
|
1357
|
-
function
|
|
1367
|
+
function us(n = "default") {
|
|
1358
1368
|
return I(n) ? { name: n, params: [], scope: "" } : { params: [], scope: "", ...n };
|
|
1359
1369
|
}
|
|
1360
|
-
function
|
|
1370
|
+
function fs(n, e, t) {
|
|
1361
1371
|
const { value: s, iterator: r } = n, { item: i = "item", index: o = "index" } = r || {};
|
|
1362
1372
|
let a = t.__parseExpression(s) || [];
|
|
1363
1373
|
return Number.isInteger(a) && (a = new Array(a).fill(!0).map((u, c) => c + 1)), Array.isArray(a) ? a.map((u, c) => e(t.__clone({ [i]: u, [o]: c }), c)) : (console.warn("[vForRender]:", `${s?.value} is not a Arrary`), []);
|
|
@@ -1395,7 +1405,7 @@ const ie = Fe({
|
|
|
1395
1405
|
activated() {
|
|
1396
1406
|
this.meta.cache === !1 && (this.sid = Symbol());
|
|
1397
1407
|
}
|
|
1398
|
-
}),
|
|
1408
|
+
}), ps = Fe({
|
|
1399
1409
|
name: "VtjStartupContainer",
|
|
1400
1410
|
render() {
|
|
1401
1411
|
return le("div", "page not found!");
|
|
@@ -1433,12 +1443,12 @@ function Ue(n, e) {
|
|
|
1433
1443
|
e.can(s.id.toString()) && t.push(s);
|
|
1434
1444
|
return t;
|
|
1435
1445
|
}
|
|
1436
|
-
function
|
|
1446
|
+
function Bs(n) {
|
|
1437
1447
|
const {
|
|
1438
1448
|
menuPathPrefix: e = "",
|
|
1439
1449
|
pageRouteName: t = "page",
|
|
1440
1450
|
disableMenusFilter: s = !1
|
|
1441
|
-
} = n || {}, r = Ke(), i = Oe(), o =
|
|
1451
|
+
} = n || {}, r = Ke(), i = Oe(), o = It(), a = ue(!1), u = ue(!1), c = r.project, l = (d, m) => {
|
|
1442
1452
|
a.value = !d?.mask, u.value = m?.pure ?? !!d?.pure;
|
|
1443
1453
|
};
|
|
1444
1454
|
ut(() => {
|
|
@@ -1538,18 +1548,18 @@ function he(n) {
|
|
|
1538
1548
|
}
|
|
1539
1549
|
return u;
|
|
1540
1550
|
}
|
|
1541
|
-
function
|
|
1551
|
+
function ds(n = {}, e) {
|
|
1542
1552
|
const { css: t, store: s, enhance: r } = n, { window: i, app: o, library: a = {}, adapter: u, mode: c } = e, { Pinia: l } = a;
|
|
1543
|
-
o.config.globalProperties.$libs = a, ge(i, "global-css", t || ""), l && s &&
|
|
1553
|
+
o.config.globalProperties.$libs = a, ge(i, "global-css", t || ""), l && s && hs(s, o, l), gs(o, u, n), !u.access && n.access && ms(n.access, o, c, u), _s(o, n), r && vs(r, o, a);
|
|
1544
1554
|
}
|
|
1545
|
-
function
|
|
1555
|
+
function hs(n, e, t) {
|
|
1546
1556
|
const s = t.createPinia();
|
|
1547
1557
|
if (e.use(s), $(n) && n.value) {
|
|
1548
1558
|
const r = R(n, {}, !1, !1, !0), i = t.defineStore("$store", r(e) || {});
|
|
1549
1559
|
e.config.globalProperties.$store = i();
|
|
1550
1560
|
}
|
|
1551
1561
|
}
|
|
1552
|
-
function
|
|
1562
|
+
function ms(n, e, t, s) {
|
|
1553
1563
|
if ($(n) && n.value) {
|
|
1554
1564
|
const r = R(n, {}, !1, !1, !0), { alert: i, request: o } = s, a = new _e({
|
|
1555
1565
|
alert: i,
|
|
@@ -1559,7 +1569,7 @@ function hs(n, e, t, s) {
|
|
|
1559
1569
|
a.connect({ mode: t, router: u, request: o }), e.use(a);
|
|
1560
1570
|
}
|
|
1561
1571
|
}
|
|
1562
|
-
function
|
|
1572
|
+
function gs(n, e, t) {
|
|
1563
1573
|
if (!e.request) return;
|
|
1564
1574
|
const { axios: s, request: r, response: i } = t;
|
|
1565
1575
|
if (s && $(s) && s.value) {
|
|
@@ -1575,7 +1585,7 @@ function ms(n, e, t) {
|
|
|
1575
1585
|
a.__unRes && a.__unRes(), a.__unRes = e.request.useResponse((u) => o(u, n));
|
|
1576
1586
|
}
|
|
1577
1587
|
}
|
|
1578
|
-
function
|
|
1588
|
+
function _s(n, e) {
|
|
1579
1589
|
const { beforeEach: t, afterEach: s } = e, r = n.config.globalProperties.$router;
|
|
1580
1590
|
if (t && $(t) && t.value) {
|
|
1581
1591
|
const i = R(t, {}, !1, !1, !0);
|
|
@@ -1586,10 +1596,10 @@ function gs(n, e) {
|
|
|
1586
1596
|
r && r.afterEach((o, a, u) => i(o, a, u, n));
|
|
1587
1597
|
}
|
|
1588
1598
|
}
|
|
1589
|
-
function
|
|
1599
|
+
function vs(n, e, t = {}) {
|
|
1590
1600
|
$(n) && n.value && R(n, {}, !1, !1, !0)(e, t);
|
|
1591
1601
|
}
|
|
1592
|
-
function
|
|
1602
|
+
function ys(n, e, t) {
|
|
1593
1603
|
if (!n || !e || !t) return;
|
|
1594
1604
|
const { VueI18n: s } = e;
|
|
1595
1605
|
if (s) {
|
|
@@ -1609,8 +1619,8 @@ function vs(n, e, t) {
|
|
|
1609
1619
|
}
|
|
1610
1620
|
}
|
|
1611
1621
|
const Je = Symbol("Provider");
|
|
1612
|
-
var
|
|
1613
|
-
class
|
|
1622
|
+
var ws = /* @__PURE__ */ ((n) => (n.Production = "production", n.Development = "development", n))(ws || {});
|
|
1623
|
+
class Ss extends Xe {
|
|
1614
1624
|
/**
|
|
1615
1625
|
* 创建Provider实例
|
|
1616
1626
|
* @param options 配置选项
|
|
@@ -1698,7 +1708,7 @@ class ws extends Xe {
|
|
|
1698
1708
|
if (this.project = s ? await s() : await this.service.init(e), !this.project)
|
|
1699
1709
|
throw new Error("project is null");
|
|
1700
1710
|
const { apis: r = [], meta: i = [], env: o = [] } = this.project, a = window;
|
|
1701
|
-
a && (a.CKEDITOR_VERSION = void 0), this.initEnv(o), this.mode === y.Raw ? await this.loadDependencies(a) : await this.loadAssets(a), this.initMock(a), this.apis =
|
|
1711
|
+
a && (a.CKEDITOR_VERSION = void 0), this.initEnv(o), this.mode === y.Raw ? await this.loadDependencies(a) : await this.loadAssets(a), this.initMock(a), this.apis = Mt(r, i, this.adapter), He(a), Tt(r, a), e.platform !== "uniapp" && this.initRouter(), this.triggerReady();
|
|
1702
1712
|
}
|
|
1703
1713
|
initMock(e) {
|
|
1704
1714
|
const t = N(e);
|
|
@@ -1784,7 +1794,7 @@ class ws extends Xe {
|
|
|
1784
1794
|
}, f = this.getHomepage(), p = {
|
|
1785
1795
|
path: c,
|
|
1786
1796
|
name: J,
|
|
1787
|
-
component: f ? ie : r.startupComponent ||
|
|
1797
|
+
component: f ? ie : r.startupComponent || ps,
|
|
1788
1798
|
meta: u
|
|
1789
1799
|
};
|
|
1790
1800
|
if (e.hasRoute(H) && e.removeRoute(H), e.hasRoute(J) && e.removeRoute(J), s.enableStaticRoute) {
|
|
@@ -1985,10 +1995,10 @@ class ws extends Xe {
|
|
|
1985
1995
|
},
|
|
1986
1996
|
t
|
|
1987
1997
|
);
|
|
1988
|
-
|
|
1998
|
+
ds(e, s);
|
|
1989
1999
|
}
|
|
1990
2000
|
initI18n(e, t, s) {
|
|
1991
|
-
|
|
2001
|
+
ys(e, t, s);
|
|
1992
2002
|
}
|
|
1993
2003
|
initEnv(e = []) {
|
|
1994
2004
|
this.env = e.reduce(
|
|
@@ -1997,8 +2007,8 @@ class ws extends Xe {
|
|
|
1997
2007
|
);
|
|
1998
2008
|
}
|
|
1999
2009
|
}
|
|
2000
|
-
function
|
|
2001
|
-
const e = new
|
|
2010
|
+
function Ls(n) {
|
|
2011
|
+
const e = new Ss(n);
|
|
2002
2012
|
return {
|
|
2003
2013
|
provider: e,
|
|
2004
2014
|
onReady: (s) => e.ready(s)
|
|
@@ -2021,7 +2031,7 @@ function Ke(n = {}) {
|
|
|
2021
2031
|
}
|
|
2022
2032
|
return e;
|
|
2023
2033
|
}
|
|
2024
|
-
async function
|
|
2034
|
+
async function qs(n, e = "") {
|
|
2025
2035
|
const { name: t, urls: s = [] } = n || {}, r = s.map((a) => e + a), { css: i, js: o } = vt(r);
|
|
2026
2036
|
if (i.length && xe(i), o.length)
|
|
2027
2037
|
return await De(o, t).catch(
|
|
@@ -2035,7 +2045,7 @@ const ze = {
|
|
|
2035
2045
|
originResponse: !1,
|
|
2036
2046
|
failMessage: !0,
|
|
2037
2047
|
validate: (n) => n.data?.code === 0
|
|
2038
|
-
},
|
|
2048
|
+
}, $s = (n, e = "/__vtj__/api/:type.json") => (t, s, r) => n.send({
|
|
2039
2049
|
url: e,
|
|
2040
2050
|
method: "post",
|
|
2041
2051
|
params: { type: t },
|
|
@@ -2045,7 +2055,7 @@ const ze = {
|
|
|
2045
2055
|
data: s
|
|
2046
2056
|
},
|
|
2047
2057
|
settings: ze
|
|
2048
|
-
}),
|
|
2058
|
+
}), Es = (n, e = "/__vtj__/api/uploader.json") => async (t, s) => await n.send({
|
|
2049
2059
|
url: e,
|
|
2050
2060
|
method: "post",
|
|
2051
2061
|
data: {
|
|
@@ -2057,7 +2067,7 @@ const ze = {
|
|
|
2057
2067
|
type: "data"
|
|
2058
2068
|
}
|
|
2059
2069
|
}).then((r) => r && r[0] ? r[0] : null).catch(() => null);
|
|
2060
|
-
function
|
|
2070
|
+
function Us(n) {
|
|
2061
2071
|
return Pe({
|
|
2062
2072
|
settings: {
|
|
2063
2073
|
type: "json",
|
|
@@ -2073,7 +2083,7 @@ function qs(n) {
|
|
|
2073
2083
|
}
|
|
2074
2084
|
class ve {
|
|
2075
2085
|
constructor(e = ce) {
|
|
2076
|
-
this.req = e, this.api =
|
|
2086
|
+
this.req = e, this.api = $s(e), this.uploader = Es(e);
|
|
2077
2087
|
}
|
|
2078
2088
|
api;
|
|
2079
2089
|
pluginCaches = {};
|
|
@@ -2178,7 +2188,7 @@ const S = new lt({
|
|
|
2178
2188
|
expired: 0,
|
|
2179
2189
|
prefix: "__VTJ_"
|
|
2180
2190
|
});
|
|
2181
|
-
class
|
|
2191
|
+
class Js extends ve {
|
|
2182
2192
|
init(e) {
|
|
2183
2193
|
const t = new K(e), s = S.get(`project_${t.id}`), r = Object.assign(t.toDsl(), s || {});
|
|
2184
2194
|
return S.save(`project_${t.id}`, r), Promise.resolve(r);
|
|
@@ -2228,7 +2238,7 @@ class Us extends ve {
|
|
|
2228
2238
|
}), Promise.resolve(!0);
|
|
2229
2239
|
}
|
|
2230
2240
|
}
|
|
2231
|
-
class
|
|
2241
|
+
class bs extends ve {
|
|
2232
2242
|
projects = {};
|
|
2233
2243
|
materials = {};
|
|
2234
2244
|
files = {};
|
|
@@ -2286,10 +2296,10 @@ class Es extends ve {
|
|
|
2286
2296
|
}
|
|
2287
2297
|
}
|
|
2288
2298
|
let U = null;
|
|
2289
|
-
function
|
|
2290
|
-
return U || (U = new
|
|
2299
|
+
function Ks() {
|
|
2300
|
+
return U || (U = new bs(), U);
|
|
2291
2301
|
}
|
|
2292
|
-
class
|
|
2302
|
+
class zs extends ve {
|
|
2293
2303
|
getFileCaches = {};
|
|
2294
2304
|
async getExtension() {
|
|
2295
2305
|
return await this.api("getExtension", {}).catch(() => {
|
|
@@ -2347,49 +2357,49 @@ class Ks extends ve {
|
|
|
2347
2357
|
}
|
|
2348
2358
|
}
|
|
2349
2359
|
export {
|
|
2350
|
-
|
|
2360
|
+
Fs as ACCESS,
|
|
2351
2361
|
ke as ACCESS_KEY,
|
|
2352
2362
|
_e as Access,
|
|
2353
2363
|
dt as BUILD_IN_TAGS,
|
|
2354
2364
|
ft as BUILT_IN_DIRECTIVES,
|
|
2355
2365
|
ve as BaseService,
|
|
2356
2366
|
Re as CONTEXT_HOST,
|
|
2357
|
-
|
|
2367
|
+
kt as Context,
|
|
2358
2368
|
y as ContextMode,
|
|
2359
2369
|
pt as DATA_TYPES,
|
|
2360
2370
|
J as HOMEPAGE_ROUTE_NAME,
|
|
2361
2371
|
Me as HTML_TAGS,
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2372
|
+
Ds as JSCodeToString,
|
|
2373
|
+
As as LIFE_CYCLES_LIST,
|
|
2374
|
+
zs as LocalService,
|
|
2375
|
+
bs as MemoryService,
|
|
2376
|
+
ws as NodeEnv,
|
|
2367
2377
|
H as PAGE_ROUTE_NAME,
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2378
|
+
Ss as Provider,
|
|
2379
|
+
Is as REMOTE,
|
|
2380
|
+
Js as StorageService,
|
|
2371
2381
|
k as VTJ_RENDERER_VERSION,
|
|
2372
|
-
|
|
2382
|
+
Ts as adoptStylesToInline,
|
|
2373
2383
|
ge as adoptedStyleSheets,
|
|
2374
|
-
|
|
2384
|
+
Ns as clearLoaderCache,
|
|
2375
2385
|
yt as compileScopedCSS,
|
|
2376
2386
|
$t as convertCssRpx,
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2387
|
+
Hs as createAccess,
|
|
2388
|
+
ks as createAdapter,
|
|
2389
|
+
Os as createAssetScripts,
|
|
2390
|
+
Ms as createAssetsCss,
|
|
2391
|
+
Jt as createDataSources,
|
|
2382
2392
|
pe as createLoader,
|
|
2383
|
-
|
|
2393
|
+
Ks as createMemoryService,
|
|
2384
2394
|
V as createMenus,
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2395
|
+
Ot as createMetaApi,
|
|
2396
|
+
xt as createMock,
|
|
2397
|
+
Ls as createProvider,
|
|
2388
2398
|
fe as createRenderer,
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2399
|
+
Ft as createSchemaApi,
|
|
2400
|
+
Mt as createSchemaApis,
|
|
2401
|
+
Us as createServiceRequest,
|
|
2402
|
+
Vt as defaultLoader,
|
|
2393
2403
|
q as fillBasePath,
|
|
2394
2404
|
N as getMock,
|
|
2395
2405
|
qe as getModifiers,
|
|
@@ -2397,7 +2407,7 @@ export {
|
|
|
2397
2407
|
_t as getRawComponent,
|
|
2398
2408
|
jt as isBuiltInTag,
|
|
2399
2409
|
Q as isCSSUrl,
|
|
2400
|
-
|
|
2410
|
+
Pt as isJSCode,
|
|
2401
2411
|
E as isJSExpression,
|
|
2402
2412
|
$ as isJSFunction,
|
|
2403
2413
|
ht as isJSON,
|
|
@@ -2406,11 +2416,11 @@ export {
|
|
|
2406
2416
|
bt as isVuePlugin,
|
|
2407
2417
|
Et as loadCss,
|
|
2408
2418
|
xe as loadCssUrl,
|
|
2409
|
-
|
|
2419
|
+
qs as loadEnhance,
|
|
2410
2420
|
De as loadScriptUrl,
|
|
2411
2421
|
Ue as menusFilter,
|
|
2412
|
-
|
|
2413
|
-
|
|
2422
|
+
Dt as mockApi,
|
|
2423
|
+
Tt as mockApis,
|
|
2414
2424
|
He as mockCleanup,
|
|
2415
2425
|
x as nodeCache,
|
|
2416
2426
|
T as nodeRender,
|
|
@@ -2421,9 +2431,9 @@ export {
|
|
|
2421
2431
|
Je as providerKey,
|
|
2422
2432
|
mt as removeProdFlag,
|
|
2423
2433
|
St as rpxToPx,
|
|
2424
|
-
|
|
2434
|
+
xs as setupPageSetting,
|
|
2425
2435
|
Te as toString,
|
|
2426
|
-
|
|
2427
|
-
|
|
2436
|
+
It as useAccess,
|
|
2437
|
+
Bs as useMask,
|
|
2428
2438
|
Ke as useProvider
|
|
2429
2439
|
};
|
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.27",
|
|
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/core": "~0.16.
|
|
25
|
-
"@vtj/utils": "~0.16.
|
|
24
|
+
"@vtj/core": "~0.16.27",
|
|
25
|
+
"@vtj/utils": "~0.16.27"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"vue": "~3.5.5",
|
|
29
29
|
"vue-router": "~4.6.0",
|
|
30
30
|
"@vtj/cli": "~0.12.19",
|
|
31
|
-
"@vtj/icons": "~0.16.
|
|
32
|
-
"@vtj/ui": "~0.16.
|
|
31
|
+
"@vtj/icons": "~0.16.27",
|
|
32
|
+
"@vtj/ui": "~0.16.27"
|
|
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.26
|
|
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.26";
|