@vtj/renderer 0.12.26 → 0.12.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +5 -5
- package/dist/index.mjs +212 -187
- package/package.json +6 -6
- package/types/utils/compileScoped.d.ts +1 -0
- package/types/utils/util.d.ts +0 -1
- package/types/version.d.ts +2 -2
package/dist/index.cjs
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("@vtj/core"),u=require("@vtj/utils"),w=require("vue"),ce=require("vue-router");function Je(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const q=Je(w);/**!
|
2
2
|
* Copyright (c) 2025, VTJ.PRO All rights reserved.
|
3
3
|
* @name @vtj/renderer
|
4
4
|
* @author CHC chenhuachun1549@dingtalk.com
|
5
|
-
* @version 0.12.
|
5
|
+
* @version 0.12.28
|
6
6
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
7
|
-
*/const M="0.12.
|
8
|
-
`)+i;const a=`with(${t?"{}":"$scope || {}"}) { ${i} }`;return new Function("$scope",a)(e)}catch(n){if(l.logger.error("parseExpression.error",n,r,e?.__self??e),s)throw n}}function U(r,e,t=!1,s=!1){const n=I(r,e,t,s);if(typeof n!="function"&&(l.logger.error("parseFunction.error","not a function",r,e?.__self??e),s))throw new Error(`"${r.value}" not a function`);return n}function w(r){return r&&r.type==="JSExpression"}function F(r){return typeof r=="object"&&r&&r.type==="JSFunction"}function je(r){return w(r)||F(r)}function Ye(r){return je(r)?r.value:JSON.stringify(r)}const Qe={session:!1,authKey:"Authorization",storageKey:"ACCESS_STORAGE",storagePrefix:"__VTJ_",unauthorized:void 0,auth:"/#/login",redirectParam:"r",unauthorizedCode:401,unauthorizedMessage:"登录已经失效,请重新登录!",noPermissionMessage:"无权限访问该页面",appName:"",statusKey:"code"},Z=Symbol("access");class ee{options;data=null;mode=y.Raw;interceptResponse=!0;constructor(e){this.options=Object.assign({},Qe,e),this.loadData()}enableIntercept(){this.interceptResponse=!0}disableIntercept(){this.interceptResponse=!1}connect(e){const{mode:t,router:s,request:n}=e;this.mode=t,s&&this.mode===y.Raw&&this.setGuard(s),n&&this.setRequest(n)}login(e){const{storageKey:t,storagePrefix:s,session:n,authKey:i}=this.options;this.setData(e),this.data&&(l.storage.save(t,e,{type:"local",prefix:s}),n&&l.cookie.set(i,this.data.token))}clear(){const{storageKey:e,storagePrefix:t,session:s,authKey:n}=this.options;this.data=null,l.storage.remove(e,{type:"local",prefix:t}),s&&l.cookie.remove(n)}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):l.toArray(e).every(i=>s[i]||s[t+"."+i])}some(e){const{appName:t}=this.options,{permissions:s={}}=this.data||{};return l.toArray(e).some(i=>s[i]||s[t+"."+i])}install(e){e.config.globalProperties.$access=this,e.provide(Z,this)}isAuthPath(e){const{auth:t,isAuth:s}=this.options;if(s)return s(e);if(e.path&&typeof t=="string"){const n=t.split("#")[1]||t;return e.path===n}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(n=>l.unRSA(n,t));try{this.data=JSON.parse(s.join(""))}catch(n){console.warn(n)}return}if(typeof e=="string")try{const s=t?l.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=l.storage.get(e,{type:"local",prefix:t});this.setData(s||null)}isLogined(){const{session:e,authKey:t}=this.options;return e&&t?!!l.cookie.get(t):!!this.getToken()}hasRoutePermission(e){if(e.name===k){const t=e.params.id;return t&&this.can(t)}return!0}setGuard(e){e.beforeEach((t,s,n)=>this.guard(t,n))}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:n=!1}=this.options;return await this.showTip(s),l.isFunction(n)?(n(),t(!1)):l.isString(n)?t(n):t(!1)}}t(!1),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 t?(await l.delay(150),await t(e,{title:"提示",type:"warning"}).catch(()=>!1)):!1}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 $e(){return S.inject(Z,null)}function Xe(r={}){const{notify:e,loading:t,settings:s={},Startup:n,access:i,useTitle:a,alert:o}=r;let c=null;return{request:l.createRequest({settings:{type:"form",validSuccess:!0,originResponse:!1,loading:!0,validate:p=>p.data?.code===0||!!p.data?.success,failMessage:!0,showError:p=>{e&&e(p||"未知错误")},showLoading:()=>{c&&c.close(),t&&(c=t())},hideLoading:()=>{c&&(c.close(),c=null)},...s}}),jsonp:l.jsonp,notify:e,loading:t,useTitle:a,startupComponent:n,access:i?new ee({alert:o,...i}):void 0}}function Ze(r={}){return new ee(r)}function Pe(r,e){const{jsonp:t,request:s}=e;if(r.method==="jsonp")return(n={})=>t(r.url,{...r.jsonpOptions,query:n});{const n=r.headers?I(r.headers,{},!0):void 0,i={url:r.url,method:r.method,settings:{...r.settings,headers:n}};return(a,o)=>(delete i.data,s.send(l.merge(i,o||{},{data:a})))}}function Ce(r,e){const{metaQuery:t}=e;if(!t)return;const{code:s,queryCode:n}=r;return(i,a)=>{if(!t){console.warn("adapter.metaQuery is not defined!");return}return t(s,n,i,a)}}function Re(r=[],e=[],t){const s={};for(const n of r)s[n.id]=Pe(n,t);for(const n of e)s[n.id]=Ce(n,t);return s}async function be(r=[],e=window){const t=T(e);t&&(te(e),r.forEach(s=>Me(t,s)))}function Ae(r,e=window){const t=F(r.mockTemplate)&&r.mockTemplate.value?U(r.mockTemplate,{},!0):void 0,s=T(e);return async(...n)=>{let i={};if(t)try{i=await t.apply(t,n)}catch(a){l.logger.warn("模拟数据模版异常",a)}return s?.mock(i)}}function Me(r,e){if(!e.mock)return;const{url:t,mockTemplate:s}=e;if(t&&s){const n=l.pathToRegexp(`${t}(.*)`),i=l.pathToRegexpMatch(t,{decode:decodeURIComponent}),a=I(s,{},!0);r.mock(n,o=>{const c=l.url.parse(o.url)||{},u=o.body instanceof FormData?l.formDataToJson(o.body):o.body,p=i(o.url)?.params;return Object.assign(o,{data:u,params:c,query:p}),r.mock(a(o))})}}function te(r=window){const e=T(r);e&&(e._mocked={})}class ke{__id=null;__mode;__instance=null;__contextRefs={};__refs={};context={};state={};props={};$props={};$refs={};$el=null;$emit=null;$nextTick=null;$parent=null;$root=null;$attrs=null;$slots=null;$watch=null;$options=null;$forceUpdate=null;$components={};$libs={};$apis={};__transform={};constructor(e){const{mode:t,dsl:s,attrs:n}=e;this.__mode=t,s&&(this.__id=s.id||null,this.__transform=s.transform||{}),n&&Object.assign(this,n)}setup(e,t=q){const s=t.getCurrentInstance();if(!s)return;this.__refs={},this.$refs={},this.context={},this.__contextRefs={},this.__instance=s.proxy;const n=s.appContext.config.globalProperties;Object.assign(this,n),Object.assign(this,e||{}),this.__proxy(),t.onMounted(()=>{this.__proxy()}),t.onUnmounted(()=>{this.__cleanup()}),t.onBeforeUpdate(()=>{this.__reset()})}__proxy(){this.__instance&&z.forEach(e=>{this[e]=this.__instance?.[e]})}__cleanup(){z.forEach(e=>{this[e]=null}),this.__reset()}__reset(){this.__refs={},this.$refs={},this.__contextRefs={},this.context={}}__parseFunction(e){if(e)if(this.__mode===y.Runtime){const{id:t,type:s}=e,n=t?this.__transform[t]??e.value:e.value;return U({type:s,value:n},this)}else return U(e,this)}__parseExpression(e){if(e)if(this.__mode===y.Runtime){const{id:t,type:s}=e,n=t?this.__transform[t]??e.value:e.value;return I({type:s,value:n},this)}else return I(e,this)}__ref(e=null,t){if(this.__mode!==y.VNode)return e&&e!==this.__id&&(this.__contextRefs[e]=this),async s=>{await l.delay(0);let n=s?.$vtjEl||s?.$el||s?._?.vnode?.el||s;if(!n){typeof t=="string"&&(delete this.$refs[t],e&&delete this.__refs[e]);return}return n.nodeType===3&&n.nextSibling&&(n=n.nextSibling),n.__vtj__=e,y.Design===this.__mode&&(n.__context__=this,n.draggable=!0),e&&(this.__refs[e]=this.__getRefEl(this.__refs,e,s)),typeof t=="function"?t(s):t&&(this.$refs[t]=this.__getRefEl(this.$refs,t,s)),s}}__getRefEl(e,t,s){const n=e[t];if(n&&s!==n){const i=new Set([].concat(n,s));return Array.from(i)}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 B(r){const{Vue:e=q,mode:t=y.Runtime,components:s={},libs:n={},apis:i={},loader:a}=r,o=e.computed(()=>r.dsl),c={$components:s,$libs:n,$apis:i},u=new ke({mode:t,dsl:o.value,attrs:c}),p=e.defineComponent({name:o.value.name,__scopeId:o.value.id?`data-v-${o.value.id}`:void 0,props:{...tt(o.value.props??[],u)},setup(d){u.$props=d,u.props=d,o.value.id&&Y(r.window||window,o.value.id,o.value.css||"",!0),u.state=st(e,o.value.state??{},u);const g=rt(e,o.value.computed??{},u),h=nt(o.value.methods??{},u),f=it(e,o.value.inject,u);for(const[v,C]of Object.entries(f||{}))f[v]=e.inject(v,C);const m=Te(o.value.dataSources||{},u),E={...f,...g,...h,...m};return u.setup(E,e),ot(e,o.value.watch??[],u),{vtj:u}},emits:et(o.value.emits),expose:["vtj"],render(){if(!o.value.nodes)return null;const d=o.value.nodes||[];return d.length===1?A(d[0],u,e,a,d):d.map(g=>A(g,u,e,a,d))},...at(o.value.lifeCycles??{},u)});return{renderer:e.markRaw(p),context:u}}function et(r=[]){return r.map(e=>l.isString(e)?e:e.name)}function tt(r=[],e){const t=s=>s?(Array.isArray(s)?s:[s]).map(i=>ue[i]):void 0;return r.map(s=>l.isString(s)?{name:s}:{name:s.name,type:s.type,required:s.required,default:w(s.default)?e.__parseExpression(s.default):s.default}).reduce((s,n)=>(s[n.name]={type:t(n.type),required:n.required,default:n.default},s),{})}function st(r,e,t){return r.reactive(Object.keys(e||{}).reduce((s,n)=>{let i=e[n];return w(i)?i=t.__parseExpression(i):F(i)&&(i=t.__parseFunction(i)),s[n]=i,s},{}))}function rt(r,e,t){return Object.entries(e??{}).reduce((s,[n,i])=>(s[n]=r.computed(t.__parseFunction(i)),s),{})}function nt(r,e){return Object.entries(r??{}).reduce((t,[s,n])=>(t[s]=e.__parseFunction(n),t),{})}function it(r,e=[],t){return e.reduce((s,n)=>{const{name:i,from:a}=n||{};n.default;const o=w(a)?t.__parseExpression(a)||i:a??i,c=w(n.default)?t.__parseExpression(n.default):n.default??null;return s[i]=r.inject(o,c),s},{})}function Te(r,e){return Object.keys(r).reduce((t,s)=>{const n=r[s];if(n.type==="mock")t[s]=Ae(n);else if(n.ref){const i=e.$apis[n.ref],a=F(n.transform)?n.transform.value?e.__parseFunction(n.transform):void 0:n.transform;t[s]=async(...o)=>{const c=await i.apply(e,o);return a?a(c):c}}return t},{})}function ot(r,e=[],t){e.forEach(s=>{r.watch(t.__parseExpression(s.source),t.__parseFunction(s.handler),{deep:s.deep,immediate:s.immediate})})}function at(r,e){return Object.entries(r??{}).reduce((t,[s,n])=>(t[s]=e.__parseFunction(n),t),{})}let V=[],b={};const Ie=r=>r;async function se(r,e=window){const{urls:t=[],library:s}=r,n=t.filter(o=>x(o));if(n.length===0||!s)return null;const i=t.filter(o=>H(o));return i.length&&Q(i,e),await X(n,s,e).catch(o=>(console.warn("loadScriptUrl error",n,s,o),null))}function L(r){const{getDsl:e,getDslByUrl:t,options:s}=r;return s.window&&(V.forEach(n=>{delete s.window[n]}),V=[]),(n,i,a=q)=>{if(!i||typeof i=="string")return n;if(i.type==="Schema"&&i.id)return a.defineAsyncComponent(async()=>{const o=b[i.id]||await e(i.id);return o&&(o.name=n,b[i.id]=o),o?B({...s,Vue:a,dsl:l.cloneDeep(o),mode:y.Runtime,loader:L(r)}).renderer:null});if(i.type==="UrlSchema"&&i.url)return a.defineAsyncComponent(async()=>{const o=b[i.url]||await t(i.url);return o&&(o.name=n,b[i.url]=o),o?B({...s,Vue:a,dsl:l.cloneDeep(o),mode:y.Runtime,loader:L(r)}).renderer:null});if(i.type==="Plugin"){let o=i.library?b[i.library]:null;return o||(i.library&&V.push(i.library),o=b[i.library||Symbol()]=a.defineAsyncComponent(async()=>{const c=await se(i,s.window);return c||(console.warn("getPlugin result is null",i),null)}),o)}return n}}function ct(){b={}}function A(r,e,t=q,s=Ie,n=[],i=!1){if(!r||!r.name||r.invisible)return null;const a=t.getCurrentInstance()?.appContext,{id:o=null,directives:c=[]}=r,{vIf:u,vElseIf:p,vElse:d,vFor:g,vShow:h,vModels:f,vBind:m,vHtml:E,others:v}=Fe(c);if(!i&&(p||d))return null;if(u&&!ut(u,e))return ht(r,e,t,s,n);const C=j=>{const Be=j.$components,Le=(()=>{if(r.name==="component")return pt(j,r.props?.is);if(r.name==="slot")return r.name;const $=s(r.name,r.from,t);return l.isString($)?we($)||Ee($)?$:Be[$]??a?.app?.component($)??$:$})(),R=dt(o,r.props??{},j),qe=ft(t,r.events??{},j);if(r.name==="slot")return mt(t,r,R,j,s);m&&Object.assign(R,j.__parseExpression(m.value)),h&&(R.style=Object.assign(R.style??{},vt(h,j))),E&&Object.assign(R,yt(E,j)),f.forEach($=>{Object.assign(R,_t(t,$,j))});const Je=St(t,r.children??[],j,s,r);let K=t.createVNode(Le,{...R,...qe},Je);const oe=a?lt(a,v,j):[];return oe.length&&(K=t.withDirectives(K,oe)),K};return g?jt(g,C,e):C(e)}function lt(r,e,t){const s=r.app;return e.map(n=>{const i=typeof n.name=="string"?s.directive(n.name):t.__parseExpression(n.name);if(!i)return null;const a=[i];return n.value&&a.push(t.__parseExpression(n.value)),n.arg&&a.push(n.arg),n.modifiers&&a.push(n.modifiers),a}).filter(n=>!!n)}function Fe(r=[]){const e=r.find(p=>l.camelCase(p.name)==="vIf"),t=r.find(p=>l.camelCase(p.name)==="vElseIf"),s=r.find(p=>l.camelCase(p.name)==="vElse"),n=r.find(p=>l.camelCase(p.name)==="vFor"),i=r.find(p=>l.camelCase(p.name)==="vShow"),a=r.find(p=>l.camelCase(p.name)==="vBind"),o=r.find(p=>l.camelCase(p.name)==="vHtml"),c=r.filter(p=>l.camelCase(p.name)==="vModel"),u=r.filter(p=>!le.includes(l.camelCase(p.name)));return{vIf:e,vElseIf:t,vElse:s,vFor:n,vShow:i,vModels:c,vBind:a,others:u,vHtml:o}}function ut(r,e){return!!e.__parseExpression(r.value)}function pt(r,e){return e?w(e)?r.__parseExpression(e):e:"div"}function dt(r,e,t){const s=G(e,t);return s.ref=t.__ref(r,s.ref),s}function G(r,e){return w(r)?e.__parseExpression(r):F(r)?e.__parseFunction(r):Array.isArray(r)?r.map(t=>G(t,e)):typeof r=="object"?Object.keys(r||{}).reduce((t,s)=>{let n=r[s];return t[s]=G(n,e),t},{}):r}function ft(r,e,t){const s=["passive","capture","once"],n={capture:"Capture",once:"Once",passive:"OnceCapture"};return Object.keys(e||{}).reduce((i,a)=>{const o=e[a],c=re(o.modifiers),u=c.find(g=>s.includes(g)),p="on"+l.upperFirst(a)+(u&&n[u]||""),d=t.__parseFunction(o.handler);return d&&(i[p]=r.withModifiers(d,c)),i},{})}function ht(r,e,t,s,n=[]){let i=n.findIndex(a=>a.id===r.id);for(let a=++i;a<n.length;a++){const{directives:o=[]}=n[a],{vElseIf:c,vElse:u}=Fe(o);if(c){if(e.__parseExpression(c.value))return A(n[a],e,t,s,n,!0);continue}if(u)return A(n[a],e,t,s,n,!0)}return null}function re(r={},e=!1){const t=Object.keys(r);return e?t.map(s=>"."+s):t}function mt(r,e,t,s,n){const{children:i}=e,a=gt(e,s),o=s.$slots?.[a.name];return o?o(t):i?l.isString(i)?r.createTextVNode(i):w(i)?r.createTextVNode(W(s.__parseExpression(i))):Array.isArray(i)?i.map(c=>A(c,s,r,n,i)):null:null}function gt(r,e){const{props:t}=r,s=t?.name||"default";return{name:w(s)?e.__parseExpression(s):s,params:[]}}function vt(r,e){return e.__parseExpression(r.value)?{}:{display:"none"}}function yt(r,e){return{innerHTML:e.__parseExpression(r.value)||""}}function _t(r,e,t){const s={type:"JSFunction",value:e.value?.value?`(v) => {
|
7
|
+
*/const M="0.12.28";var y=(r=>(r.Runtime="Runtime",r.Design="Design",r.Raw="Raw",r.VNode="VNode",r))(y||{});const z=["$el","$emit","$nextTick","$parent","$root","$attrs","$slots","$watch","$props","$options","$forceUpdate"],Ke=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeUnmount","unmounted","errorCaptured","renderTracked","renderTriggered","activated","deactivated"],le=["vIf","vElseIf","vElse","vShow","vModel","vFor","vBind","vHtml"],ue={String,Number,Boolean,Array,Object,Function,Date},T="VtjPage",D="VtjHomepage",pe="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".split(","),de="component,slot".split(",");function O(r,e){return r.map(t=>u.isUrl(t)||t.startsWith("/")?t:`${e}${t}`)}function H(r){return/\.css$/.test(r)}function x(r){return/\.js$/.test(r)}function fe(r){return/\.json$/.test(r)}function Ve(r){return r.map(e=>`<script src="${u.url.append(e,{v:M})}"><\/script>`).join("")}function ze(r=[]){return r.map(e=>`<link rel="stylesheet" href="${u.url.append(e,{v:M})}" />`).join("")}function he(r,e=!1){return e&&r.endsWith(".prod.js")?r.replace(".prod.js",".js"):r}function me(r,e,t=!1){const s=r.filter(m=>!!m.enabled),n=[],i=[],a=[],o=[],c={},l={},p=[],d={};return s.forEach(({urls:m,assetsUrl:h,library:f,assetsLibrary:g,localeLibrary:_})=>{m?.forEach(v=>{x(v)&&n.push(he(v,t)),H(v)&&i.push(v)}),f&&(o.push(f),c[f]=O(m||[],e),_&&(l[f]=_)),h&&a.push(h),g&&p.push(g),f&&g&&(d[g]=f)}),{scripts:O(n,e),css:O(i,e),materials:O(a,e),libraryExports:o,materialExports:u.dedupArray(p),materialMapLibrary:d,libraryMap:c,libraryLocaleMap:l}}function ge(r,e){const{name:t,parent:s,alias:n}=r;return s?e[s]?.[n||t]:e[n||t]}function ve(r=[]){const e=r.filter(s=>H(s)),t=r.filter(s=>x(s));return{css:e,js:t}}function Ge(r,e){const t=/(@(keyframes|media)\s*([^{]*)){([\s\S]*?}\s*})/g,s=[];let o=r.replace(t,(c,l,p,d,m)=>(s.push({type:p,name:d.trim(),conditions:d,content:m}),"/* AT_RULE_PLACEHOLDER */")).replace(/::v-deep\(/g,":deep(").replace(/(\s*)>>>(\s*)/g,"$1:deep($2)").replace(/([\w-.:\s[\]>+~]+?):deep\(([^)]+)\)/g,(c,l,p)=>`${l.replace(/(\s*)$/,`[${e}]$1`)} ${p}`).replace(/([^{}]+)(?=\s*{)/g,c=>c.split(",").map(l=>{const p=l.trim();return p.includes(`[${e}]`)?p:p.replace(/(.*?)((?::[^:\s(]+(?:\([^)]*\))?)*)(\s*)$/,(d,m,h,f)=>`${m}[${e}]${h}${f}`)}).join(", "));return s.forEach(({type:c,conditions:l,content:p})=>{let d=p;c==="media"&&(d=d.replace(/([^{}]+)(?=\s*{)/g,m=>m.split(",").map(h=>{const f=h.trim();return f.includes(`[${e}]`)?f:f.replace(/(.*?)((?::[^:\s(]+(?:\([^)]*\))?)*)(\s*)$/,(g,_,v,P)=>`${_}[${e}]${v}${P}`)}).join(", "))),o=o.replace("/* AT_RULE_PLACEHOLDER */",`@${c} ${l}{${d}}`)}),o}function W(r){return u.isString(r)?r:JSON.stringify(r)}function Y(r,e,t,s=!1){const n=r.CSSStyleSheet,i=s?`data-v-${e}`:e,a=s?Ge(t,i):t;if(n.prototype.replaceSync){const o=new n;o.id=e,o.replaceSync(a);const c=r.document,l=c.adoptedStyleSheets,p=Array.from(l).filter(d=>d.id!==e);c.adoptedStyleSheets=[...p,o]}else{const o=r.document;let c=o.getElementById(e);c?c.innerHTML=a:(c=o.createElement("style"),c.id=e,c.innerHTML=a,o.head.appendChild(c))}}async function ye(r,e){const t=await window.fetch(e).then(s=>s.text()).catch(()=>"");t&&Y(window,r,t)}function Q(r,e=window){const t=e.document,s=e.document.head;for(const n of r)if(!t.getElementById(n)){const a=t.createElement("link");a.rel="stylesheet",a.id=n,a.href=n,s.appendChild(a)}}async function X(r,e,t=window){const s=t.document,n=t.document.head;let i=t[e];return i?i.default||i:new Promise((a,o)=>{for(const c of r){const l=s.createElement("script");l.src=c,l.onload=()=>{i=t[e],i?a(i.default||i):o(null)},l.onerror=p=>{o(p)},n.appendChild(l)}})}function _e(r){return u.isFunction(r)||u.isFunction(r?.install)}function Se(r){return de.includes(r)}function we(r){return pe.includes(r)}function k(r=window){const e=window?.Mock;if(e)return e;const t=r?.Mock;if(t&&window)return window.Mock=t,t}function We(r,e,t){Object.assign(e.meta,t.meta);const s=r?._container;t?.type==="page"&&s.classList.add("is-page"),t?.pure&&s.classList.add("is-pure")}function F(r,e,t=!1,s=!1){try{const n=['"use strict";',"var __self = arguments[0];"];n.push("return ");let i=(r.value||"").trim();i=i.replace(/this(\W|$)/g,(o,c)=>`__self${c}`),i=n.join(`
|
8
|
+
`)+i;const a=`with(${t?"{}":"$scope || {}"}) { ${i} }`;return new Function("$scope",a)(e)}catch(n){if(u.logger.error("parseExpression.error",n,r,e?.__self??e),s)throw n}}function U(r,e,t=!1,s=!1){const n=F(r,e,t,s);if(typeof n!="function"&&(u.logger.error("parseFunction.error","not a function",r,e?.__self??e),s))throw new Error(`"${r.value}" not a function`);return n}function E(r){return r&&r.type==="JSExpression"}function I(r){return typeof r=="object"&&r&&r.type==="JSFunction"}function Ee(r){return E(r)||I(r)}function Ye(r){return Ee(r)?r.value:JSON.stringify(r)}const Qe={session:!1,authKey:"Authorization",storageKey:"ACCESS_STORAGE",storagePrefix:"__VTJ_",unauthorized:void 0,auth:"/#/login",redirectParam:"r",unauthorizedCode:401,unauthorizedMessage:"登录已经失效,请重新登录!",noPermissionMessage:"无权限访问该页面",appName:"",statusKey:"code"},Z=Symbol("access");class ee{options;data=null;mode=y.Raw;interceptResponse=!0;constructor(e){this.options=Object.assign({},Qe,e),this.loadData()}enableIntercept(){this.interceptResponse=!0}disableIntercept(){this.interceptResponse=!1}connect(e){const{mode:t,router:s,request:n}=e;this.mode=t,s&&this.mode===y.Raw&&this.setGuard(s),n&&this.setRequest(n)}login(e){const{storageKey:t,storagePrefix:s,session:n,authKey:i}=this.options;this.setData(e),this.data&&(u.storage.save(t,e,{type:"local",prefix:s}),n&&u.cookie.set(i,this.data.token))}clear(){const{storageKey:e,storagePrefix:t,session:s,authKey:n}=this.options;this.data=null,u.storage.remove(e,{type:"local",prefix:t}),s&&u.cookie.remove(n)}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):u.toArray(e).every(i=>s[i]||s[t+"."+i])}some(e){const{appName:t}=this.options,{permissions:s={}}=this.data||{};return u.toArray(e).some(i=>s[i]||s[t+"."+i])}install(e){e.config.globalProperties.$access=this,e.provide(Z,this)}isAuthPath(e){const{auth:t,isAuth:s}=this.options;if(s)return s(e);if(e.path&&typeof t=="string"){const n=t.split("#")[1]||t;return e.path===n}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(n=>u.unRSA(n,t));try{this.data=JSON.parse(s.join(""))}catch(n){console.warn(n)}return}if(typeof e=="string")try{const s=t?u.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=u.storage.get(e,{type:"local",prefix:t});this.setData(s||null)}isLogined(){const{session:e,authKey:t}=this.options;return e&&t?!!u.cookie.get(t):!!this.getToken()}hasRoutePermission(e){if(e.name===T){const t=e.params.id;return t&&this.can(t)}return!0}setGuard(e){e.beforeEach((t,s,n)=>this.guard(t,n))}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:n=!1}=this.options;return await this.showTip(s),u.isFunction(n)?(n(),t(!1)):u.isString(n)?t(n):t(!1)}}t(!1),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 t?(await u.delay(150),await t(e,{title:"提示",type:"warning"}).catch(()=>!1)):!1}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 $e(){return w.inject(Z,null)}function Xe(r={}){const{notify:e,loading:t,settings:s={},Startup:n,access:i,useTitle:a,alert:o}=r;let c=null;return{request:u.createRequest({settings:{type:"form",validSuccess:!0,originResponse:!1,loading:!0,validate:p=>p.data?.code===0||!!p.data?.success,failMessage:!0,showError:p=>{e&&e(p||"未知错误")},showLoading:()=>{c&&c.close(),t&&(c=t())},hideLoading:()=>{c&&(c.close(),c=null)},...s}}),jsonp:u.jsonp,notify:e,loading:t,useTitle:a,startupComponent:n,access:i?new ee({alert:o,...i}):void 0}}function Ze(r={}){return new ee(r)}function je(r,e){const{jsonp:t,request:s}=e;if(r.method==="jsonp")return(n={})=>t(r.url,{...r.jsonpOptions,query:n});{const n=r.headers?F(r.headers,{},!0):void 0,i={url:r.url,method:r.method,settings:{...r.settings,headers:n}};return(a,o)=>(delete i.data,s.send(u.merge(i,o||{},{data:a})))}}function Pe(r,e){const{metaQuery:t}=e;if(!t)return;const{code:s,queryCode:n}=r;return(i,a)=>{if(!t){console.warn("adapter.metaQuery is not defined!");return}return t(s,n,i,a)}}function Re(r=[],e=[],t){const s={};for(const n of r)s[n.id]=je(n,t);for(const n of e)s[n.id]=Pe(n,t);return s}async function Ce(r=[],e=window){const t=k(e);t&&(te(e),r.forEach(s=>Ae(t,s)))}function be(r,e=window){const t=I(r.mockTemplate)&&r.mockTemplate.value?U(r.mockTemplate,{},!0):void 0,s=k(e);return async(...n)=>{let i={};if(t)try{i=await t.apply(t,n)}catch(a){u.logger.warn("模拟数据模版异常",a)}return s?.mock(i)}}function Ae(r,e){if(!e.mock)return;const{url:t,mockTemplate:s}=e;if(t&&s){const n=u.pathToRegexp(`${t}(.*)`),i=u.pathToRegexpMatch(t,{decode:decodeURIComponent}),a=F(s,{},!0);r.mock(n,o=>{const c=u.url.parse(o.url)||{},l=o.body instanceof FormData?u.formDataToJson(o.body):o.body,p=i(o.url)?.params;return Object.assign(o,{data:l,params:c,query:p}),r.mock(a(o))})}}function te(r=window){const e=k(r);e&&(e._mocked={})}class Me{__id=null;__mode;__instance=null;__contextRefs={};__refs={};context={};state={};props={};$props={};$refs={};$el=null;$emit=null;$nextTick=null;$parent=null;$root=null;$attrs=null;$slots=null;$watch=null;$options=null;$forceUpdate=null;$components={};$libs={};$apis={};__transform={};constructor(e){const{mode:t,dsl:s,attrs:n}=e;this.__mode=t,s&&(this.__id=s.id||null,this.__transform=s.transform||{}),n&&Object.assign(this,n)}setup(e,t=q){const s=t.getCurrentInstance();if(!s)return;this.__refs={},this.$refs={},this.context={},this.__contextRefs={},this.__instance=s.proxy;const n=s.appContext.config.globalProperties;Object.assign(this,n),Object.assign(this,e||{}),this.__proxy(),t.onMounted(()=>{this.__proxy()}),t.onUnmounted(()=>{this.__cleanup()}),t.onBeforeUpdate(()=>{this.__reset()})}__proxy(){this.__instance&&z.forEach(e=>{this[e]=this.__instance?.[e]})}__cleanup(){z.forEach(e=>{this[e]=null}),this.__reset()}__reset(){this.__refs={},this.$refs={},this.__contextRefs={},this.context={}}__parseFunction(e){if(e)if(this.__mode===y.Runtime){const{id:t,type:s}=e,n=t?this.__transform[t]??e.value:e.value;return U({type:s,value:n},this)}else return U(e,this)}__parseExpression(e){if(e)if(this.__mode===y.Runtime){const{id:t,type:s}=e,n=t?this.__transform[t]??e.value:e.value;return F({type:s,value:n},this)}else return F(e,this)}__ref(e=null,t){if(this.__mode!==y.VNode)return e&&e!==this.__id&&(this.__contextRefs[e]=this),async s=>{await u.delay(0);let n=s?.$vtjEl||s?.$el||s?._?.vnode?.el||s;if(!n){typeof t=="string"&&(delete this.$refs[t],e&&delete this.__refs[e]);return}return n.nodeType===3&&n.nextSibling&&(n=n.nextSibling),n.__vtj__=e,y.Design===this.__mode&&(n.__context__=this,n.draggable=!0),e&&(this.__refs[e]=this.__getRefEl(this.__refs,e,s)),typeof t=="function"?t(s):t&&(this.$refs[t]=this.__getRefEl(this.$refs,t,s)),s}}__getRefEl(e,t,s){const n=e[t];if(n&&s!==n){const i=new Set([].concat(n,s));return Array.from(i)}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 L(r){const{Vue:e=q,mode:t=y.Runtime,components:s={},libs:n={},apis:i={},loader:a}=r,o=e.computed(()=>r.dsl),c={$components:s,$libs:n,$apis:i},l=new Me({mode:t,dsl:o.value,attrs:c}),p=e.defineComponent({name:o.value.name,__scopeId:o.value.id?`data-v-${o.value.id}`:void 0,props:{...tt(o.value.props??[],l)},setup(d){l.$props=d,l.props=d,o.value.id&&Y(r.window||window,o.value.id,o.value.css||"",!0),l.state=st(e,o.value.state??{},l);const m=rt(e,o.value.computed??{},l),h=nt(o.value.methods??{},l),f=it(e,o.value.inject,l);for(const[v,P]of Object.entries(f||{}))f[v]=e.inject(v,P);const g=Te(o.value.dataSources||{},l),_={...f,...m,...h,...g};return l.setup(_,e),ot(e,o.value.watch??[],l),{vtj:l}},emits:et(o.value.emits),expose:["vtj"],render(){if(!o.value.nodes)return null;const d=o.value.nodes||[];return d.length===1?A(d[0],l,e,a,d):d.map(m=>A(m,l,e,a,d))},...at(o.value.lifeCycles??{},l)});return{renderer:e.markRaw(p),context:l}}function et(r=[]){return r.map(e=>u.isString(e)?e:e.name)}function tt(r=[],e){const t=s=>s?(Array.isArray(s)?s:[s]).map(i=>ue[i]):void 0;return r.map(s=>u.isString(s)?{name:s}:{name:s.name,type:s.type,required:s.required,default:E(s.default)?e.__parseExpression(s.default):s.default}).reduce((s,n)=>(s[n.name]={type:t(n.type),required:n.required,default:n.default},s),{})}function st(r,e,t){return r.reactive(Object.keys(e||{}).reduce((s,n)=>{let i=e[n];return E(i)?i=t.__parseExpression(i):I(i)&&(i=t.__parseFunction(i)),s[n]=i,s},{}))}function rt(r,e,t){return Object.entries(e??{}).reduce((s,[n,i])=>(s[n]=r.computed(t.__parseFunction(i)),s),{})}function nt(r,e){return Object.entries(r??{}).reduce((t,[s,n])=>(t[s]=e.__parseFunction(n),t),{})}function it(r,e=[],t){return e.reduce((s,n)=>{const{name:i,from:a}=n||{};n.default;const o=E(a)?t.__parseExpression(a)||i:a??i,c=E(n.default)?t.__parseExpression(n.default):n.default??null;return s[i]=r.inject(o,c),s},{})}function Te(r,e){return Object.keys(r).reduce((t,s)=>{const n=r[s];if(n.type==="mock")t[s]=be(n);else if(n.ref){const i=e.$apis[n.ref],a=I(n.transform)?n.transform.value?e.__parseFunction(n.transform):void 0:n.transform;t[s]=async(...o)=>{const c=await i.apply(e,o);return a?a(c):c}}return t},{})}function ot(r,e=[],t){e.forEach(s=>{r.watch(t.__parseExpression(s.source),t.__parseFunction(s.handler),{deep:s.deep,immediate:s.immediate})})}function at(r,e){return Object.entries(r??{}).reduce((t,[s,n])=>(t[s]=e.__parseFunction(n),t),{})}let V=[],b={};const ke=r=>r;async function se(r,e=window){const{urls:t=[],library:s}=r,n=t.filter(o=>x(o));if(n.length===0||!s)return null;const i=t.filter(o=>H(o));return i.length&&Q(i,e),await X(n,s,e).catch(o=>(console.warn("loadScriptUrl error",n,s,o),null))}function B(r){const{getDsl:e,getDslByUrl:t,options:s}=r;return s.window&&(V.forEach(n=>{delete s.window[n]}),V=[]),(n,i,a=q)=>{if(!i||typeof i=="string")return n;if(i.type==="Schema"&&i.id)return a.defineAsyncComponent(async()=>{const o=b[i.id]||await e(i.id);return o&&(o.name=n,b[i.id]=o),o?L({...s,Vue:a,dsl:u.cloneDeep(o),mode:y.Runtime,loader:B(r)}).renderer:null});if(i.type==="UrlSchema"&&i.url)return a.defineAsyncComponent(async()=>{const o=b[i.url]||await t(i.url);return o&&(o.name=n,b[i.url]=o),o?L({...s,Vue:a,dsl:u.cloneDeep(o),mode:y.Runtime,loader:B(r)}).renderer:null});if(i.type==="Plugin"){let o=i.library?b[i.library]:null;return o||(i.library&&V.push(i.library),o=b[i.library||Symbol()]=a.defineAsyncComponent(async()=>{const c=await se(i,s.window);return c||(console.warn("getPlugin result is null",i),null)}),o)}return n}}function ct(){b={}}function A(r,e,t=q,s=ke,n=[],i=!1){if(!r||!r.name||r.invisible)return null;const a=t.getCurrentInstance()?.appContext,{id:o=null,directives:c=[]}=r,{vIf:l,vElseIf:p,vElse:d,vFor:m,vShow:h,vModels:f,vBind:g,vHtml:_,others:v}=Fe(c);if(!i&&(p||d))return null;if(l&&!ut(l,e))return ht(r,e,t,s,n);const P=$=>{const Ue=$.$components,Le=(()=>{if(r.name==="component")return pt($,r.props?.is);if(r.name==="slot")return r.name;const j=s(r.name,r.from,t);return u.isString(j)?Se(j)||we(j)?j:Ue[j]??a?.app?.component(j)??j:j})(),C=dt(o,r.props??{},$),Be=ft(t,r.events??{},$);if(r.name==="slot")return mt(t,r,C,$,s);g&&Object.assign(C,$.__parseExpression(g.value)),h&&(C.style=Object.assign(C.style??{},vt(h,$))),_&&Object.assign(C,yt(_,$)),f.forEach(j=>{Object.assign(C,_t(t,j,$))});const qe=St(t,r.children??[],$,s,r);let K=t.createVNode(Le,{...C,...Be},qe);const oe=a?lt(a,v,$):[];return oe.length&&(K=t.withDirectives(K,oe)),K};return m?$t(m,P,e):P(e)}function lt(r,e,t){const s=r.app;return e.map(n=>{const i=typeof n.name=="string"?s.directive(n.name):t.__parseExpression(n.name);if(!i)return null;const a=[i];return n.value&&a.push(t.__parseExpression(n.value)),n.arg&&a.push(n.arg),n.modifiers&&a.push(n.modifiers),a}).filter(n=>!!n)}function Fe(r=[]){const e=r.find(p=>u.camelCase(p.name)==="vIf"),t=r.find(p=>u.camelCase(p.name)==="vElseIf"),s=r.find(p=>u.camelCase(p.name)==="vElse"),n=r.find(p=>u.camelCase(p.name)==="vFor"),i=r.find(p=>u.camelCase(p.name)==="vShow"),a=r.find(p=>u.camelCase(p.name)==="vBind"),o=r.find(p=>u.camelCase(p.name)==="vHtml"),c=r.filter(p=>u.camelCase(p.name)==="vModel"),l=r.filter(p=>!le.includes(u.camelCase(p.name)));return{vIf:e,vElseIf:t,vElse:s,vFor:n,vShow:i,vModels:c,vBind:a,others:l,vHtml:o}}function ut(r,e){return!!e.__parseExpression(r.value)}function pt(r,e){return e?E(e)?r.__parseExpression(e):e:"div"}function dt(r,e,t){const s=G(e,t);return s.ref=t.__ref(r,s.ref),s}function G(r,e){return E(r)?e.__parseExpression(r):I(r)?e.__parseFunction(r):Array.isArray(r)?r.map(t=>G(t,e)):typeof r=="object"?Object.keys(r||{}).reduce((t,s)=>{let n=r[s];return t[s]=G(n,e),t},{}):r}function ft(r,e,t){const s=["passive","capture","once"],n={capture:"Capture",once:"Once",passive:"OnceCapture"};return Object.keys(e||{}).reduce((i,a)=>{const o=e[a],c=re(o.modifiers),l=c.find(m=>s.includes(m)),p="on"+u.upperFirst(a)+(l&&n[l]||""),d=t.__parseFunction(o.handler);return d&&(i[p]=r.withModifiers(d,c)),i},{})}function ht(r,e,t,s,n=[]){let i=n.findIndex(a=>a.id===r.id);for(let a=++i;a<n.length;a++){const{directives:o=[]}=n[a],{vElseIf:c,vElse:l}=Fe(o);if(c){if(e.__parseExpression(c.value))return A(n[a],e,t,s,n,!0);continue}if(l)return A(n[a],e,t,s,n,!0)}return null}function re(r={},e=!1){const t=Object.keys(r);return e?t.map(s=>"."+s):t}function mt(r,e,t,s,n){const{children:i}=e,a=gt(e,s),o=s.$slots?.[a.name];return o?o(t):i?u.isString(i)?r.createTextVNode(i):E(i)?r.createTextVNode(W(s.__parseExpression(i))):Array.isArray(i)?i.map(c=>A(c,s,r,n,i)):null:null}function gt(r,e){const{props:t}=r,s=t?.name||"default";return{name:E(s)?e.__parseExpression(s):s,params:[]}}function vt(r,e){return e.__parseExpression(r.value)?{}:{display:"none"}}function yt(r,e){return{innerHTML:e.__parseExpression(r.value)||""}}function _t(r,e,t){const s={type:"JSFunction",value:e.value?.value?`(v) => {
|
9
9
|
${e.value.value} = v;
|
10
|
-
}`:"(v) => {}"},n=t.__parseFunction(s),i=re(w(e.modifiers)?t.__parseExpression(e.modifiers):e.modifiers),a=w(e.arg)?t.__parseExpression(e.arg):e.arg||"modelValue";return{[a]:t.__parseExpression(e.value),[`onUpdate:${a}`]:i.length&&n?r.withModifiers(n,i):n}}function St(r,e,t,s,n){if(!e)return null;if(l.isString(e))return{default:()=>e};if(w(e))return{default:()=>W(t.__parseExpression(e))};if(Array.isArray(e)&&e.length>0){const i=wt(e),a=o=>!o||!n?{}:n?.id&&Object.keys(o).length?{[`scope_${n.id}`]:o}:{};return Object.entries(i).reduce((o,[c,{nodes:u,params:p}])=>(o[c]=d=>{const g=p.length?l.pick(d??{},p):a(d);return u.map(h=>A(h,t.__clone(g),r,s,u))},o),{})}return null}function wt(r){const e={default:{params:[],nodes:[]}};for(const t of r){const s=Et(t.slot),n=s.name;e[n]?(e[n].nodes.push(t),e[n].params=e[n].params.concat(s.params)):e[n]={nodes:[t],params:s.params}}return e}function Et(r="default"){return l.isString(r)?{name:r,params:[]}:{params:[],...r}}function jt(r,e,t){const{value:s,iterator:n}=r,{item:i="item",index:a="index"}=n||{};let o=t.__parseExpression(s)||[];return Number.isInteger(o)&&(o=new Array(o).fill(!0).map((c,u)=>u+1)),Array.isArray(o)?o.map((c,u)=>e(t.__clone({[i]:c,[a]:u}))):(console.warn("[vForRender]:",`${s?.value} is not a Arrary`),[])}const ae=S.defineComponent({name:"VtjPageContainer",async setup(){const r=ie(),e=ce.useRoute(),t=e.params.id,s=t?r.getPage(t):r.getHomepage(),n=s?await r.getRenderComponent(s.id):null,i=S.ref(Symbol());if(s){Object.assign(e.meta,s.meta||{},{cache:s.cache});const{useTitle:a}=r?.adapter;a&&a(s.title||"VTJ")}return{provider:r,component:n,file:s,query:e.query,meta:e.meta,sid:i,route:e}},render(){const{component:r,query:e,sid:t}=this;return r?S.h(r,{...e,key:t}):S.h("div","页面不存在")},activated(){this.meta.cache===!1&&(this.sid=Symbol())}}),$t=S.defineComponent({name:"VtjStartupContainer",render(){return S.h("div","page not found!")}}),ne=Symbol("Provider");var Oe=(r=>(r.Production="production",r.Development="development",r))(Oe||{});class De extends P.Base{constructor(e){super(),this.options=e;const{service:t,mode:s=y.Raw,dependencies:n,materials:i,project:a={},adapter:o={},globals:c={},modules:u={},router:p=null,materialPath:d="./",nodeEnv:g="development"}=e;this.mode=s,this.modules=u,this.service=t,this.router=p,this.materialPath=d,this.nodeEnv=g,n&&(this.dependencies=n),i&&(this.materials=i),Object.assign(this.globals,c),Object.assign(this.adapter,o);const{access:h,request:f}=this.adapter;h&&h.connect({mode:s,router:p,request:f}),a&&s!==y.Design?this.load(a):this.project=a}mode;globals={};modules={};adapter={request:l.request,jsonp:l.jsonp};apis={};dependencies={};materials={};library={};service;project=null;components={};nodeEnv="development";router=null;materialPath="./";urlDslCaches={};createMock(e){return async(...t)=>{let s={};if(e)try{s=await e.apply(e,t)}catch(i){l.logger.warn("模拟数据模版异常",i)}return T()?.mock(s)}}async load(e){const t=this.modules[`.vtj/projects/${e.id}.json`]||this.modules[`/src/.vtj/projects/${e.id}.json`];if(this.project=t?await t():await this.service.init(e),!this.project)throw new Error("project is null");const{apis:s=[],meta:n=[]}=this.project,i=window;i&&(i.CKEDITOR_VERSION=void 0),this.mode===y.Raw?await this.loadDependencies(i):await this.loadAssets(i),this.initMock(i),this.apis=Re(s,n,this.adapter),te(i),be(s,i),e.platform!=="uniapp"&&this.initRouter(),this.triggerReady()}initMock(e){const t=T(e);t&&t.setup({timeout:"50-500"})}async loadDependencies(e){const t=Object.entries(this.dependencies);for(const[s,n]of t)e[s]||(e[s]=this.library[s]=await n())}async loadAssets(e){const{dependencies:t=[]}=this.project,{dependencies:s,library:n,components:i,materialPath:a,nodeEnv:o}=this,{libraryExports:c,libraryMap:u,materials:p,materialExports:d,materialMapLibrary:g}=me(t,a,o==="development");for(const h of c){const f=s[h],m=e[h];if(m)n[h]=m;else if(f)e[h]=n[h]=await f();else{const E=u[h]||[];for(const v of E)H(v)&&await _e(h,l.url.append(v,{v:M})),x(v)&&await l.loadScript(l.url.append(v,{v:M}));n[h]=e[h]}}if(o==="development"){for(const f of p)await l.loadScript(l.url.append(f,{v:M}));const h=this.materials||{};for(const f of d){const m=e[g[f]],E=P.BUILT_IN_COMPONENTS[f];if(E)m&&E.forEach(v=>{i[v]=m[v]});else{const v=h[f]?(await h[f]()).default:e[f];v&&m&&(v.components||[]).forEach(C=>{i[C.name]=ge(C,m)})}}}}initRouter(){const{router:e,project:t,options:s,adapter:n}=this;if(!e)return;const i=t?.platform==="uniapp"?"pages":"page",{routeAppendTo:a,pageRouteName:o=i,routeMeta:c}=s,u=a?"":"/",p={path:`${u}${o}/:id`,name:k,component:ae},d={path:u,name:D,component:t?.homepage?ae:n.startupComponent||$t,meta:c};e.hasRoute(k)&&e.removeRoute(k),e.hasRoute(D)&&e.removeRoute(D),a?(e.addRoute(a,p),e.addRoute(a,d)):(e.addRoute(p),e.addRoute(d))}install(e){const t=e.config.globalProperties.installed||{};for(const[s,n]of Object.entries(this.library))!t[s]&&Se(n)&&(e.use(n),t[s]=!0);this.options.install&&e.use(this.options.install),this.adapter.access&&e.use(this.adapter.access),e.provide(ne,this),e.config.globalProperties.$provider=this,e.config.globalProperties.installed=t,this.mode===y.Design&&(e.config.errorHandler=(s,n,i)=>{const a=n?.$options.name,o=typeof s=="string"?s:s?.message||s?.msg||"未知错误",c=`[ ${a} ] ${o} ${i}`;console.error("[VTJ Error]:",{err:s,instance:n,info:i},s?.stack),this.adapter.notify&&this.adapter.notify(c,"组件渲染错误","error")}),this.options.enhance&&e.use(this.options.enhance,this)}getFile(e){const{blocks:t=[]}=this.project||{};return this.getPage(e)||t.find(s=>s.id===e)||null}getPage(e){const{pages:t=[]}=this.project||{},s=(n,i=[])=>{for(const a of i){if(a.id===n)return a;if(a.children&&a.children.length){const o=s(n,a.children);if(o)return o}}};return s(e,t)||null}getHomepage(){const{homepage:e}=this.project||{};return e?this.getPage(e):null}async getDsl(e){const t=this.modules[`.vtj/files/${e}.json`]||this.modules[`/src/.vtj/files/${e}.json`];return t?await t():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:n,mode:i,apis:a}=this,o={mode:i,Vue:s.Vue,components:n,libs:s,apis:a,window,...t},c=L({getDsl:async u=>await this.getDsl(u)||null,getDslByUrl:async u=>await this.getDslByUrl(u)||null,options:o});return B({...o,dsl:e,loader:c})}async getRenderComponent(e,t){const s=this.getFile(e);if(!s)return l.logger.warn(`Can not find file: ${e}`),null;t&&t(s);const n=`.vtj/vue/${e}.vue`,i=this.modules[n]||this.modules[`/src/pages/${e}.vue`];if(i)return(await i())?.default;const a=await this.getDsl(s.id);return a?this.createDslRenderer(a).renderer:(l.logger.warn(`Can not find dsl: ${e}`),null)}defineUrlSchemaComponent(e,t){return S.defineAsyncComponent(async()=>{const s=await this.getDslByUrl(e);return s?(s.name=t||s.name,this.createDslRenderer(s).renderer):null})}definePluginComponent(e){return S.defineAsyncComponent(async()=>await se(e,window))}}function Pt(r){const e=new De(r);return{provider:e,onReady:s=>e.ready(s)}}function ie(r={}){const e=S.inject(ne,null);if(!e)throw new Error("Can not find provider");if(e.nodeEnv==="development"){const{id:t,version:s}=r;t&&s&&(async()=>{const n=await e.getDsl(t);n?.__VERSION__!==s&&e.adapter.notify&&e.adapter.notify(`[ ${n?.name} ] 组件源码版本与运行时版本不一致,请重新发布组件`,"版本不一致","warning")})()}return e}async function Ct(r,e=""){const{name:t,urls:s=[]}=r||{},n=s.map(o=>e+o),{css:i,js:a}=ve(n);if(i.length&&Q(i),a.length)return await X(a,t).catch(()=>{})}const He={type:"json",validSuccess:!0,originResponse:!1,failMessage:!0,validate:r=>r.data?.code===0},Rt=(r,e="/__vtj__/api/:type.json")=>(t,s,n)=>r.send({url:e,method:"post",params:{type:t},query:n,data:{type:t,data:s},settings:He}),bt=(r,e="/__vtj__/api/uploader.json")=>async(t,s)=>await r.send({url:e,method:"post",data:{files:t,projectId:s},settings:{...He,type:"data"}}).then(n=>n&&n[0]?n[0]:null).catch(()=>null);function At(r){return l.createRequest({settings:{type:"json",validSuccess:!0,originResponse:!1,failMessage:!0,validate:e=>e.data?.code===0,showError:e=>{r&&r(e||"未知错误")}}})}class J{constructor(e=l.request){this.req=e,this.api=Rt(e),this.uploader=bt(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(i=>fe(i))[0];if(!s)return null;const n=this.pluginCaches[s];return n||(this.pluginCaches[s]=l.request.send({url:s,method:"get",settings:{validSuccess:!1,originResponse:!0}}).then(i=>i.data).catch(()=>null))}async genSource(e){return console.log("BaseService.genSource",e),""}}const _=new l.Storage({type:"local",expired:0,prefix:"__VTJ_"});class Mt extends J{init(e){const t=new P.ProjectModel(e),s=_.get(`project_${t.id}`),n=Object.assign(t.toDsl(),s||{});return _.save(`project_${t.id}`,n),Promise.resolve(n)}saveProject(e){const t=new P.ProjectModel(e);return _.save(`project_${t.id}`,t.toDsl()),Promise.resolve(!0)}saveMaterials(e,t){return _.save(`materials_${e.id}`,l.mapToObject(t)),Promise.resolve(!0)}saveFile(e){return _.save(`file_${e.id}`,e),Promise.resolve(!0)}getFile(e){const t=_.get(`file_${e}`);return t?Promise.resolve(t):Promise.reject(null)}removeFile(e){return _.remove(`file_${e}`),Promise.resolve(!0)}saveHistory(e){return _.save(`history_${e.id}`,e),Promise.resolve(!0)}removeHistory(e){const t=_.get(`history_${e}`);if(t){const n=(t.items||[]).map(i=>i.id);this.removeHistoryItem(e,n),_.remove(`history_${e}`)}return Promise.resolve(!0)}getHistory(e){const t=_.get(`history_${e}`),s=new P.HistoryModel(t||{id:e});return Promise.resolve(s.toDsl())}getHistoryItem(e,t){const s=_.get(`history_${e}_${t}`);return Promise.resolve(s)}saveHistoryItem(e,t){return _.save(`history_${e}_${t.id}`,t),Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(s=>{_.remove(`history_${e}_${s}`)}),Promise.resolve(!0)}}class xe extends J{projects={};materials={};files={};histories={};historyItems={};init(e){const t=new P.ProjectModel(e),s=this.projects[t.id]||{},n=Object.assign(t.toDsl(),s);return this.projects[n.id]=n,Promise.resolve(n)}saveProject(e){const t=new P.ProjectModel(e);return this.projects[t.id]=t.toDsl(),Promise.resolve(!0)}saveMaterials(e,t){return e.id&&(this.materials[e.id]=l.mapToObject(t)),Promise.resolve(!0)}saveFile(e){return this.files[e.id]=e,Promise.resolve(!0)}getFile(e){const t=this.files[e];return t?Promise.resolve(t):Promise.reject(null)}removeFile(e){return delete this.files[e],Promise.resolve(!0)}saveHistory(e){return this.histories[e.id]=e,Promise.resolve(!0)}removeHistory(e){const t=this.histories[e];if(t){const n=(t.items||[]).map(i=>i.id);this.removeHistoryItem(e,n),delete this.historyItems[e]}return Promise.resolve(!0)}getHistory(e){const t=this.histories[e],s=new P.HistoryModel(t||{id:e});return Promise.resolve(s)}getHistoryItem(e,t){const s=`${e}_${t}`,n=this.historyItems[s]||{};return Promise.resolve(n)}saveHistoryItem(e,t){const s=`${e}_${t.id}`;return this.historyItems[s]=t,Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(s=>{const n=`${e}_${s}`;delete this.historyItems[n]}),Promise.resolve(!0)}}let N=null;function kt(){return N||(N=new xe,N)}class Tt extends J{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:l.mapToObject(t)}).catch(()=>!1)}async saveFile(e){return!!await this.api("saveFile",e).catch(()=>!1)}async getFile(e){const t=this.getFileCaches[e];return t||(this.getFileCaches[e]=this.api("getFile",e).catch(()=>null)).finally(()=>{delete this.getFileCaches[e]})}async removeFile(e){return!!await this.api("removeFile",e).catch(()=>!1)}async saveHistory(e){return!!await this.api("saveHistory",e).catch(()=>!1)}async removeHistory(e){return!!await this.api("removeHistory",e).catch(()=>!1)}async getHistory(e){return await this.api("getHistory",e).catch(()=>null)||{}}async getHistoryItem(e,t){return await this.api("getHistoryItem",{fId:e,id:t}).catch(()=>null)||{}}async saveHistoryItem(e,t){return!!await this.api("saveHistoryItem",{fId:e,item:t}).catch(()=>!1)}async removeHistoryItem(e,t){return!!await this.api("removeHistoryItem",{fId:e,ids:t}).catch(()=>!1)}}function Ne(r,e,t=[]){return t.map(s=>{const{id:n,title:i,icon:a,children:o,hidden:c}=s;return{id:n,title:i,icon:a,hidden:c,url:`${r}/${e}/${n}`,children:o&&o.length?Ne(r,e,o):void 0}})}function Ue(r,e){if(!e)return r;let t=[];for(const s of r)if(s.children&&s.children.length){const n=Ue(s.children,e);n.length&&(s.children=n,t.push(s))}else e.can(s.id.toString())&&t.push(s);return t}function It(r){const{menuPathPrefix:e="",pageRouteName:t="page",disableMenusFilter:s=!1}=r||{},n=ie(),i=ce.useRoute(),a=$e(),o=S.ref(!1),c=S.ref(!1),u=n.project;S.watchEffect(()=>{const{name:g,params:h,meta:f}=i;if(g===k){const m=n.getPage(h.id);o.value=!m?.mask,c.value=!!m?.pure}else if(g===D){const m=n.getHomepage();o.value=!m?.mask,c.value=!!m?.pure}else o.value=!f.mask,c.value=!!f.pure});const p=Ne(e,t,u?.pages),d=u?.config;return{disabled:o,logo:d?.logo,themeSwitchable:d?.themeSwitchable,title:d?.title||u?.description||u?.name||"VTJ App",menus:s?p:Ue(p,a),pure:c}}exports.ACCESS_KEY=Z;exports.Access=ee;exports.BUILD_IN_TAGS=de;exports.BUILT_IN_DIRECTIVES=le;exports.BaseService=J;exports.CONTEXT_HOST=z;exports.Context=ke;exports.ContextMode=y;exports.DATA_TYPES=ue;exports.HOMEPAGE_ROUTE_NAME=D;exports.HTML_TAGS=pe;exports.JSCodeToString=Ye;exports.LIFE_CYCLES_LIST=Ve;exports.LocalService=Tt;exports.MemoryService=xe;exports.NodeEnv=Oe;exports.PAGE_ROUTE_NAME=k;exports.Provider=De;exports.StorageService=Mt;exports.VTJ_RENDERER_VERSION=M;exports.adoptedStyleSheets=Y;exports.clearLoaderCache=ct;exports.compileScopedCSS=ye;exports.createAccess=Ze;exports.createAdapter=Xe;exports.createAssetScripts=ze;exports.createAssetsCss=Ge;exports.createDataSources=Te;exports.createLoader=L;exports.createMemoryService=kt;exports.createMetaApi=Ce;exports.createMock=Ae;exports.createProvider=Pt;exports.createRenderer=B;exports.createSchemaApi=Pe;exports.createSchemaApis=Re;exports.createServiceRequest=At;exports.defaultLoader=Ie;exports.fillBasePath=O;exports.getMock=T;exports.getModifiers=re;exports.getPlugin=se;exports.getRawComponent=ge;exports.isBuiltInTag=we;exports.isCSSUrl=H;exports.isJSCode=je;exports.isJSExpression=w;exports.isJSFunction=F;exports.isJSON=fe;exports.isJSUrl=x;exports.isNativeTag=Ee;exports.isVuePlugin=Se;exports.loadCss=_e;exports.loadCssUrl=Q;exports.loadEnhance=Ct;exports.loadScriptUrl=X;exports.mockApi=Me;exports.mockApis=be;exports.mockCleanup=te;exports.nodeRender=A;exports.parseDeps=me;exports.parseExpression=I;exports.parseFunction=U;exports.parseUrls=ve;exports.providerKey=ne;exports.removeProdFlag=he;exports.setupPageSetting=We;exports.toString=W;exports.useAccess=$e;exports.useMask=It;exports.useProvider=ie;
|
10
|
+
}`:"(v) => {}"},n=t.__parseFunction(s),i=re(E(e.modifiers)?t.__parseExpression(e.modifiers):e.modifiers),a=E(e.arg)?t.__parseExpression(e.arg):e.arg||"modelValue";return{[a]:t.__parseExpression(e.value),[`onUpdate:${a}`]:i.length&&n?r.withModifiers(n,i):n}}function St(r,e,t,s,n){if(!e)return null;if(u.isString(e))return{default:()=>e};if(E(e))return{default:()=>W(t.__parseExpression(e))};if(Array.isArray(e)&&e.length>0){const i=wt(e),a=o=>!o||!n?{}:n?.id&&Object.keys(o).length?{[`scope_${n.id}`]:o}:{};return Object.entries(i).reduce((o,[c,{nodes:l,params:p}])=>(o[c]=d=>{const m=p.length?u.pick(d??{},p):a(d);return l.map(h=>A(h,t.__clone(m),r,s,l))},o),{})}return null}function wt(r){const e={default:{params:[],nodes:[]}};for(const t of r){const s=Et(t.slot),n=s.name;e[n]?(e[n].nodes.push(t),e[n].params=e[n].params.concat(s.params)):e[n]={nodes:[t],params:s.params}}return e}function Et(r="default"){return u.isString(r)?{name:r,params:[]}:{params:[],...r}}function $t(r,e,t){const{value:s,iterator:n}=r,{item:i="item",index:a="index"}=n||{};let o=t.__parseExpression(s)||[];return Number.isInteger(o)&&(o=new Array(o).fill(!0).map((c,l)=>l+1)),Array.isArray(o)?o.map((c,l)=>e(t.__clone({[i]:c,[a]:l}))):(console.warn("[vForRender]:",`${s?.value} is not a Arrary`),[])}const ae=w.defineComponent({name:"VtjPageContainer",async setup(){const r=ie(),e=ce.useRoute(),t=e.params.id,s=t?r.getPage(t):r.getHomepage(),n=s?await r.getRenderComponent(s.id):null,i=w.ref(Symbol());if(s){Object.assign(e.meta,s.meta||{},{cache:s.cache});const{useTitle:a}=r?.adapter;a&&a(s.title||"VTJ")}return{provider:r,component:n,file:s,query:e.query,meta:e.meta,sid:i,route:e}},render(){const{component:r,query:e,sid:t}=this;return r?w.h(r,{...e,key:t}):w.h("div","页面不存在")},activated(){this.meta.cache===!1&&(this.sid=Symbol())}}),jt=w.defineComponent({name:"VtjStartupContainer",render(){return w.h("div","page not found!")}}),ne=Symbol("Provider");var Ie=(r=>(r.Production="production",r.Development="development",r))(Ie||{});class Oe extends R.Base{constructor(e){super(),this.options=e;const{service:t,mode:s=y.Raw,dependencies:n,materials:i,project:a={},adapter:o={},globals:c={},modules:l={},router:p=null,materialPath:d="./",nodeEnv:m="development"}=e;this.mode=s,this.modules=l,this.service=t,this.router=p,this.materialPath=d,this.nodeEnv=m,n&&(this.dependencies=n),i&&(this.materials=i),Object.assign(this.globals,c),Object.assign(this.adapter,o);const{access:h,request:f}=this.adapter;h&&h.connect({mode:s,router:p,request:f}),a&&s!==y.Design?this.load(a):this.project=a}mode;globals={};modules={};adapter={request:u.request,jsonp:u.jsonp};apis={};dependencies={};materials={};library={};service;project=null;components={};nodeEnv="development";router=null;materialPath="./";urlDslCaches={};createMock(e){return async(...t)=>{let s={};if(e)try{s=await e.apply(e,t)}catch(i){u.logger.warn("模拟数据模版异常",i)}return k()?.mock(s)}}async load(e){const t=this.modules[`.vtj/projects/${e.id}.json`]||this.modules[`/src/.vtj/projects/${e.id}.json`];if(this.project=t?await t():await this.service.init(e),!this.project)throw new Error("project is null");const{apis:s=[],meta:n=[]}=this.project,i=window;i&&(i.CKEDITOR_VERSION=void 0),this.mode===y.Raw?await this.loadDependencies(i):await this.loadAssets(i),this.initMock(i),this.apis=Re(s,n,this.adapter),te(i),Ce(s,i),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,n]of t)e[s]||(e[s]=this.library[s]=await n())}async loadAssets(e){const{dependencies:t=[]}=this.project,{dependencies:s,library:n,components:i,materialPath:a,nodeEnv:o}=this,{libraryExports:c,libraryMap:l,materials:p,materialExports:d,materialMapLibrary:m}=me(t,a,o==="development");for(const h of c){const f=s[h],g=e[h];if(g)n[h]=g;else if(f)e[h]=n[h]=await f();else{const _=l[h]||[];for(const v of _)H(v)&&await ye(h,u.url.append(v,{v:M})),x(v)&&await u.loadScript(u.url.append(v,{v:M}));n[h]=e[h]}}if(o==="development"){for(const f of p)await u.loadScript(u.url.append(f,{v:M}));const h=this.materials||{};for(const f of d){const g=e[m[f]],_=R.BUILT_IN_COMPONENTS[f];if(_)g&&_.forEach(v=>{i[v]=g[v]});else{const v=h[f]?(await h[f]()).default:e[f];v&&g&&(v.components||[]).forEach(P=>{i[P.name]=ge(P,g)})}}}}initRouter(){const{router:e,project:t,options:s,adapter:n}=this;if(!e)return;const i=t?.platform==="uniapp"?"pages":"page",{routeAppendTo:a,pageRouteName:o=i,routeMeta:c}=s,l=a?"":"/",p={path:`${l}${o}/:id`,name:T,component:ae},d={path:l,name:D,component:t?.homepage?ae:n.startupComponent||jt,meta:c};e.hasRoute(T)&&e.removeRoute(T),e.hasRoute(D)&&e.removeRoute(D),a?(e.addRoute(a,p),e.addRoute(a,d)):(e.addRoute(p),e.addRoute(d))}install(e){const t=e.config.globalProperties.installed||{};for(const[s,n]of Object.entries(this.library))!t[s]&&_e(n)&&(e.use(n),t[s]=!0);this.options.install&&e.use(this.options.install),this.adapter.access&&e.use(this.adapter.access),e.provide(ne,this),e.config.globalProperties.$provider=this,e.config.globalProperties.installed=t,this.mode===y.Design&&(e.config.errorHandler=(s,n,i)=>{const a=n?.$options.name,o=typeof s=="string"?s:s?.message||s?.msg||"未知错误",c=`[ ${a} ] ${o} ${i}`;console.error("[VTJ Error]:",{err:s,instance:n,info:i},s?.stack),this.adapter.notify&&this.adapter.notify(c,"组件渲染错误","error")}),this.options.enhance&&e.use(this.options.enhance,this)}getFile(e){const{blocks:t=[]}=this.project||{};return this.getPage(e)||t.find(s=>s.id===e)||null}getPage(e){const{pages:t=[]}=this.project||{},s=(n,i=[])=>{for(const a of i){if(a.id===n)return a;if(a.children&&a.children.length){const o=s(n,a.children);if(o)return o}}};return s(e,t)||null}getHomepage(){const{homepage:e}=this.project||{};return e?this.getPage(e):null}async getDsl(e){const t=this.modules[`.vtj/files/${e}.json`]||this.modules[`/src/.vtj/files/${e}.json`];return t?await t():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:n,mode:i,apis:a}=this,o={mode:i,Vue:s.Vue,components:n,libs:s,apis:a,window,...t},c=B({getDsl:async l=>await this.getDsl(l)||null,getDslByUrl:async l=>await this.getDslByUrl(l)||null,options:o});return L({...o,dsl:e,loader:c})}async getRenderComponent(e,t){const s=this.getFile(e);if(!s)return u.logger.warn(`Can not find file: ${e}`),null;t&&t(s);const n=`.vtj/vue/${e}.vue`,i=this.modules[n]||this.modules[`/src/pages/${e}.vue`];if(i)return(await i())?.default;const a=await this.getDsl(s.id);return a?this.createDslRenderer(a).renderer:(u.logger.warn(`Can not find dsl: ${e}`),null)}defineUrlSchemaComponent(e,t){return w.defineAsyncComponent(async()=>{const s=await this.getDslByUrl(e);return s?(s.name=t||s.name,this.createDslRenderer(s).renderer):null})}definePluginComponent(e){return w.defineAsyncComponent(async()=>await se(e,window))}}function Pt(r){const e=new Oe(r);return{provider:e,onReady:s=>e.ready(s)}}function ie(r={}){const e=w.inject(ne,null);if(!e)throw new Error("Can not find provider");if(e.nodeEnv==="development"){const{id:t,version:s}=r;t&&s&&(async()=>{const n=await e.getDsl(t);n?.__VERSION__!==s&&e.adapter.notify&&e.adapter.notify(`[ ${n?.name} ] 组件源码版本与运行时版本不一致,请重新发布组件`,"版本不一致","warning")})()}return e}async function Rt(r,e=""){const{name:t,urls:s=[]}=r||{},n=s.map(o=>e+o),{css:i,js:a}=ve(n);if(i.length&&Q(i),a.length)return await X(a,t).catch(()=>{})}const De={type:"json",validSuccess:!0,originResponse:!1,failMessage:!0,validate:r=>r.data?.code===0},Ct=(r,e="/__vtj__/api/:type.json")=>(t,s,n)=>r.send({url:e,method:"post",params:{type:t},query:n,data:{type:t,data:s},settings:De}),bt=(r,e="/__vtj__/api/uploader.json")=>async(t,s)=>await r.send({url:e,method:"post",data:{files:t,projectId:s},settings:{...De,type:"data"}}).then(n=>n&&n[0]?n[0]:null).catch(()=>null);function At(r){return u.createRequest({settings:{type:"json",validSuccess:!0,originResponse:!1,failMessage:!0,validate:e=>e.data?.code===0,showError:e=>{r&&r(e||"未知错误")}}})}class J{constructor(e=u.request){this.req=e,this.api=Ct(e),this.uploader=bt(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(i=>fe(i))[0];if(!s)return null;const n=this.pluginCaches[s];return n||(this.pluginCaches[s]=u.request.send({url:s,method:"get",settings:{validSuccess:!1,originResponse:!0}}).then(i=>i.data).catch(()=>null))}async genSource(e){return console.log("BaseService.genSource",e),""}}const S=new u.Storage({type:"local",expired:0,prefix:"__VTJ_"});class Mt extends J{init(e){const t=new R.ProjectModel(e),s=S.get(`project_${t.id}`),n=Object.assign(t.toDsl(),s||{});return S.save(`project_${t.id}`,n),Promise.resolve(n)}saveProject(e){const t=new R.ProjectModel(e);return S.save(`project_${t.id}`,t.toDsl()),Promise.resolve(!0)}saveMaterials(e,t){return S.save(`materials_${e.id}`,u.mapToObject(t)),Promise.resolve(!0)}saveFile(e){return S.save(`file_${e.id}`,e),Promise.resolve(!0)}getFile(e){const t=S.get(`file_${e}`);return t?Promise.resolve(t):Promise.reject(null)}removeFile(e){return S.remove(`file_${e}`),Promise.resolve(!0)}saveHistory(e){return S.save(`history_${e.id}`,e),Promise.resolve(!0)}removeHistory(e){const t=S.get(`history_${e}`);if(t){const n=(t.items||[]).map(i=>i.id);this.removeHistoryItem(e,n),S.remove(`history_${e}`)}return Promise.resolve(!0)}getHistory(e){const t=S.get(`history_${e}`),s=new R.HistoryModel(t||{id:e});return Promise.resolve(s.toDsl())}getHistoryItem(e,t){const s=S.get(`history_${e}_${t}`);return Promise.resolve(s)}saveHistoryItem(e,t){return S.save(`history_${e}_${t.id}`,t),Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(s=>{S.remove(`history_${e}_${s}`)}),Promise.resolve(!0)}}class He extends J{projects={};materials={};files={};histories={};historyItems={};init(e){const t=new R.ProjectModel(e),s=this.projects[t.id]||{},n=Object.assign(t.toDsl(),s);return this.projects[n.id]=n,Promise.resolve(n)}saveProject(e){const t=new R.ProjectModel(e);return this.projects[t.id]=t.toDsl(),Promise.resolve(!0)}saveMaterials(e,t){return e.id&&(this.materials[e.id]=u.mapToObject(t)),Promise.resolve(!0)}saveFile(e){return this.files[e.id]=e,Promise.resolve(!0)}getFile(e){const t=this.files[e];return t?Promise.resolve(t):Promise.reject(null)}removeFile(e){return delete this.files[e],Promise.resolve(!0)}saveHistory(e){return this.histories[e.id]=e,Promise.resolve(!0)}removeHistory(e){const t=this.histories[e];if(t){const n=(t.items||[]).map(i=>i.id);this.removeHistoryItem(e,n),delete this.historyItems[e]}return Promise.resolve(!0)}getHistory(e){const t=this.histories[e],s=new R.HistoryModel(t||{id:e});return Promise.resolve(s)}getHistoryItem(e,t){const s=`${e}_${t}`,n=this.historyItems[s]||{};return Promise.resolve(n)}saveHistoryItem(e,t){const s=`${e}_${t.id}`;return this.historyItems[s]=t,Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(s=>{const n=`${e}_${s}`;delete this.historyItems[n]}),Promise.resolve(!0)}}let N=null;function Tt(){return N||(N=new He,N)}class kt extends J{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:u.mapToObject(t)}).catch(()=>!1)}async saveFile(e){return!!await this.api("saveFile",e).catch(()=>!1)}async getFile(e){const t=this.getFileCaches[e];return t||(this.getFileCaches[e]=this.api("getFile",e).catch(()=>null)).finally(()=>{delete this.getFileCaches[e]})}async removeFile(e){return!!await this.api("removeFile",e).catch(()=>!1)}async saveHistory(e){return!!await this.api("saveHistory",e).catch(()=>!1)}async removeHistory(e){return!!await this.api("removeHistory",e).catch(()=>!1)}async getHistory(e){return await this.api("getHistory",e).catch(()=>null)||{}}async getHistoryItem(e,t){return await this.api("getHistoryItem",{fId:e,id:t}).catch(()=>null)||{}}async saveHistoryItem(e,t){return!!await this.api("saveHistoryItem",{fId:e,item:t}).catch(()=>!1)}async removeHistoryItem(e,t){return!!await this.api("removeHistoryItem",{fId:e,ids:t}).catch(()=>!1)}}function xe(r,e,t=[]){return t.map(s=>{const{id:n,title:i,icon:a,children:o,hidden:c}=s;return{id:n,title:i,icon:a,hidden:c,url:`${r}/${e}/${n}`,children:o&&o.length?xe(r,e,o):void 0}})}function Ne(r,e){if(!e)return r;let t=[];for(const s of r)if(s.children&&s.children.length){const n=Ne(s.children,e);n.length&&(s.children=n,t.push(s))}else e.can(s.id.toString())&&t.push(s);return t}function Ft(r){const{menuPathPrefix:e="",pageRouteName:t="page",disableMenusFilter:s=!1}=r||{},n=ie(),i=ce.useRoute(),a=$e(),o=w.ref(!1),c=w.ref(!1),l=n.project;w.watchEffect(()=>{const{name:m,params:h,meta:f}=i;if(m===T){const g=n.getPage(h.id);o.value=!g?.mask,c.value=!!g?.pure}else if(m===D){const g=n.getHomepage();o.value=!g?.mask,c.value=!!g?.pure}else o.value=!f.mask,c.value=!!f.pure});const p=xe(e,t,l?.pages),d=l?.config;return{disabled:o,logo:d?.logo,themeSwitchable:d?.themeSwitchable,title:d?.title||l?.description||l?.name||"VTJ App",menus:s?p:Ne(p,a),pure:c}}exports.ACCESS_KEY=Z;exports.Access=ee;exports.BUILD_IN_TAGS=de;exports.BUILT_IN_DIRECTIVES=le;exports.BaseService=J;exports.CONTEXT_HOST=z;exports.Context=Me;exports.ContextMode=y;exports.DATA_TYPES=ue;exports.HOMEPAGE_ROUTE_NAME=D;exports.HTML_TAGS=pe;exports.JSCodeToString=Ye;exports.LIFE_CYCLES_LIST=Ke;exports.LocalService=kt;exports.MemoryService=He;exports.NodeEnv=Ie;exports.PAGE_ROUTE_NAME=T;exports.Provider=Oe;exports.StorageService=Mt;exports.VTJ_RENDERER_VERSION=M;exports.adoptedStyleSheets=Y;exports.clearLoaderCache=ct;exports.createAccess=Ze;exports.createAdapter=Xe;exports.createAssetScripts=Ve;exports.createAssetsCss=ze;exports.createDataSources=Te;exports.createLoader=B;exports.createMemoryService=Tt;exports.createMetaApi=Pe;exports.createMock=be;exports.createProvider=Pt;exports.createRenderer=L;exports.createSchemaApi=je;exports.createSchemaApis=Re;exports.createServiceRequest=At;exports.defaultLoader=ke;exports.fillBasePath=O;exports.getMock=k;exports.getModifiers=re;exports.getPlugin=se;exports.getRawComponent=ge;exports.isBuiltInTag=Se;exports.isCSSUrl=H;exports.isJSCode=Ee;exports.isJSExpression=E;exports.isJSFunction=I;exports.isJSON=fe;exports.isJSUrl=x;exports.isNativeTag=we;exports.isVuePlugin=_e;exports.loadCss=ye;exports.loadCssUrl=Q;exports.loadEnhance=Rt;exports.loadScriptUrl=X;exports.mockApi=Ae;exports.mockApis=Ce;exports.mockCleanup=te;exports.nodeRender=A;exports.parseDeps=me;exports.parseExpression=F;exports.parseFunction=U;exports.parseUrls=ve;exports.providerKey=ne;exports.removeProdFlag=he;exports.setupPageSetting=We;exports.toString=W;exports.useAccess=$e;exports.useMask=Ft;exports.useProvider=ie;
|
package/dist/index.mjs
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
import { Base as
|
2
|
-
import { isUrl as Ne, url as C, dedupArray as
|
3
|
-
import * as
|
1
|
+
import { Base as Oe, BUILT_IN_COMPONENTS as xe, ProjectModel as N, HistoryModel as pe } from "@vtj/core";
|
2
|
+
import { isUrl as Ne, url as C, dedupArray as Ue, isString as R, isFunction as V, logger as A, storage as J, cookie as K, toArray as re, unRSA as ie, delay as de, createRequest as fe, jsonp as he, merge as Be, pathToRegexp as Le, pathToRegexpMatch as qe, formDataToJson as Je, cloneDeep as oe, camelCase as j, upperFirst as Ke, pick as ze, request as W, loadScript as ae, Storage as Ve, mapToObject as te } from "@vtj/utils";
|
3
|
+
import * as U from "vue";
|
4
4
|
import { inject as me, defineComponent as ve, h as G, ref as Y, defineAsyncComponent as ce, watchEffect as We } from "vue";
|
5
5
|
import { useRoute as ge } from "vue-router";
|
6
6
|
/**!
|
7
7
|
* Copyright (c) 2025, VTJ.PRO All rights reserved.
|
8
8
|
* @name @vtj/renderer
|
9
9
|
* @author CHC chenhuachun1549@dingtalk.com
|
10
|
-
* @version 0.12.
|
10
|
+
* @version 0.12.28
|
11
11
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
12
12
|
*/
|
13
|
-
const
|
14
|
-
var
|
13
|
+
const F = "0.12.28";
|
14
|
+
var _ = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(_ || {});
|
15
15
|
const le = [
|
16
16
|
"$el",
|
17
17
|
"$emit",
|
@@ -55,13 +55,13 @@ const le = [
|
|
55
55
|
Object,
|
56
56
|
Function,
|
57
57
|
Date
|
58
|
-
},
|
58
|
+
}, M = "VtjPage", x = "VtjHomepage", Qe = "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".split(
|
59
59
|
","
|
60
60
|
), Xe = "component,slot".split(",");
|
61
61
|
function D(n, e) {
|
62
62
|
return n.map((t) => Ne(t) || t.startsWith("/") ? t : `${e}${t}`);
|
63
63
|
}
|
64
|
-
function
|
64
|
+
function B(n) {
|
65
65
|
return /\.css$/.test(n);
|
66
66
|
}
|
67
67
|
function L(n) {
|
@@ -72,31 +72,31 @@ function Ze(n) {
|
|
72
72
|
}
|
73
73
|
function ts(n) {
|
74
74
|
return n.map(
|
75
|
-
(e) => `<script src="${C.append(e, { v:
|
75
|
+
(e) => `<script src="${C.append(e, { v: F })}"><\/script>`
|
76
76
|
).join("");
|
77
77
|
}
|
78
78
|
function ss(n = []) {
|
79
79
|
return n.map(
|
80
|
-
(e) => `<link rel="stylesheet" href="${C.append(e, { v:
|
80
|
+
(e) => `<link rel="stylesheet" href="${C.append(e, { v: F })}" />`
|
81
81
|
).join("");
|
82
82
|
}
|
83
83
|
function et(n, e = !1) {
|
84
84
|
return e && n.endsWith(".prod.js") ? n.replace(".prod.js", ".js") : n;
|
85
85
|
}
|
86
86
|
function tt(n, e, t = !1) {
|
87
|
-
const s = n.filter((
|
87
|
+
const s = n.filter((h) => !!h.enabled), r = [], i = [], a = [], o = [], c = {}, l = {}, u = [], p = {};
|
88
88
|
return s.forEach(
|
89
|
-
({ urls:
|
90
|
-
|
91
|
-
L(v) && r.push(et(v, t)),
|
92
|
-
}), d && (o.push(d), c[d] = D(
|
89
|
+
({ urls: h, assetsUrl: f, library: d, assetsLibrary: m, localeLibrary: g }) => {
|
90
|
+
h?.forEach((v) => {
|
91
|
+
L(v) && r.push(et(v, t)), B(v) && i.push(v);
|
92
|
+
}), d && (o.push(d), c[d] = D(h || [], e), g && (l[d] = g)), f && a.push(f), m && u.push(m), d && m && (p[m] = d);
|
93
93
|
}
|
94
94
|
), {
|
95
95
|
scripts: D(r, e),
|
96
96
|
css: D(i, e),
|
97
97
|
materials: D(a, e),
|
98
98
|
libraryExports: o,
|
99
|
-
materialExports:
|
99
|
+
materialExports: Ue(u),
|
100
100
|
materialMapLibrary: p,
|
101
101
|
libraryMap: c,
|
102
102
|
libraryLocaleMap: l
|
@@ -107,20 +107,46 @@ function st(n, e) {
|
|
107
107
|
return s ? e[s]?.[r || t] : e[r || t];
|
108
108
|
}
|
109
109
|
function nt(n = []) {
|
110
|
-
const e = n.filter((s) =>
|
110
|
+
const e = n.filter((s) => B(s)), t = n.filter((s) => L(s));
|
111
111
|
return {
|
112
112
|
css: e,
|
113
113
|
js: t
|
114
114
|
};
|
115
115
|
}
|
116
|
-
function ye(n) {
|
117
|
-
return E(n) ? n : JSON.stringify(n);
|
118
|
-
}
|
119
116
|
function rt(n, e) {
|
120
|
-
|
117
|
+
const t = /(@(keyframes|media)\s*([^{]*)){([\s\S]*?}\s*})/g, s = [];
|
118
|
+
let o = n.replace(
|
119
|
+
t,
|
120
|
+
(c, l, u, p, h) => (s.push({ type: u, name: p.trim(), conditions: p, content: h }), "/* AT_RULE_PLACEHOLDER */")
|
121
|
+
).replace(/::v-deep\(/g, ":deep(").replace(/(\s*)>>>(\s*)/g, "$1:deep($2)").replace(
|
121
122
|
/([\w-.:\s[\]>+~]+?):deep\(([^)]+)\)/g,
|
122
|
-
(
|
123
|
-
).replace(/([^{}]+)(?=\s*{)/g, (
|
123
|
+
(c, l, u) => `${l.replace(/(\s*)$/, `[${e}]$1`)} ${u}`
|
124
|
+
).replace(/([^{}]+)(?=\s*{)/g, (c) => c.split(",").map((l) => {
|
125
|
+
const u = l.trim();
|
126
|
+
return u.includes(`[${e}]`) ? u : u.replace(
|
127
|
+
/(.*?)((?::[^:\s(]+(?:\([^)]*\))?)*)(\s*)$/,
|
128
|
+
(p, h, f, d) => `${h}[${e}]${f}${d}`
|
129
|
+
);
|
130
|
+
}).join(", "));
|
131
|
+
return s.forEach(({ type: c, conditions: l, content: u }) => {
|
132
|
+
let p = u;
|
133
|
+
c === "media" && (p = p.replace(
|
134
|
+
/([^{}]+)(?=\s*{)/g,
|
135
|
+
(h) => h.split(",").map((f) => {
|
136
|
+
const d = f.trim();
|
137
|
+
return d.includes(`[${e}]`) ? d : d.replace(
|
138
|
+
/(.*?)((?::[^:\s(]+(?:\([^)]*\))?)*)(\s*)$/,
|
139
|
+
(m, g, v, E) => `${g}[${e}]${v}${E}`
|
140
|
+
);
|
141
|
+
}).join(", ")
|
142
|
+
)), o = o.replace(
|
143
|
+
"/* AT_RULE_PLACEHOLDER */",
|
144
|
+
`@${c} ${l}{${p}}`
|
145
|
+
);
|
146
|
+
}), o;
|
147
|
+
}
|
148
|
+
function ye(n) {
|
149
|
+
return R(n) ? n : JSON.stringify(n);
|
124
150
|
}
|
125
151
|
function _e(n, e, t, s = !1) {
|
126
152
|
const r = n.CSSStyleSheet, i = s ? `data-v-${e}` : e, a = s ? rt(t, i) : t;
|
@@ -172,7 +198,7 @@ function at(n) {
|
|
172
198
|
function ct(n) {
|
173
199
|
return Qe.includes(n);
|
174
200
|
}
|
175
|
-
function
|
201
|
+
function I(n = window) {
|
176
202
|
const e = window?.Mock;
|
177
203
|
if (e) return e;
|
178
204
|
const t = n?.Mock;
|
@@ -194,13 +220,13 @@ function H(n, e, t = !1, s = !1) {
|
|
194
220
|
const a = `with(${t ? "{}" : "$scope || {}"}) { ${i} }`;
|
195
221
|
return new Function("$scope", a)(e);
|
196
222
|
} catch (r) {
|
197
|
-
if (
|
223
|
+
if (A.error("parseExpression.error", r, n, e?.__self ?? e), s)
|
198
224
|
throw r;
|
199
225
|
}
|
200
226
|
}
|
201
227
|
function Q(n, e, t = !1, s = !1) {
|
202
228
|
const r = H(n, e, t, s);
|
203
|
-
if (typeof r != "function" && (
|
229
|
+
if (typeof r != "function" && (A.error(
|
204
230
|
"parseFunction.error",
|
205
231
|
"not a function",
|
206
232
|
n,
|
@@ -235,10 +261,10 @@ const ut = {
|
|
235
261
|
appName: "",
|
236
262
|
statusKey: "code"
|
237
263
|
}, $e = Symbol("access");
|
238
|
-
class
|
264
|
+
class Ee {
|
239
265
|
options;
|
240
266
|
data = null;
|
241
|
-
mode =
|
267
|
+
mode = _.Raw;
|
242
268
|
interceptResponse = !0;
|
243
269
|
constructor(e) {
|
244
270
|
this.options = Object.assign({}, ut, e), this.loadData();
|
@@ -251,7 +277,7 @@ class je {
|
|
251
277
|
}
|
252
278
|
connect(e) {
|
253
279
|
const { mode: t, router: s, request: r } = e;
|
254
|
-
this.mode = t, s && this.mode ===
|
280
|
+
this.mode = t, s && this.mode === _.Raw && this.setGuard(s), r && this.setRequest(r);
|
255
281
|
}
|
256
282
|
login(e) {
|
257
283
|
const { storageKey: t, storagePrefix: s, session: r, authKey: i } = this.options;
|
@@ -336,7 +362,7 @@ class je {
|
|
336
362
|
return e && t ? !!K.get(t) : !!this.getToken();
|
337
363
|
}
|
338
364
|
hasRoutePermission(e) {
|
339
|
-
if (e.name ===
|
365
|
+
if (e.name === M) {
|
340
366
|
const t = e.params.id;
|
341
367
|
return t && this.can(t);
|
342
368
|
}
|
@@ -353,7 +379,7 @@ class je {
|
|
353
379
|
return t();
|
354
380
|
{
|
355
381
|
const { noPermissionMessage: s = "无权限访问", unauthorized: r = !1 } = this.options;
|
356
|
-
return await this.showTip(s), V(r) ? (r(), t(!1)) :
|
382
|
+
return await this.showTip(s), V(r) ? (r(), t(!1)) : R(r) ? t(r) : t(!1);
|
357
383
|
}
|
358
384
|
}
|
359
385
|
t(!1), this.toLogin();
|
@@ -428,11 +454,11 @@ function is(n = {}) {
|
|
428
454
|
loading: t,
|
429
455
|
useTitle: a,
|
430
456
|
startupComponent: r,
|
431
|
-
access: i ? new
|
457
|
+
access: i ? new Ee({ alert: o, ...i }) : void 0
|
432
458
|
};
|
433
459
|
}
|
434
460
|
function os(n = {}) {
|
435
|
-
return new
|
461
|
+
return new Ee(n);
|
436
462
|
}
|
437
463
|
function dt(n, e) {
|
438
464
|
const { jsonp: t, request: s } = e;
|
@@ -450,7 +476,7 @@ function dt(n, e) {
|
|
450
476
|
headers: r
|
451
477
|
}
|
452
478
|
};
|
453
|
-
return (a, o) => (delete i.data, s.send(
|
479
|
+
return (a, o) => (delete i.data, s.send(Be(i, o || {}, { data: a })));
|
454
480
|
}
|
455
481
|
}
|
456
482
|
function ft(n, e) {
|
@@ -474,18 +500,18 @@ function ht(n = [], e = [], t) {
|
|
474
500
|
return s;
|
475
501
|
}
|
476
502
|
async function mt(n = [], e = window) {
|
477
|
-
const t =
|
478
|
-
t && (
|
503
|
+
const t = I(e);
|
504
|
+
t && (je(e), n.forEach((s) => gt(t, s)));
|
479
505
|
}
|
480
506
|
function vt(n, e = window) {
|
481
|
-
const t = T(n.mockTemplate) && n.mockTemplate.value ? Q(n.mockTemplate, {}, !0) : void 0, s =
|
507
|
+
const t = T(n.mockTemplate) && n.mockTemplate.value ? Q(n.mockTemplate, {}, !0) : void 0, s = I(e);
|
482
508
|
return async (...r) => {
|
483
509
|
let i = {};
|
484
510
|
if (t)
|
485
511
|
try {
|
486
512
|
i = await t.apply(t, r);
|
487
513
|
} catch (a) {
|
488
|
-
|
514
|
+
A.warn("模拟数据模版异常", a);
|
489
515
|
}
|
490
516
|
return s?.mock(i);
|
491
517
|
};
|
@@ -501,8 +527,8 @@ function gt(n, e) {
|
|
501
527
|
});
|
502
528
|
}
|
503
529
|
}
|
504
|
-
function
|
505
|
-
const e =
|
530
|
+
function je(n = window) {
|
531
|
+
const e = I(n);
|
506
532
|
e && (e._mocked = {});
|
507
533
|
}
|
508
534
|
class yt {
|
@@ -534,7 +560,7 @@ class yt {
|
|
534
560
|
const { mode: t, dsl: s, attrs: r } = e;
|
535
561
|
this.__mode = t, s && (this.__id = s.id || null, this.__transform = s.transform || {}), r && Object.assign(this, r);
|
536
562
|
}
|
537
|
-
setup(e, t =
|
563
|
+
setup(e, t = U) {
|
538
564
|
const s = t.getCurrentInstance();
|
539
565
|
if (!s) return;
|
540
566
|
this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance = s.proxy;
|
@@ -562,7 +588,7 @@ class yt {
|
|
562
588
|
}
|
563
589
|
__parseFunction(e) {
|
564
590
|
if (e)
|
565
|
-
if (this.__mode ===
|
591
|
+
if (this.__mode === _.Runtime) {
|
566
592
|
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
567
593
|
return Q({ type: s, value: r }, this);
|
568
594
|
} else
|
@@ -570,14 +596,14 @@ class yt {
|
|
570
596
|
}
|
571
597
|
__parseExpression(e) {
|
572
598
|
if (e)
|
573
|
-
if (this.__mode ===
|
599
|
+
if (this.__mode === _.Runtime) {
|
574
600
|
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
575
601
|
return H({ type: s, value: r }, this);
|
576
602
|
} else
|
577
603
|
return H(e, this);
|
578
604
|
}
|
579
605
|
__ref(e = null, t) {
|
580
|
-
if (this.__mode !==
|
606
|
+
if (this.__mode !== _.VNode)
|
581
607
|
return e && e !== this.__id && (this.__contextRefs[e] = this), async (s) => {
|
582
608
|
await de(0);
|
583
609
|
let r = s?.$vtjEl || s?.$el || s?._?.vnode?.el || s;
|
@@ -585,7 +611,7 @@ class yt {
|
|
585
611
|
typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
|
586
612
|
return;
|
587
613
|
}
|
588
|
-
return r.nodeType === 3 && r.nextSibling && (r = r.nextSibling), r.__vtj__ = e,
|
614
|
+
return r.nodeType === 3 && r.nextSibling && (r = r.nextSibling), r.__vtj__ = e, _.Design === this.__mode && (r.__context__ = this, r.draggable = !0), e && (this.__refs[e] = this.__getRefEl(this.__refs, e, s)), typeof t == "function" ? t(s) : t && (this.$refs[t] = this.__getRefEl(this.$refs, t, s)), s;
|
589
615
|
};
|
590
616
|
}
|
591
617
|
__getRefEl(e, t, s) {
|
@@ -606,8 +632,8 @@ class yt {
|
|
606
632
|
}
|
607
633
|
function X(n) {
|
608
634
|
const {
|
609
|
-
Vue: e =
|
610
|
-
mode: t =
|
635
|
+
Vue: e = U,
|
636
|
+
mode: t = _.Runtime,
|
611
637
|
components: s = {},
|
612
638
|
libs: r = {},
|
613
639
|
apis: i = {},
|
@@ -633,19 +659,19 @@ function X(n) {
|
|
633
659
|
o.value.css || "",
|
634
660
|
!0
|
635
661
|
), l.state = St(e, o.value.state ?? {}, l);
|
636
|
-
const
|
637
|
-
for (const [v,
|
638
|
-
d[v] = e.inject(v,
|
639
|
-
const
|
662
|
+
const h = $t(e, o.value.computed ?? {}, l), f = Et(o.value.methods ?? {}, l), d = jt(e, o.value.inject, l);
|
663
|
+
for (const [v, E] of Object.entries(d || {}))
|
664
|
+
d[v] = e.inject(v, E);
|
665
|
+
const m = Rt(
|
640
666
|
o.value.dataSources || {},
|
641
667
|
l
|
642
|
-
),
|
668
|
+
), g = {
|
643
669
|
...d,
|
644
|
-
...
|
670
|
+
...h,
|
645
671
|
...f,
|
646
|
-
...
|
672
|
+
...m
|
647
673
|
};
|
648
|
-
return l.setup(
|
674
|
+
return l.setup(g, e), Pt(e, o.value.watch ?? [], l), {
|
649
675
|
vtj: l
|
650
676
|
};
|
651
677
|
},
|
@@ -654,8 +680,8 @@ function X(n) {
|
|
654
680
|
render() {
|
655
681
|
if (!o.value.nodes) return null;
|
656
682
|
const p = o.value.nodes || [];
|
657
|
-
return p.length === 1 ?
|
658
|
-
(
|
683
|
+
return p.length === 1 ? k(p[0], l, e, a, p) : p.map(
|
684
|
+
(h) => k(h, l, e, a, p)
|
659
685
|
);
|
660
686
|
},
|
661
687
|
...bt(o.value.lifeCycles ?? {}, l)
|
@@ -666,11 +692,11 @@ function X(n) {
|
|
666
692
|
};
|
667
693
|
}
|
668
694
|
function _t(n = []) {
|
669
|
-
return n.map((e) =>
|
695
|
+
return n.map((e) => R(e) ? e : e.name);
|
670
696
|
}
|
671
697
|
function wt(n = [], e) {
|
672
698
|
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((i) => Ye[i]) : void 0;
|
673
|
-
return n.map((s) =>
|
699
|
+
return n.map((s) => R(s) ? {
|
674
700
|
name: s
|
675
701
|
} : {
|
676
702
|
name: s.name,
|
@@ -703,13 +729,13 @@ function $t(n, e, t) {
|
|
703
729
|
{}
|
704
730
|
);
|
705
731
|
}
|
706
|
-
function
|
732
|
+
function Et(n, e) {
|
707
733
|
return Object.entries(n ?? {}).reduce(
|
708
734
|
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
709
735
|
{}
|
710
736
|
);
|
711
737
|
}
|
712
|
-
function
|
738
|
+
function jt(n, e = [], t) {
|
713
739
|
return e.reduce(
|
714
740
|
(s, r) => {
|
715
741
|
const { name: i, from: a } = r || {};
|
@@ -720,7 +746,7 @@ function Et(n, e = [], t) {
|
|
720
746
|
{}
|
721
747
|
);
|
722
748
|
}
|
723
|
-
function
|
749
|
+
function Rt(n, e) {
|
724
750
|
return Object.keys(n).reduce(
|
725
751
|
(t, s) => {
|
726
752
|
const r = n[s];
|
@@ -738,7 +764,7 @@ function Pt(n, e) {
|
|
738
764
|
{}
|
739
765
|
);
|
740
766
|
}
|
741
|
-
function
|
767
|
+
function Pt(n, e = [], t) {
|
742
768
|
e.forEach((s) => {
|
743
769
|
n.watch(
|
744
770
|
t.__parseExpression(s.source),
|
@@ -758,10 +784,10 @@ function bt(n, e) {
|
|
758
784
|
}
|
759
785
|
let z = [], b = {};
|
760
786
|
const Ct = (n) => n;
|
761
|
-
async function
|
787
|
+
async function Re(n, e = window) {
|
762
788
|
const { urls: t = [], library: s } = n, r = t.filter((o) => L(o));
|
763
789
|
if (r.length === 0 || !s) return null;
|
764
|
-
const i = t.filter((o) =>
|
790
|
+
const i = t.filter((o) => B(o));
|
765
791
|
return i.length && we(i, e), await Se(r, s, e).catch(
|
766
792
|
(o) => (console.warn("loadScriptUrl error", r, s, o), null)
|
767
793
|
);
|
@@ -770,7 +796,7 @@ function Z(n) {
|
|
770
796
|
const { getDsl: e, getDslByUrl: t, options: s } = n;
|
771
797
|
return s.window && (z.forEach((r) => {
|
772
798
|
delete s.window[r];
|
773
|
-
}), z = []), (r, i, a =
|
799
|
+
}), z = []), (r, i, a = U) => {
|
774
800
|
if (!i || typeof i == "string") return r;
|
775
801
|
if (i.type === "Schema" && i.id)
|
776
802
|
return a.defineAsyncComponent(async () => {
|
@@ -779,7 +805,7 @@ function Z(n) {
|
|
779
805
|
...s,
|
780
806
|
Vue: a,
|
781
807
|
dsl: oe(o),
|
782
|
-
mode:
|
808
|
+
mode: _.Runtime,
|
783
809
|
loader: Z(n)
|
784
810
|
}).renderer : null;
|
785
811
|
});
|
@@ -790,7 +816,7 @@ function Z(n) {
|
|
790
816
|
...s,
|
791
817
|
Vue: a,
|
792
818
|
dsl: oe(o),
|
793
|
-
mode:
|
819
|
+
mode: _.Runtime,
|
794
820
|
loader: Z(n)
|
795
821
|
}).renderer : null;
|
796
822
|
});
|
@@ -798,7 +824,7 @@ function Z(n) {
|
|
798
824
|
let o = i.library ? b[i.library] : null;
|
799
825
|
return o || (i.library && z.push(i.library), o = b[i.library || Symbol()] = a.defineAsyncComponent(
|
800
826
|
async () => {
|
801
|
-
const c = await
|
827
|
+
const c = await Re(i, s.window);
|
802
828
|
return c || (console.warn("getPlugin result is null", i), null);
|
803
829
|
}
|
804
830
|
), o);
|
@@ -809,43 +835,43 @@ function Z(n) {
|
|
809
835
|
function as() {
|
810
836
|
b = {};
|
811
837
|
}
|
812
|
-
function
|
838
|
+
function k(n, e, t = U, s = Ct, r = [], i = !1) {
|
813
839
|
if (!n || !n.name || n.invisible) return null;
|
814
|
-
const a = t.getCurrentInstance()?.appContext, { id: o = null, directives: c = [] } = n, { vIf: l, vElseIf: u, vElse: p, vFor:
|
840
|
+
const a = t.getCurrentInstance()?.appContext, { id: o = null, directives: c = [] } = n, { vIf: l, vElseIf: u, vElse: p, vFor: h, vShow: f, vModels: d, vBind: m, vHtml: g, others: v } = Pe(c);
|
815
841
|
if (!i && (u || p))
|
816
842
|
return null;
|
817
|
-
if (l && !
|
843
|
+
if (l && !kt(l, e))
|
818
844
|
return Ht(n, e, t, s, r);
|
819
|
-
const
|
820
|
-
const
|
845
|
+
const E = (S) => {
|
846
|
+
const Ie = S.$components, He = (() => {
|
821
847
|
if (n.name === "component")
|
822
|
-
return
|
848
|
+
return Ft(S, n.props?.is);
|
823
849
|
if (n.name === "slot") return n.name;
|
824
850
|
const $ = s(n.name, n.from, t);
|
825
|
-
return
|
826
|
-
})(),
|
851
|
+
return R($) ? at($) || ct($) ? $ : Ie[$] ?? a?.app?.component($) ?? $ : $;
|
852
|
+
})(), P = Mt(o, n.props ?? {}, S), Te = It(t, n.events ?? {}, S);
|
827
853
|
if (n.name === "slot")
|
828
|
-
return Tt(t, n,
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
)),
|
833
|
-
Object.assign(
|
854
|
+
return Tt(t, n, P, S, s);
|
855
|
+
m && Object.assign(P, S.__parseExpression(m.value)), f && (P.style = Object.assign(
|
856
|
+
P.style ?? {},
|
857
|
+
Ot(f, S)
|
858
|
+
)), g && Object.assign(P, xt(g, S)), d.forEach(($) => {
|
859
|
+
Object.assign(P, Nt(t, $, S));
|
834
860
|
});
|
835
|
-
const De =
|
861
|
+
const De = Ut(
|
836
862
|
t,
|
837
863
|
n.children ?? [],
|
838
864
|
S,
|
839
865
|
s,
|
840
866
|
n
|
841
867
|
);
|
842
|
-
let q = t.createVNode(He, { ...
|
843
|
-
const ne = a ?
|
868
|
+
let q = t.createVNode(He, { ...P, ...Te }, De);
|
869
|
+
const ne = a ? At(a, v, S) : [];
|
844
870
|
return ne.length && (q = t.withDirectives(q, ne)), q;
|
845
871
|
};
|
846
|
-
return
|
872
|
+
return h ? qt(h, E, e) : E(e);
|
847
873
|
}
|
848
|
-
function
|
874
|
+
function At(n, e, t) {
|
849
875
|
const s = n.app;
|
850
876
|
return e.map((r) => {
|
851
877
|
const i = typeof r.name == "string" ? s.directive(r.name) : t.__parseExpression(r.name);
|
@@ -854,7 +880,7 @@ function kt(n, e, t) {
|
|
854
880
|
return r.value && a.push(t.__parseExpression(r.value)), r.arg && a.push(r.arg), r.modifiers && a.push(r.modifiers), a;
|
855
881
|
}).filter((r) => !!r);
|
856
882
|
}
|
857
|
-
function
|
883
|
+
function Pe(n = []) {
|
858
884
|
const e = n.find((u) => j(u.name) === "vIf"), t = n.find(
|
859
885
|
(u) => j(u.name) === "vElseIf"
|
860
886
|
), s = n.find((u) => j(u.name) === "vElse"), r = n.find((u) => j(u.name) === "vFor"), i = n.find((u) => j(u.name) === "vShow"), a = n.find((u) => j(u.name) === "vBind"), o = n.find((u) => j(u.name) === "vHtml"), c = n.filter(
|
@@ -874,13 +900,13 @@ function Re(n = []) {
|
|
874
900
|
vHtml: o
|
875
901
|
};
|
876
902
|
}
|
877
|
-
function
|
903
|
+
function kt(n, e) {
|
878
904
|
return !!e.__parseExpression(n.value);
|
879
905
|
}
|
880
|
-
function
|
906
|
+
function Ft(n, e) {
|
881
907
|
return e ? w(e) ? n.__parseExpression(e) : e : "div";
|
882
908
|
}
|
883
|
-
function
|
909
|
+
function Mt(n, e, t) {
|
884
910
|
const s = ee(e, t);
|
885
911
|
return s.ref = t.__ref(n, s.ref), s;
|
886
912
|
}
|
@@ -893,7 +919,7 @@ function ee(n, e) {
|
|
893
919
|
{}
|
894
920
|
) : n;
|
895
921
|
}
|
896
|
-
function
|
922
|
+
function It(n, e, t) {
|
897
923
|
const s = ["passive", "capture", "once"], r = {
|
898
924
|
capture: "Capture",
|
899
925
|
once: "Once",
|
@@ -901,7 +927,7 @@ function Mt(n, e, t) {
|
|
901
927
|
};
|
902
928
|
return Object.keys(e || {}).reduce(
|
903
929
|
(i, a) => {
|
904
|
-
const o = e[a], c = be(o.modifiers), l = c.find((
|
930
|
+
const o = e[a], c = be(o.modifiers), l = c.find((h) => s.includes(h)), u = "on" + Ke(a) + (l && r[l] || ""), p = t.__parseFunction(o.handler);
|
905
931
|
return p && (i[u] = n.withModifiers(p, c)), i;
|
906
932
|
},
|
907
933
|
{}
|
@@ -910,14 +936,14 @@ function Mt(n, e, t) {
|
|
910
936
|
function Ht(n, e, t, s, r = []) {
|
911
937
|
let i = r.findIndex((a) => a.id === n.id);
|
912
938
|
for (let a = ++i; a < r.length; a++) {
|
913
|
-
const { directives: o = [] } = r[a], { vElseIf: c, vElse: l } =
|
939
|
+
const { directives: o = [] } = r[a], { vElseIf: c, vElse: l } = Pe(o);
|
914
940
|
if (c) {
|
915
941
|
if (e.__parseExpression(c.value))
|
916
|
-
return
|
942
|
+
return k(r[a], e, t, s, r, !0);
|
917
943
|
continue;
|
918
944
|
}
|
919
945
|
if (l)
|
920
|
-
return
|
946
|
+
return k(r[a], e, t, s, r, !0);
|
921
947
|
}
|
922
948
|
return null;
|
923
949
|
}
|
@@ -927,10 +953,10 @@ function be(n = {}, e = !1) {
|
|
927
953
|
}
|
928
954
|
function Tt(n, e, t, s, r) {
|
929
955
|
const { children: i } = e, a = Dt(e, s), o = s.$slots?.[a.name];
|
930
|
-
return o ? o(t) : i ?
|
956
|
+
return o ? o(t) : i ? R(i) ? n.createTextVNode(i) : w(i) ? n.createTextVNode(
|
931
957
|
ye(s.__parseExpression(i))
|
932
958
|
) : Array.isArray(i) ? i.map(
|
933
|
-
(c) =>
|
959
|
+
(c) => k(c, s, n, r, i)
|
934
960
|
) : null : null;
|
935
961
|
}
|
936
962
|
function Dt(n, e) {
|
@@ -940,12 +966,12 @@ function Dt(n, e) {
|
|
940
966
|
params: []
|
941
967
|
};
|
942
968
|
}
|
943
|
-
function
|
969
|
+
function Ot(n, e) {
|
944
970
|
return e.__parseExpression(n.value) ? {} : {
|
945
971
|
display: "none"
|
946
972
|
};
|
947
973
|
}
|
948
|
-
function
|
974
|
+
function xt(n, e) {
|
949
975
|
return {
|
950
976
|
innerHTML: e.__parseExpression(n.value) || ""
|
951
977
|
};
|
@@ -964,28 +990,28 @@ function Nt(n, e, t) {
|
|
964
990
|
[`onUpdate:${a}`]: i.length && r ? n.withModifiers(r, i) : r
|
965
991
|
};
|
966
992
|
}
|
967
|
-
function
|
993
|
+
function Ut(n, e, t, s, r) {
|
968
994
|
if (!e) return null;
|
969
|
-
if (
|
995
|
+
if (R(e))
|
970
996
|
return { default: () => e };
|
971
997
|
if (w(e))
|
972
998
|
return {
|
973
999
|
default: () => ye(t.__parseExpression(e))
|
974
1000
|
};
|
975
1001
|
if (Array.isArray(e) && e.length > 0) {
|
976
|
-
const i =
|
1002
|
+
const i = Bt(e), a = (o) => !o || !r ? {} : r?.id && Object.keys(o).length ? {
|
977
1003
|
[`scope_${r.id}`]: o
|
978
1004
|
} : {};
|
979
1005
|
return Object.entries(i).reduce((o, [c, { nodes: l, params: u }]) => (o[c] = (p) => {
|
980
|
-
const
|
1006
|
+
const h = u.length ? ze(p ?? {}, u) : a(p);
|
981
1007
|
return l.map(
|
982
|
-
(f) =>
|
1008
|
+
(f) => k(f, t.__clone(h), n, s, l)
|
983
1009
|
);
|
984
1010
|
}, o), {});
|
985
1011
|
}
|
986
1012
|
return null;
|
987
1013
|
}
|
988
|
-
function
|
1014
|
+
function Bt(n) {
|
989
1015
|
const e = {
|
990
1016
|
default: {
|
991
1017
|
params: [],
|
@@ -1002,7 +1028,7 @@ function Ut(n) {
|
|
1002
1028
|
return e;
|
1003
1029
|
}
|
1004
1030
|
function Lt(n = "default") {
|
1005
|
-
return
|
1031
|
+
return R(n) ? { name: n, params: [] } : { params: [], ...n };
|
1006
1032
|
}
|
1007
1033
|
function qt(n, e, t) {
|
1008
1034
|
const { value: s, iterator: r } = n, { item: i = "item", index: a = "index" } = r || {};
|
@@ -1012,7 +1038,7 @@ function qt(n, e, t) {
|
|
1012
1038
|
const ue = ve({
|
1013
1039
|
name: "VtjPageContainer",
|
1014
1040
|
async setup() {
|
1015
|
-
const n =
|
1041
|
+
const n = Ae(), e = ge(), t = e.params.id, s = t ? n.getPage(t) : n.getHomepage(), r = s ? await n.getRenderComponent(s.id) : null, i = Y(Symbol());
|
1016
1042
|
if (s) {
|
1017
1043
|
Object.assign(e.meta, s.meta || {}, { cache: s.cache });
|
1018
1044
|
const { useTitle: a } = n?.adapter;
|
@@ -1042,7 +1068,7 @@ const ue = ve({
|
|
1042
1068
|
}
|
1043
1069
|
}), Ce = Symbol("Provider");
|
1044
1070
|
var Kt = /* @__PURE__ */ ((n) => (n.Production = "production", n.Development = "development", n))(Kt || {});
|
1045
|
-
class zt extends
|
1071
|
+
class zt extends Oe {
|
1046
1072
|
// DSL缓存
|
1047
1073
|
/**
|
1048
1074
|
* 创建Provider实例
|
@@ -1052,7 +1078,7 @@ class zt extends xe {
|
|
1052
1078
|
super(), this.options = e;
|
1053
1079
|
const {
|
1054
1080
|
service: t,
|
1055
|
-
mode: s =
|
1081
|
+
mode: s = _.Raw,
|
1056
1082
|
dependencies: r,
|
1057
1083
|
materials: i,
|
1058
1084
|
project: a = {},
|
@@ -1061,12 +1087,12 @@ class zt extends xe {
|
|
1061
1087
|
modules: l = {},
|
1062
1088
|
router: u = null,
|
1063
1089
|
materialPath: p = "./",
|
1064
|
-
nodeEnv:
|
1090
|
+
nodeEnv: h = "development"
|
1065
1091
|
/* Development */
|
1066
1092
|
} = e;
|
1067
|
-
this.mode = s, this.modules = l, this.service = t, this.router = u, this.materialPath = p, this.nodeEnv =
|
1093
|
+
this.mode = s, this.modules = l, this.service = t, this.router = u, this.materialPath = p, this.nodeEnv = h, r && (this.dependencies = r), i && (this.materials = i), Object.assign(this.globals, c), Object.assign(this.adapter, o);
|
1068
1094
|
const { access: f, request: d } = this.adapter;
|
1069
|
-
f && f.connect({ mode: s, router: u, request: d }), a && s !==
|
1095
|
+
f && f.connect({ mode: s, router: u, request: d }), a && s !== _.Design ? this.load(a) : this.project = a;
|
1070
1096
|
}
|
1071
1097
|
mode;
|
1072
1098
|
// 当前运行模式(设计/源码/预览等)
|
@@ -1104,9 +1130,9 @@ class zt extends xe {
|
|
1104
1130
|
try {
|
1105
1131
|
s = await e.apply(e, t);
|
1106
1132
|
} catch (i) {
|
1107
|
-
|
1133
|
+
A.warn("模拟数据模版异常", i);
|
1108
1134
|
}
|
1109
|
-
return
|
1135
|
+
return I()?.mock(s);
|
1110
1136
|
};
|
1111
1137
|
}
|
1112
1138
|
/**
|
@@ -1123,10 +1149,10 @@ class zt extends xe {
|
|
1123
1149
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
1124
1150
|
throw new Error("project is null");
|
1125
1151
|
const { apis: s = [], meta: r = [] } = this.project, i = window;
|
1126
|
-
i && (i.CKEDITOR_VERSION = void 0), this.mode ===
|
1152
|
+
i && (i.CKEDITOR_VERSION = void 0), this.mode === _.Raw ? await this.loadDependencies(i) : await this.loadAssets(i), this.initMock(i), this.apis = ht(s, r, this.adapter), je(i), mt(s, i), e.platform !== "uniapp" && this.initRouter(), this.triggerReady();
|
1127
1153
|
}
|
1128
1154
|
initMock(e) {
|
1129
|
-
const t =
|
1155
|
+
const t = I(e);
|
1130
1156
|
t && t.setup({
|
1131
1157
|
timeout: "50-500"
|
1132
1158
|
});
|
@@ -1142,7 +1168,7 @@ class zt extends xe {
|
|
1142
1168
|
libraryMap: l,
|
1143
1169
|
materials: u,
|
1144
1170
|
materialExports: p,
|
1145
|
-
materialMapLibrary:
|
1171
|
+
materialMapLibrary: h
|
1146
1172
|
} = tt(
|
1147
1173
|
t,
|
1148
1174
|
a,
|
@@ -1150,32 +1176,32 @@ class zt extends xe {
|
|
1150
1176
|
/* Development */
|
1151
1177
|
);
|
1152
1178
|
for (const f of c) {
|
1153
|
-
const d = s[f],
|
1154
|
-
if (
|
1155
|
-
r[f] =
|
1179
|
+
const d = s[f], m = e[f];
|
1180
|
+
if (m)
|
1181
|
+
r[f] = m;
|
1156
1182
|
else if (d)
|
1157
1183
|
e[f] = r[f] = await d();
|
1158
1184
|
else {
|
1159
|
-
const
|
1160
|
-
for (const v of
|
1161
|
-
|
1185
|
+
const g = l[f] || [];
|
1186
|
+
for (const v of g)
|
1187
|
+
B(v) && await it(f, C.append(v, { v: F })), L(v) && await ae(C.append(v, { v: F }));
|
1162
1188
|
r[f] = e[f];
|
1163
1189
|
}
|
1164
1190
|
}
|
1165
1191
|
if (o === "development") {
|
1166
1192
|
for (const d of u)
|
1167
|
-
await ae(C.append(d, { v:
|
1193
|
+
await ae(C.append(d, { v: F }));
|
1168
1194
|
const f = this.materials || {};
|
1169
1195
|
for (const d of p) {
|
1170
|
-
const
|
1171
|
-
if (
|
1172
|
-
|
1173
|
-
i[v] =
|
1196
|
+
const m = e[h[d]], g = xe[d];
|
1197
|
+
if (g)
|
1198
|
+
m && g.forEach((v) => {
|
1199
|
+
i[v] = m[v];
|
1174
1200
|
});
|
1175
1201
|
else {
|
1176
1202
|
const v = f[d] ? (await f[d]()).default : e[d];
|
1177
|
-
v &&
|
1178
|
-
i[
|
1203
|
+
v && m && (v.components || []).forEach((E) => {
|
1204
|
+
i[E.name] = st(E, m);
|
1179
1205
|
});
|
1180
1206
|
}
|
1181
1207
|
}
|
@@ -1190,15 +1216,15 @@ class zt extends xe {
|
|
1190
1216
|
routeMeta: c
|
1191
1217
|
} = s, l = a ? "" : "/", u = {
|
1192
1218
|
path: `${l}${o}/:id`,
|
1193
|
-
name:
|
1219
|
+
name: M,
|
1194
1220
|
component: ue
|
1195
1221
|
}, p = {
|
1196
1222
|
path: l,
|
1197
|
-
name:
|
1223
|
+
name: x,
|
1198
1224
|
component: t?.homepage ? ue : r.startupComponent || Jt,
|
1199
1225
|
meta: c
|
1200
1226
|
};
|
1201
|
-
e.hasRoute(
|
1227
|
+
e.hasRoute(M) && e.removeRoute(M), e.hasRoute(x) && e.removeRoute(x), a ? (e.addRoute(a, u), e.addRoute(a, p)) : (e.addRoute(u), e.addRoute(p));
|
1202
1228
|
}
|
1203
1229
|
/**
|
1204
1230
|
* Vue 插件安装方法
|
@@ -1214,7 +1240,7 @@ class zt extends xe {
|
|
1214
1240
|
const t = e.config.globalProperties.installed || {};
|
1215
1241
|
for (const [s, r] of Object.entries(this.library))
|
1216
1242
|
!t[s] && ot(r) && (e.use(r), t[s] = !0);
|
1217
|
-
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(Ce, this), e.config.globalProperties.$provider = this, e.config.globalProperties.installed = t, this.mode ===
|
1243
|
+
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(Ce, this), e.config.globalProperties.$provider = this, e.config.globalProperties.installed = t, this.mode === _.Design && (e.config.errorHandler = (s, r, i) => {
|
1218
1244
|
const a = r?.$options.name, o = typeof s == "string" ? s : s?.message || s?.msg || "未知错误", c = `[ ${a} ] ${o} ${i}`;
|
1219
1245
|
console.error(
|
1220
1246
|
"[VTJ Error]:",
|
@@ -1306,13 +1332,13 @@ class zt extends xe {
|
|
1306
1332
|
async getRenderComponent(e, t) {
|
1307
1333
|
const s = this.getFile(e);
|
1308
1334
|
if (!s)
|
1309
|
-
return
|
1335
|
+
return A.warn(`Can not find file: ${e}`), null;
|
1310
1336
|
t && t(s);
|
1311
1337
|
const r = `.vtj/vue/${e}.vue`, i = this.modules[r] || this.modules[`/src/pages/${e}.vue`];
|
1312
1338
|
if (i)
|
1313
1339
|
return (await i())?.default;
|
1314
1340
|
const a = await this.getDsl(s.id);
|
1315
|
-
return a ? this.createDslRenderer(a).renderer : (
|
1341
|
+
return a ? this.createDslRenderer(a).renderer : (A.warn(`Can not find dsl: ${e}`), null);
|
1316
1342
|
}
|
1317
1343
|
/**
|
1318
1344
|
* 定义基于URL的异步组件
|
@@ -1337,7 +1363,7 @@ class zt extends xe {
|
|
1337
1363
|
* @returns Vue异步组件
|
1338
1364
|
*/
|
1339
1365
|
definePluginComponent(e) {
|
1340
|
-
return ce(async () => await
|
1366
|
+
return ce(async () => await Re(e, window));
|
1341
1367
|
}
|
1342
1368
|
}
|
1343
1369
|
function cs(n) {
|
@@ -1347,7 +1373,7 @@ function cs(n) {
|
|
1347
1373
|
onReady: (s) => e.ready(s)
|
1348
1374
|
};
|
1349
1375
|
}
|
1350
|
-
function
|
1376
|
+
function Ae(n = {}) {
|
1351
1377
|
const e = me(Ce, null);
|
1352
1378
|
if (!e)
|
1353
1379
|
throw new Error("Can not find provider");
|
@@ -1372,7 +1398,7 @@ async function ls(n, e = "") {
|
|
1372
1398
|
}
|
1373
1399
|
);
|
1374
1400
|
}
|
1375
|
-
const
|
1401
|
+
const ke = {
|
1376
1402
|
type: "json",
|
1377
1403
|
validSuccess: !0,
|
1378
1404
|
originResponse: !1,
|
@@ -1387,7 +1413,7 @@ const Fe = {
|
|
1387
1413
|
type: t,
|
1388
1414
|
data: s
|
1389
1415
|
},
|
1390
|
-
settings:
|
1416
|
+
settings: ke
|
1391
1417
|
}), Wt = (n, e = "/__vtj__/api/uploader.json") => async (t, s) => await n.send({
|
1392
1418
|
url: e,
|
1393
1419
|
method: "post",
|
@@ -1396,7 +1422,7 @@ const Fe = {
|
|
1396
1422
|
projectId: s
|
1397
1423
|
},
|
1398
1424
|
settings: {
|
1399
|
-
...
|
1425
|
+
...ke,
|
1400
1426
|
type: "data"
|
1401
1427
|
}
|
1402
1428
|
}).then((r) => r && r[0] ? r[0] : null).catch(() => null);
|
@@ -1516,58 +1542,58 @@ class se {
|
|
1516
1542
|
return console.log("BaseService.genSource", e), "";
|
1517
1543
|
}
|
1518
1544
|
}
|
1519
|
-
const
|
1545
|
+
const y = new Ve({
|
1520
1546
|
type: "local",
|
1521
1547
|
expired: 0,
|
1522
1548
|
prefix: "__VTJ_"
|
1523
1549
|
});
|
1524
1550
|
class ps extends se {
|
1525
1551
|
init(e) {
|
1526
|
-
const t = new N(e), s =
|
1527
|
-
return
|
1552
|
+
const t = new N(e), s = y.get(`project_${t.id}`), r = Object.assign(t.toDsl(), s || {});
|
1553
|
+
return y.save(`project_${t.id}`, r), Promise.resolve(r);
|
1528
1554
|
}
|
1529
1555
|
saveProject(e) {
|
1530
1556
|
const t = new N(e);
|
1531
|
-
return
|
1557
|
+
return y.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
|
1532
1558
|
}
|
1533
1559
|
saveMaterials(e, t) {
|
1534
|
-
return
|
1560
|
+
return y.save(`materials_${e.id}`, te(t)), Promise.resolve(!0);
|
1535
1561
|
}
|
1536
1562
|
saveFile(e) {
|
1537
|
-
return
|
1563
|
+
return y.save(`file_${e.id}`, e), Promise.resolve(!0);
|
1538
1564
|
}
|
1539
1565
|
getFile(e) {
|
1540
|
-
const t =
|
1566
|
+
const t = y.get(`file_${e}`);
|
1541
1567
|
return t ? Promise.resolve(t) : Promise.reject(null);
|
1542
1568
|
}
|
1543
1569
|
removeFile(e) {
|
1544
|
-
return
|
1570
|
+
return y.remove(`file_${e}`), Promise.resolve(!0);
|
1545
1571
|
}
|
1546
1572
|
saveHistory(e) {
|
1547
|
-
return
|
1573
|
+
return y.save(`history_${e.id}`, e), Promise.resolve(!0);
|
1548
1574
|
}
|
1549
1575
|
removeHistory(e) {
|
1550
|
-
const t =
|
1576
|
+
const t = y.get(`history_${e}`);
|
1551
1577
|
if (t) {
|
1552
1578
|
const r = (t.items || []).map((i) => i.id);
|
1553
|
-
this.removeHistoryItem(e, r),
|
1579
|
+
this.removeHistoryItem(e, r), y.remove(`history_${e}`);
|
1554
1580
|
}
|
1555
1581
|
return Promise.resolve(!0);
|
1556
1582
|
}
|
1557
1583
|
getHistory(e) {
|
1558
|
-
const t =
|
1584
|
+
const t = y.get(`history_${e}`), s = new pe(t || { id: e });
|
1559
1585
|
return Promise.resolve(s.toDsl());
|
1560
1586
|
}
|
1561
1587
|
getHistoryItem(e, t) {
|
1562
|
-
const s =
|
1588
|
+
const s = y.get(`history_${e}_${t}`);
|
1563
1589
|
return Promise.resolve(s);
|
1564
1590
|
}
|
1565
1591
|
saveHistoryItem(e, t) {
|
1566
|
-
return
|
1592
|
+
return y.save(`history_${e}_${t.id}`, t), Promise.resolve(!0);
|
1567
1593
|
}
|
1568
1594
|
removeHistoryItem(e, t) {
|
1569
1595
|
return t.forEach((s) => {
|
1570
|
-
|
1596
|
+
y.remove(`history_${e}_${s}`);
|
1571
1597
|
}), Promise.resolve(!0);
|
1572
1598
|
}
|
1573
1599
|
}
|
@@ -1628,9 +1654,9 @@ class Gt extends se {
|
|
1628
1654
|
}), Promise.resolve(!0);
|
1629
1655
|
}
|
1630
1656
|
}
|
1631
|
-
let
|
1657
|
+
let O = null;
|
1632
1658
|
function ds() {
|
1633
|
-
return
|
1659
|
+
return O || (O = new Gt(), O);
|
1634
1660
|
}
|
1635
1661
|
class fs extends se {
|
1636
1662
|
getFileCaches = {};
|
@@ -1689,7 +1715,7 @@ class fs extends se {
|
|
1689
1715
|
);
|
1690
1716
|
}
|
1691
1717
|
}
|
1692
|
-
function
|
1718
|
+
function Fe(n, e, t = []) {
|
1693
1719
|
return t.map((s) => {
|
1694
1720
|
const { id: r, title: i, icon: a, children: o, hidden: c } = s;
|
1695
1721
|
return {
|
@@ -1698,16 +1724,16 @@ function Ae(n, e, t = []) {
|
|
1698
1724
|
icon: a,
|
1699
1725
|
hidden: c,
|
1700
1726
|
url: `${n}/${e}/${r}`,
|
1701
|
-
children: o && o.length ?
|
1727
|
+
children: o && o.length ? Fe(n, e, o) : void 0
|
1702
1728
|
};
|
1703
1729
|
});
|
1704
1730
|
}
|
1705
|
-
function
|
1731
|
+
function Me(n, e) {
|
1706
1732
|
if (!e) return n;
|
1707
1733
|
let t = [];
|
1708
1734
|
for (const s of n)
|
1709
1735
|
if (s.children && s.children.length) {
|
1710
|
-
const r =
|
1736
|
+
const r = Me(s.children, e);
|
1711
1737
|
r.length && (s.children = r, t.push(s));
|
1712
1738
|
} else
|
1713
1739
|
e.can(s.id.toString()) && t.push(s);
|
@@ -1718,19 +1744,19 @@ function hs(n) {
|
|
1718
1744
|
menuPathPrefix: e = "",
|
1719
1745
|
pageRouteName: t = "page",
|
1720
1746
|
disableMenusFilter: s = !1
|
1721
|
-
} = n || {}, r =
|
1747
|
+
} = n || {}, r = Ae(), i = ge(), a = pt(), o = Y(!1), c = Y(!1), l = r.project;
|
1722
1748
|
We(() => {
|
1723
|
-
const { name:
|
1724
|
-
if (
|
1725
|
-
const
|
1726
|
-
o.value = !
|
1727
|
-
} else if (
|
1728
|
-
const
|
1729
|
-
o.value = !
|
1749
|
+
const { name: h, params: f, meta: d } = i;
|
1750
|
+
if (h === M) {
|
1751
|
+
const m = r.getPage(f.id);
|
1752
|
+
o.value = !m?.mask, c.value = !!m?.pure;
|
1753
|
+
} else if (h === x) {
|
1754
|
+
const m = r.getHomepage();
|
1755
|
+
o.value = !m?.mask, c.value = !!m?.pure;
|
1730
1756
|
} else
|
1731
1757
|
o.value = !d.mask, c.value = !!d.pure;
|
1732
1758
|
});
|
1733
|
-
const u =
|
1759
|
+
const u = Fe(
|
1734
1760
|
e,
|
1735
1761
|
t,
|
1736
1762
|
l?.pages
|
@@ -1740,39 +1766,38 @@ function hs(n) {
|
|
1740
1766
|
logo: p?.logo,
|
1741
1767
|
themeSwitchable: p?.themeSwitchable,
|
1742
1768
|
title: p?.title || l?.description || l?.name || "VTJ App",
|
1743
|
-
menus: s ? u :
|
1769
|
+
menus: s ? u : Me(u, a),
|
1744
1770
|
pure: c
|
1745
1771
|
};
|
1746
1772
|
}
|
1747
1773
|
export {
|
1748
1774
|
$e as ACCESS_KEY,
|
1749
|
-
|
1775
|
+
Ee as Access,
|
1750
1776
|
Xe as BUILD_IN_TAGS,
|
1751
1777
|
Ge as BUILT_IN_DIRECTIVES,
|
1752
1778
|
se as BaseService,
|
1753
1779
|
le as CONTEXT_HOST,
|
1754
1780
|
yt as Context,
|
1755
|
-
|
1781
|
+
_ as ContextMode,
|
1756
1782
|
Ye as DATA_TYPES,
|
1757
|
-
|
1783
|
+
x as HOMEPAGE_ROUTE_NAME,
|
1758
1784
|
Qe as HTML_TAGS,
|
1759
1785
|
rs as JSCodeToString,
|
1760
1786
|
es as LIFE_CYCLES_LIST,
|
1761
1787
|
fs as LocalService,
|
1762
1788
|
Gt as MemoryService,
|
1763
1789
|
Kt as NodeEnv,
|
1764
|
-
|
1790
|
+
M as PAGE_ROUTE_NAME,
|
1765
1791
|
zt as Provider,
|
1766
1792
|
ps as StorageService,
|
1767
|
-
|
1793
|
+
F as VTJ_RENDERER_VERSION,
|
1768
1794
|
_e as adoptedStyleSheets,
|
1769
1795
|
as as clearLoaderCache,
|
1770
|
-
rt as compileScopedCSS,
|
1771
1796
|
os as createAccess,
|
1772
1797
|
is as createAdapter,
|
1773
1798
|
ts as createAssetScripts,
|
1774
1799
|
ss as createAssetsCss,
|
1775
|
-
|
1800
|
+
Rt as createDataSources,
|
1776
1801
|
Z as createLoader,
|
1777
1802
|
ds as createMemoryService,
|
1778
1803
|
ft as createMetaApi,
|
@@ -1784,12 +1809,12 @@ export {
|
|
1784
1809
|
us as createServiceRequest,
|
1785
1810
|
Ct as defaultLoader,
|
1786
1811
|
D as fillBasePath,
|
1787
|
-
|
1812
|
+
I as getMock,
|
1788
1813
|
be as getModifiers,
|
1789
|
-
|
1814
|
+
Re as getPlugin,
|
1790
1815
|
st as getRawComponent,
|
1791
1816
|
at as isBuiltInTag,
|
1792
|
-
|
1817
|
+
B as isCSSUrl,
|
1793
1818
|
lt as isJSCode,
|
1794
1819
|
w as isJSExpression,
|
1795
1820
|
T as isJSFunction,
|
@@ -1803,8 +1828,8 @@ export {
|
|
1803
1828
|
Se as loadScriptUrl,
|
1804
1829
|
gt as mockApi,
|
1805
1830
|
mt as mockApis,
|
1806
|
-
|
1807
|
-
|
1831
|
+
je as mockCleanup,
|
1832
|
+
k as nodeRender,
|
1808
1833
|
tt as parseDeps,
|
1809
1834
|
H as parseExpression,
|
1810
1835
|
Q as parseFunction,
|
@@ -1815,5 +1840,5 @@ export {
|
|
1815
1840
|
ye as toString,
|
1816
1841
|
pt as useAccess,
|
1817
1842
|
hs as useMask,
|
1818
|
-
|
1843
|
+
Ae as useProvider
|
1819
1844
|
};
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vtj/renderer",
|
3
3
|
"private": false,
|
4
|
-
"version": "0.12.
|
4
|
+
"version": "0.12.28",
|
5
5
|
"type": "module",
|
6
6
|
"keywords": [
|
7
7
|
"低代码引擎",
|
@@ -21,15 +21,15 @@
|
|
21
21
|
"author": "chenhuachun",
|
22
22
|
"license": "MIT",
|
23
23
|
"dependencies": {
|
24
|
-
"@vtj/
|
25
|
-
"@vtj/
|
24
|
+
"@vtj/core": "~0.12.28",
|
25
|
+
"@vtj/utils": "~0.12.28"
|
26
26
|
},
|
27
27
|
"devDependencies": {
|
28
28
|
"vue": "~3.5.5",
|
29
29
|
"vue-router": "~4.5.0",
|
30
|
-
"@vtj/
|
31
|
-
"@vtj/
|
32
|
-
"@vtj/icons": "~0.12.
|
30
|
+
"@vtj/ui": "~0.12.28",
|
31
|
+
"@vtj/cli": "~0.12.3",
|
32
|
+
"@vtj/icons": "~0.12.28"
|
33
33
|
},
|
34
34
|
"exports": {
|
35
35
|
".": {
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function compileScopedCSS(cssContent: string, scopeId: string): string;
|
package/types/utils/util.d.ts
CHANGED
@@ -2,7 +2,6 @@ import { Plugin, App } from 'vue';
|
|
2
2
|
import { PageFile, BlockFile } from '@vtj/core';
|
3
3
|
import { RouteLocationNormalizedGeneric } from 'vue-router';
|
4
4
|
export declare function toString(value: any): string;
|
5
|
-
export declare function compileScopedCSS(cssContent: string, scopeId: string): string;
|
6
5
|
export declare function adoptedStyleSheets(global: Window, id: string, css: string, scoped?: boolean): void;
|
7
6
|
export declare function loadCss(id: string, url: string): Promise<void>;
|
8
7
|
export declare function loadCssUrl(urls: string[], global?: any): void;
|
package/types/version.d.ts
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
* Copyright (c) 2025, VTJ.PRO All rights reserved.
|
3
3
|
* @name @vtj/renderer
|
4
4
|
* @author CHC chenhuachun1549@dingtalk.com
|
5
|
-
* @version 0.12.
|
5
|
+
* @version 0.12.27
|
6
6
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
7
7
|
*/
|
8
|
-
export declare const version = "0.12.
|
8
|
+
export declare const version = "0.12.27";
|