@duxweb/dvha-core 1.0.23 → 1.0.24
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/cjs/components/auth/can.cjs +1 -1
- package/dist/cjs/components/loader/iframe.cjs +1 -1
- package/dist/cjs/components/loader/remote/loader.cjs +1 -1
- package/dist/cjs/components/loader/remote/render.cjs +1 -1
- package/dist/cjs/components/overlay/overlay.cjs +1 -1
- package/dist/cjs/components/status/exception.cjs +1 -1
- package/dist/cjs/directive/permission.cjs +1 -1
- package/dist/cjs/hooks/auth.cjs +1 -1
- package/dist/cjs/hooks/data.cjs +1 -1
- package/dist/cjs/hooks/export.cjs +1 -1
- package/dist/cjs/hooks/exportCsv.cjs +2 -2
- package/dist/cjs/hooks/form.cjs +1 -1
- package/dist/cjs/hooks/formExtend.cjs +1 -1
- package/dist/cjs/hooks/i18n.cjs +1 -1
- package/dist/cjs/hooks/import.cjs +1 -1
- package/dist/cjs/hooks/importCsv.cjs +2 -2
- package/dist/cjs/hooks/json/utils/expressionParser.cjs +1 -1
- package/dist/cjs/hooks/json/vFor.cjs +1 -1
- package/dist/cjs/hooks/json/vOn.cjs +1 -1
- package/dist/cjs/hooks/json/vShow.cjs +1 -1
- package/dist/cjs/hooks/json.cjs +1 -1
- package/dist/cjs/hooks/list.cjs +1 -1
- package/dist/cjs/hooks/manage.cjs +1 -1
- package/dist/cjs/hooks/menu.cjs +1 -1
- package/dist/cjs/hooks/select.cjs +1 -1
- package/dist/cjs/hooks/theme.cjs +3 -3
- package/dist/cjs/hooks/tree.cjs +1 -1
- package/dist/cjs/hooks/upload/s3.cjs +1 -1
- package/dist/cjs/hooks/upload.cjs +1 -1
- package/dist/cjs/preset/authProvider.cjs +1 -1
- package/dist/cjs/preset/dataProvider.cjs +1 -1
- package/dist/cjs/preset/i18nProvider.cjs +1 -1
- package/dist/cjs/provider/app.cjs +1 -1
- package/dist/cjs/router/route.cjs +1 -1
- package/dist/cjs/stores/auth.cjs +1 -1
- package/dist/cjs/stores/i18n.cjs +1 -1
- package/dist/cjs/stores/jsonSchema.cjs +1 -1
- package/dist/cjs/stores/manage.cjs +1 -1
- package/dist/cjs/stores/route.cjs +1 -1
- package/dist/cjs/stores/tab.cjs +1 -1
- package/dist/cjs/stores/theme.cjs +1 -1
- package/dist/cjs/utils/tree.cjs +1 -1
- package/dist/esm/components/auth/can.js +8 -11
- package/dist/esm/components/loader/iframe.js +14 -17
- package/dist/esm/components/loader/remote/loader.js +103 -105
- package/dist/esm/components/loader/remote/render.js +10 -11
- package/dist/esm/components/overlay/overlay.js +7 -7
- package/dist/esm/components/status/exception.js +10 -13
- package/dist/esm/directive/permission.js +6 -7
- package/dist/esm/hooks/auth.js +73 -83
- package/dist/esm/hooks/data.js +290 -345
- package/dist/esm/hooks/export.js +16 -17
- package/dist/esm/hooks/exportCsv.js +26 -27
- package/dist/esm/hooks/form.js +49 -54
- package/dist/esm/hooks/formExtend.js +24 -25
- package/dist/esm/hooks/i18n.js +11 -29
- package/dist/esm/hooks/import.js +31 -32
- package/dist/esm/hooks/importCsv.js +24 -25
- package/dist/esm/hooks/json/utils/expressionParser.js +36 -42
- package/dist/esm/hooks/json/vFor.js +15 -16
- package/dist/esm/hooks/json/vOn.js +17 -18
- package/dist/esm/hooks/json/vShow.js +9 -10
- package/dist/esm/hooks/json.js +88 -94
- package/dist/esm/hooks/list.js +100 -127
- package/dist/esm/hooks/manage.js +13 -17
- package/dist/esm/hooks/menu.js +39 -52
- package/dist/esm/hooks/select.js +35 -40
- package/dist/esm/hooks/theme.js +127 -141
- package/dist/esm/hooks/tree.js +22 -28
- package/dist/esm/hooks/upload/s3.js +22 -23
- package/dist/esm/hooks/upload.js +152 -159
- package/dist/esm/preset/authProvider.js +63 -117
- package/dist/esm/preset/dataProvider.js +69 -76
- package/dist/esm/preset/i18nProvider.js +18 -18
- package/dist/esm/provider/app.js +74 -81
- package/dist/esm/router/route.js +16 -24
- package/dist/esm/stores/auth.js +17 -20
- package/dist/esm/stores/i18n.js +10 -10
- package/dist/esm/stores/jsonSchema.js +20 -23
- package/dist/esm/stores/manage.js +33 -33
- package/dist/esm/stores/route.js +38 -50
- package/dist/esm/stores/tab.js +38 -54
- package/dist/esm/stores/theme.js +28 -29
- package/dist/esm/utils/tree.js +23 -24
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("axios"),i=require("lodash-es");function s(t){const h=(a,c)=>{const l=`${i.trim(t.apiUrl,"/")}${c?`/${i.trim(c,"/")}`:""}`;return a?`${l}/${i.trim(a||"","/")}`:l};return{apiUrl:h,getList:(a,c,l)=>{const e={};return a.pagination&&typeof a.pagination=="object"&&(e.page=a.pagination.page,e.pageSize=a.pagination.pageSize),d.get(h(a.path,c?.config.apiBasePath)||"",{params:{...e,...a.filters,...a.sorters},headers:{Authorization:l?.token},...a.meta}).then(r=>t.successCallback?t.successCallback(r):u(r)).catch(r=>{throw t.errorCallback?t.errorCallback(r):n(r)})},create:(a,c,l)=>d.post(h(a.path,c?.config.apiBasePath)||"",a.data,{headers:{Authorization:l?.token},...a.meta}).then(e=>t.successCallback?t.successCallback(e):u(e)).catch(e=>{throw t.errorCallback?t.errorCallback(e):n(e)}),update:(a,c,l)=>d.put(h(a.id?`${a.path}/${a.id}`:a.path,c?.config.apiBasePath)||"",a.data,{headers:{Authorization:l?.token},...a.meta}).then(e=>t.successCallback?t.successCallback(e):u(e)).catch(e=>{throw t.errorCallback?t.errorCallback(e):n(e)}),deleteOne:(a,c,l)=>d.delete(h(a.id?`${a.path}/${a.id}`:a.path,c?.config.apiBasePath)||"",{headers:{Authorization:l?.token},...a.meta}).then(e=>t.successCallback?t.successCallback(e):u(e)).catch(e=>{throw t.errorCallback?t.errorCallback(e):n(e)}),getOne:(a,c,l)=>d.get(h(a.id?`${a.path}/${a.id}`:a.path,c?.config.apiBasePath)||"",{headers:{Authorization:l?.token},...a.meta}).then(e=>t.successCallback?t.successCallback(e):u(e)).catch(e=>{throw t.errorCallback?t.errorCallback(e):n(e)}),getMany:(a,c,l)=>d.get(h(a.path,c?.config.apiBasePath)||"",{params:{ids:a.ids},headers:{Authorization:l?.token},...a.meta}).then(e=>t.successCallback?t.successCallback(e):u(e)).catch(e=>{throw t.errorCallback?t.errorCallback(e):n(e)}),createMany:(a,c,l)=>d.post(h(a.path,c?.config.apiBasePath)||"",a.data,{headers:{Authorization:l?.token},...a.meta}).then(e=>t.successCallback?t.successCallback(e):u(e)).catch(e=>{throw t.errorCallback?t.errorCallback(e):n(e)}),updateMany:(a,c,l)=>d.put(h(a.path,c?.config.apiBasePath)||"",{ids:a.ids,data:a.data},{headers:{Authorization:l?.token},...a.meta}).then(e=>t.successCallback?t.successCallback(e):u(e)).catch(e=>{throw t.errorCallback?t.errorCallback(e):n(e)}),deleteMany:(a,c,l)=>d.delete(h(a.path,c?.config.apiBasePath)||"",{params:{ids:a.ids},headers:{Authorization:l?.token},...a.meta}).then(e=>t.successCallback?t.successCallback(e):u(e)).catch(e=>{throw t.errorCallback?t.errorCallback(e):n(e)}),custom:(a,c,l)=>{let e={...a.query};return a.sorters&&typeof a.sorters=="object"&&(e={...e,...a.sorters}),a.filters&&typeof a.filters=="object"&&(e={...e,...a.filters}),d.request({url:h(a.path,c?.config.apiBasePath)||"",method:a.method||"GET",data:a.payload,params:e,signal:a.signal,headers:{Authorization:l?.token,...a.headers},onUploadProgress:r=>{const k=Math.round(r.loaded*100/(r.total||1));a.onUploadProgress?.({loaded:r.loaded,total:r.total,percent:k})},onDownloadProgress:r=>{const k=Math.round(r.loaded*100/(r.total||1));a.onDownloadProgress?.({loaded:r.loaded,total:r.total,percent:k})},...a.meta}).then(r=>t.successCallback?t.successCallback(r):u(r)).catch(r=>{throw t.errorCallback?t.errorCallback(r):n(r)})},getTotal:a=>t.getTotal?t.getTotal(a):a.meta?.total||0}}function u(t){return{message:t.data?.message,data:t.data?.data,meta:t.data?.meta,raw:t.data}}function n(t){return{message:t.response?.data?.message||t?.message,data:t.response?.data?.data,meta:t.response?.data?.meta,status:t.response?.data?.code||t.response?.status||500,raw:t.response?.data}}exports.simpleDataProvider=s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue-i18n");function t(r){const l=n.createI18n({legacy:!1,locale:r?.locale,fallbackLocale:r?.fallbackLocale,messages:r?.messages,missingWarn:!1,fallbackWarn:!1});return{t:(e,a,o)=>{const c=l.global.t(e,a);return c===e&&o?o:c},changeLocale:(e,a)=>new Promise(o=>{l.global.locale.value=e,o(e)}),loadLocale:(e,a)=>new Promise(o=>{l.global.setLocaleMessage(e,a),o(e)}),mergeLocale:(e,a)=>{l.global.mergeLocaleMessage(e,a)},getLocale:()=>l.global.locale.value,getLocales:()=>l.global.availableLocales.map(e=>e)}}exports.i18nProvider=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("vue"),$=require("@overlastic/vue"),A=require("vue-router"),S=require("../hooks/auth.cjs"),M=require("../hooks/config.cjs");require("@tanstack/vue-query");const k=require("../hooks/manage.cjs");require("json-2-csv");require("lodash-es");require("@vee-validate/rules");require("vee-validate");const z=require("../stores/auth.cjs"),D=require("../stores/i18n.cjs");require("pinia");const w=require("../stores/manage.cjs"),C=require("../stores/route.cjs");require("@vueuse/core");const E=require("../hooks/json.cjs");require("../hooks/json/index.cjs");require("../utils/bus.cjs");require("colorizr");require("axios");require("clsx");const F=require("../components/status/error.cjs"),I=require("../components/status/notAuthorized.cjs"),N=require("../components/status/notFound.cjs"),x=d.defineComponent({name:"DuxAppProvider",props:{},setup(y,{slots:R}){const m=d.inject("dux.manage"),s=M.useConfig(),p=A.useRouter();return p.beforeEach(async(a,j,u)=>{const e=a.meta.manageName,P=a.meta.authorization===!1;if(!e){const t=s.defaultManage||s.manages?.[0]?.name||"";return u({path:`/${t}`,replace:!0})}m&&(m.value=e);const f=w.useManageStore(e);f.isInit()||f.setConfig(s.manages?.find(t=>t.name===e),s);const c=C.useRouteStore(e),r=k.useManage(e),h=z.useAuthStore(e),l=D.useI18nStore(e);if(r.config?.i18nProvider&&!l.isInit()){const t=l.getLocale();t&&r.config?.i18nProvider.changeLocale(t)}if(E.initJsonSchemaComponents(s,e),!h.isLogin())return P?u():u({path:r.getRoutePath("login"),replace:!0});const g=t=>t?.map(i=>({...i,path:i.path?r.getRoutePath(i.path):void 0}));if(!c.getRouteInit()){const t=r.config?.components||{},i=[];return i.push({name:`${e}.notFound`,label:"404",path:":pathMatch(.*)*",component:t.notFound||N.DuxNotFound,hidden:!0,meta:{can:!1}}),i.push({name:`${e}.notAuthorized`,label:"403",path:"notAuthorized",component:t.notAuthorized||I.DuxNotAuthorized,hidden:!0,meta:{can:!1}}),i.push({name:`${e}.error`,label:"500",path:"error",component:t.error||F.DuxError,hidden:!0,meta:{can:!1}}),c.setRoutes(g(r.config?.menus||[])),r.config?.apiRoutePath&&await r.config?.dataProvider?.default?.custom({path:r.config.apiRoutePath,meta:{timeout:5e3}},r,h.getUser()).then(o=>{c.appendRoutes(g(o.data||[]))}).catch(o=>{throw r.config?.authProvider?.onError?.(o).then(n=>{n?.logout&&(h.logout(),p.push(r.getRoutePath(n.redirectTo||"/login")))}),o}),c.appendRoutes(i),c.getRoutes().forEach(o=>{if(!o.path)return;const n={name:o.name,path:o.path,meta:o.meta};switch(o.loader){case"iframe":n.component=r.config?.components?.iframe||(()=>Promise.resolve().then(()=>require("../components/loader/iframe.cjs")));break;case"remote":n.component=r.config?.components?.remote||(()=>Promise.resolve().then(()=>require("../components/loader/loader.cjs")));break;case"link":n.beforeEnter=()=>{const v=o.meta?.url||o.path;return v&&window.open(v,"_blank"),!1},n.component=()=>Promise.resolve({template:"<div></div>"});break;default:o.component&&(n.component=o.component);break}p.addRoute(`${e}.auth`,n)}),u({path:a.redirectedFrom?.path||a.path,replace:!0})}const q=["","/",`/${e}`,`/${e}/`];if(q.includes(a.path)){const t=c.getIndexRoute();return!t?.path||q.includes(t?.path)?(console.warn("[Dux] index route not found, skip redirect"),u()):u({path:t?.path||"/",replace:!0})}const b=S.useCan(e);return(a.meta?.can===void 0||a.meta?.can===!0)&&!b(a.name)?u({name:`${e}.notAuthorized`}):u()}),()=>d.createVNode($.OverlaysProvider,null,{default:()=>[R.default?.()]})}});exports.DuxAppProvider=x;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("vue-router");function i(e){const r=[...e.routes||[],{name:"default",path:"/:catchAll(.*)",redirect:`/${e.defaultManage||e.manages?.[0]?.name||""}`}];return e.manages?.forEach(t=>{const a=t.routes?.filter(o=>o.meta?.authorization===!0||o.meta?.authorization===void 0)||[],n=t.routes?.filter(o=>o.meta?.authorization===!1)||[];r.push({name:t.name,path:t.routePrefix||"",children:[{path:"",name:`${t.name}.auth`,component:t.components?.authLayout,children:a},{path:"",name:`${t.name}.noAuth`,component:t.components?.noAuthLayout,children:n}],meta:{manageName:t.name}})}),u.createRouter({history:u.createWebHashHistory(),routes:r})}exports.initRouter=i;
|
package/dist/cjs/stores/auth.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("pinia"),n=require("vue");function s(o){const t=n.inject("dux.manage");if(o||(o=t?.value||""),!o)throw new Error("manage not found");return c(o)()}function c(o){return r.defineStore(`auths-${o}`,()=>{const t=n.ref();return{data:t,getUser:()=>t.value||{},login:e=>{t.value={token:e?.token,id:e?.id,info:e?.info,permission:e?.permission}},isLogin:()=>!!t.value?.token,logout:()=>{t.value=void 0},update:e=>{t.value={token:e?.token,id:e?.id,info:e?.info,permission:e?.permission}},updateKey:(e,i)=>{t.value={...t.value,[e]:i}}}},{persist:!0})}exports.useAuthStore=s;
|
package/dist/cjs/stores/i18n.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("pinia"),o=require("vue");function u(
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("pinia"),o=require("vue");function u(e){const t=o.inject("dux.manage");if(e||(e=t?.value||""),!e)throw new Error("manage not found");return c(e)()}function c(e){return i.defineStore(`i18n-${e}`,()=>{const t=o.ref(""),n=o.ref(!1);return{lang:t,isInit:()=>{const r=n.value;return n.value=!0,r},setLocale:r=>{t.value=r},getLocale:()=>t.value}},{persist:{pick:["lang"]}})}exports.useI18nStore=u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("pinia"),a=require("vue");function i(
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("pinia"),a=require("vue");function i(t){const e=a.inject("dux.manage");if(t||(t=e?.value||""),!t)throw new Error("manage not found");return h(t)()}function h(t){return s.defineStore(`jsonSchema-${t}`,()=>{const e=a.ref(new Map),o=a.ref(new Map);return{componentCache:e,componentsByName:o,addComponent:(n,r,u)=>{const c=r;return e.value.has(c)||(e.value.set(c,{component:n,name:r,originalName:u||r,cacheKey:c}),o.value.set(r,n)),c},getComponent:n=>e.value.get(n)?.component,getComponentByName:n=>o.value.get(n),hasComponent:n=>e.value.has(n),clearCache:()=>{e.value.clear(),o.value.clear()},getCacheSize:()=>e.value.size}})}exports.useJsonSchemaStore=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("lodash-es"),P=require("pinia"),c=require("vue");function v(r){return r!=null&&typeof r=="object"&&!Array.isArray(r)&&typeof r.getList!="function"}function f(r){const n=c.inject("dux.manage");if(r||(r=n?.value||""),!r)throw new Error("manage not found");return m(r)()}function m(r){return P.defineStore(`manages-${r}`,()=>{const n=c.ref(),d=c.ref(!1);return{config:n,isInit:()=>{const s=d.value;return d.value=!0,s},setConfig:(s,t)=>{const e=p.cloneDeep(s),u=[];e.title&&u.push(e.title),t.title&&u.push(t.title),e.title=u.join(" - "),e.copyright=e.copyright||t.copyright,e.description=e.description||t.description,e.theme={...t?.theme,...e?.theme};const a={};t?.dataProvider&&(v(t.dataProvider)?Object.keys(t.dataProvider).forEach(i=>{a[i]=t.dataProvider[i]}):a.default=t.dataProvider),e?.dataProvider&&(v(e.dataProvider)?Object.keys(e.dataProvider).forEach(i=>{a[i]=e.dataProvider[i]}):a.default=e.dataProvider),e.authProvider=t?.authProvider||e?.authProvider,e.dataProvider=a,e.i18nProvider=t?.i18nProvider||e?.i18nProvider,e.layoutComponent={...t.layoutComponent,...e.layoutComponent};const o={...t.components,...e.components};o&&Object.keys(o).forEach(i=>{o[i]&&(o[i]=c.markRaw(o[i]))}),e.components=o,e.remote={...t.remote,...e.remote},n.value=e},getConfig:()=>n.value}})}exports.useManageStore=f;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("pinia"),i=require("vue");function I(r){const t=i.inject("dux.manage");if(r||(r=t?.value||""),!r)throw new Error("manage not found");return b(r)()}function b(r){return g.defineStore(`routes-${r}`,()=>{const t=i.ref([]),a=e=>t.value?.find(n=>n.path===e),f=e=>t.value?.find(n=>n.name===e),d=e=>{t.value?.push(e)},v=e=>{t.value=[...t.value,...e]},R=e=>{t.value=e},p=()=>t.value,h=()=>{t.value=[]},S=()=>{const e=t.value?.filter(o=>!o.parent&&!o.name?.includes("404")&&!o.name?.includes("403"))?.sort((o,u)=>(o.sort||0)-(u.sort||0)),n=o=>{if(o.path)return o;const u=t.value?.filter(s=>s.parent===o.name)?.sort((s,c)=>(s.sort||0)-(c.sort||0));for(const s of u||[]){const c=n(s);if(c)return c}};for(const o of e||[]){const u=n(o);if(u)return u}},l=i.ref(!1);return{routes:t,searchRoute:a,searchRouteName:f,appendRoute:d,appendRoutes:v,setRoutes:R,getRoutes:p,clearRoutes:h,getIndexRoute:S,getRouteInit:()=>{const e=l.value;return l.value=!0,e}}})}exports.useRouteStore=I;
|
package/dist/cjs/stores/tab.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("pinia"),i=require("vue");function b(o){const u=i.inject("dux.manage");if(o||(o=u?.value||""),!o)throw new Error("manage not found");return s(o)()}function s(o){return d.defineStore(`tab-${o}`,()=>{const u=i.ref(),v=i.ref(),e=i.ref([]);return{current:u,tabs:e,isTab:t=>e.value.some(l=>l.path===t),addTab:(t,l)=>{t.path&&(e.value.some(a=>a.path===t.path)?(u.value&&u.value!==t.path&&(v.value=e.value.find(a=>a.path===u.value)),u.value=t.path):(u.value&&(v.value=e.value.find(a=>a.path===u.value)),e.value.push(t),l?.(t),u.value=t.path))},delTab:(t,l)=>{const a=e.value.findIndex(r=>r.path===t);if(a===-1||e.value.length<=1||e.value[a]?.meta?.lock)return;let c;if(t===u.value&&v.value&&(c=e.value.find(r=>r.path===v.value?.path&&r.path!==t)),!c){const r=e.value[a-1],f=e.value[a+1];c=r||f}e.value.splice(a,1),l?.(c)},changeTab:(t,l)=>{const a=e.value.find(n=>n.path===t);a&&(u.value&&u.value!==t&&(v.value=e.value.find(n=>n.path===u.value)),u.value=t,l?.(a))},delOther:(t,l)=>{e.value=e.value.filter(a=>a.path===t||a.meta?.lock),l?.()},delLeft:(t,l)=>{const a=e.value.findIndex(n=>n.path===t);a<=0||i.nextTick(()=>{e.value=[...e.value.slice(0,a).filter(n=>n.meta?.lock),...e.value.slice(a)],l?.()})},delRight:(t,l)=>{const a=e.value.findIndex(n=>n.path===t);a===-1||a===e.value.length-1||i.nextTick(()=>{e.value=[...e.value.slice(0,a+1),...e.value.slice(a+1).filter(n=>n.meta?.lock)],l?.()})},lockTab:t=>{const l=e.value.findIndex(a=>a.path===t);l!==-1&&e.value[l]&&(e.value[l].meta||(e.value[l].meta={}),e.value[l].meta.lock=!e.value[l].meta.lock)},clearTab:()=>{u.value=void 0,v.value=void 0,e.value=[]}}})}exports.createTabStore=s;exports.useTabStore=b;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("pinia"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("pinia"),r=require("vue"),T=require("./manage.cjs"),c={primary:"emerald",info:"cyan",success:"green",warning:"amber",error:"red",gray:"zinc"};function S(e){const o=r.inject("dux.manage");if(e||(e=o?.value||""),!e)throw new Error("manage not found");return v(e)()}function v(e){return g.defineStore(`theme-${e}`,()=>{const o=T.useManageStore(e),t=r.ref(o.config?.theme?.defaultTheme||c),u=r.ref("auto"),s=r.ref(!1);function i(){s.value=!0}function a(n){u.value=n}function f(n,d){t.value[n]=d}function m(n){Object.assign(t.value,n)}function h(){t.value={...c}}function l(){return t.value}return{mode:u,setMode:a,theme:t,cssInit:s,setCssInit:i,setThemeColor:f,setThemeColors:m,resetTheme:h,getTheme:l}},{persist:{pick:["theme","mode"]}})}exports.useThemeStore=S;
|
package/dist/cjs/utils/tree.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function f(h,n
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function f(h,t,n){let r=[];return h.forEach(e=>{if(e[t.parentKey]===n){const c=f(h,t,e[t.idKey]);c.length>0&&(e[t.childrenKey]=c),r.push(e)}}),r=r.sort((e,c)=>e[t.sortKey]-c[t.sortKey]),r}function l(h,t,n=[]){if(!h||!h.length)return[];for(const r of h){if(n.push(r),t(r))return n;if(r?.children&&r?.children?.length){const e=l(r.children,t,n);if(e.length)return e}n.pop()}return[]}function o(h,t,n){let r=[];if(!h||!h.length)return r;for(const e of h)if(r.push(e[t]),e[n]&&e[n].length){const c=o(e[n],t,n);c.length&&(r=r.concat(c))}return r}exports.arrayToTree=f;exports.searchTree=l;exports.treeToArr=o;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useCan as
|
|
1
|
+
import { defineComponent as p } from "vue";
|
|
2
|
+
import { useCan as o } from "../../hooks/auth.js";
|
|
3
3
|
import "@tanstack/vue-query";
|
|
4
4
|
import "lodash-es";
|
|
5
5
|
import "vue-router";
|
|
@@ -14,7 +14,7 @@ import "@overlastic/vue";
|
|
|
14
14
|
import "clsx";
|
|
15
15
|
import "colorizr";
|
|
16
16
|
import "axios";
|
|
17
|
-
const
|
|
17
|
+
const j = /* @__PURE__ */ p({
|
|
18
18
|
name: "DuxCan",
|
|
19
19
|
props: {
|
|
20
20
|
name: {
|
|
@@ -25,16 +25,13 @@ const S = /* @__PURE__ */ e({
|
|
|
25
25
|
type: Object
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
|
-
setup(
|
|
29
|
-
slots:
|
|
28
|
+
setup(r, {
|
|
29
|
+
slots: t
|
|
30
30
|
}) {
|
|
31
|
-
const
|
|
32
|
-
return () =>
|
|
33
|
-
var p, i;
|
|
34
|
-
return t(m.name, m.params) ? (p = r.default) == null ? void 0 : p.call(r) : ((i = r.fallback) == null ? void 0 : i.call(r)) || null;
|
|
35
|
-
};
|
|
31
|
+
const m = o();
|
|
32
|
+
return () => m(r.name, r.params) ? t.default?.() : t.fallback?.() || null;
|
|
36
33
|
}
|
|
37
34
|
});
|
|
38
35
|
export {
|
|
39
|
-
|
|
36
|
+
j as DuxCan
|
|
40
37
|
};
|
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useRoute as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as r, createVNode as o } from "vue";
|
|
2
|
+
import { useRoute as t } from "vue-router";
|
|
3
|
+
const u = /* @__PURE__ */ r({
|
|
4
4
|
name: "DuxLoaderIframe",
|
|
5
|
-
setup(
|
|
6
|
-
const
|
|
7
|
-
return () => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
}, null);
|
|
17
|
-
};
|
|
5
|
+
setup(m) {
|
|
6
|
+
const e = t();
|
|
7
|
+
return () => o("iframe", {
|
|
8
|
+
src: e.meta?.url,
|
|
9
|
+
style: {
|
|
10
|
+
width: "100%",
|
|
11
|
+
height: "100%",
|
|
12
|
+
border: "none"
|
|
13
|
+
}
|
|
14
|
+
}, null);
|
|
18
15
|
}
|
|
19
16
|
});
|
|
20
17
|
export {
|
|
21
|
-
|
|
18
|
+
u as default
|
|
22
19
|
};
|
|
@@ -1,149 +1,147 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { createVNode as
|
|
3
|
-
import * as
|
|
4
|
-
import * as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import * as
|
|
9
|
-
import * as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import * as
|
|
13
|
-
import { loadModule as
|
|
14
|
-
import * as
|
|
15
|
-
import { useManage as
|
|
16
|
-
import { useClient as
|
|
1
|
+
import * as M from "vue";
|
|
2
|
+
import { createVNode as b } from "vue";
|
|
3
|
+
import * as E from "@tanstack/vue-query";
|
|
4
|
+
import * as k from "@vueuse/core";
|
|
5
|
+
import D from "axios";
|
|
6
|
+
import g from "crypto-js";
|
|
7
|
+
import J from "dayjs";
|
|
8
|
+
import * as L from "lodash-es";
|
|
9
|
+
import * as N from "mathjs";
|
|
10
|
+
import d from "mime";
|
|
11
|
+
import O from "mitt";
|
|
12
|
+
import * as T from "pinia";
|
|
13
|
+
import { loadModule as W } from "vue3-sfc-loader";
|
|
14
|
+
import * as q from "vue-router";
|
|
15
|
+
import { useManage as F } from "../../../hooks/manage.js";
|
|
16
|
+
import { useClient as V } from "../../../hooks/data.js";
|
|
17
17
|
import "json-2-csv";
|
|
18
18
|
import "@vee-validate/rules";
|
|
19
19
|
import "vee-validate";
|
|
20
|
-
import { useI18n as
|
|
21
|
-
import { useJsonSchema as
|
|
20
|
+
import { useI18n as _ } from "../../../hooks/i18n.js";
|
|
21
|
+
import { useJsonSchema as A } from "../../../hooks/json.js";
|
|
22
22
|
import "../../../hooks/json/index.js";
|
|
23
23
|
import "../../../utils/bus.js";
|
|
24
24
|
import "@overlastic/vue";
|
|
25
25
|
import "clsx";
|
|
26
26
|
import "colorizr";
|
|
27
|
-
import * as
|
|
28
|
-
const
|
|
29
|
-
function
|
|
30
|
-
return
|
|
27
|
+
import * as B from "../../../index.js";
|
|
28
|
+
const f = /* @__PURE__ */ new Map();
|
|
29
|
+
function H(s) {
|
|
30
|
+
return g.MD5(s).toString().substring(0, 10);
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
} = _(), x = {
|
|
32
|
+
function ut(s) {
|
|
33
|
+
const c = V(), {
|
|
34
|
+
mergeLocale: u
|
|
35
|
+
} = _(), {
|
|
36
|
+
config: i
|
|
37
|
+
} = F(), y = {
|
|
39
38
|
moduleCache: {
|
|
40
|
-
vue:
|
|
41
|
-
"@duxweb/dvha-core":
|
|
42
|
-
"@vueuse/core":
|
|
43
|
-
"@tanstack/vue-query":
|
|
44
|
-
axios:
|
|
45
|
-
crypto:
|
|
46
|
-
mime:
|
|
47
|
-
math:
|
|
48
|
-
mitt:
|
|
49
|
-
"lodash-es":
|
|
50
|
-
pinia:
|
|
51
|
-
dayjs:
|
|
52
|
-
"vue-router":
|
|
53
|
-
...
|
|
54
|
-
"static!": function(
|
|
55
|
-
const a =
|
|
56
|
-
if (a
|
|
57
|
-
return `data:${a};charset=utf-8;base64,${btoa(
|
|
58
|
-
if (
|
|
59
|
-
return JSON.parse(
|
|
60
|
-
throw new Error(`${
|
|
39
|
+
vue: M,
|
|
40
|
+
"@duxweb/dvha-core": B,
|
|
41
|
+
"@vueuse/core": k,
|
|
42
|
+
"@tanstack/vue-query": E,
|
|
43
|
+
axios: D,
|
|
44
|
+
crypto: g,
|
|
45
|
+
mime: d,
|
|
46
|
+
math: N,
|
|
47
|
+
mitt: O,
|
|
48
|
+
"lodash-es": L,
|
|
49
|
+
pinia: T,
|
|
50
|
+
dayjs: J,
|
|
51
|
+
"vue-router": q,
|
|
52
|
+
...i?.remote?.packages,
|
|
53
|
+
"static!": function(t, r, e) {
|
|
54
|
+
const a = d.getType(e);
|
|
55
|
+
if (a?.startsWith("image"))
|
|
56
|
+
return `data:${a};charset=utf-8;base64,${btoa(t)}`;
|
|
57
|
+
if (e === ".json")
|
|
58
|
+
return JSON.parse(t);
|
|
59
|
+
throw new Error(`${e} unable to parse`);
|
|
61
60
|
}
|
|
62
61
|
},
|
|
63
|
-
async handleModule(
|
|
64
|
-
if (
|
|
65
|
-
if (
|
|
66
|
-
const
|
|
62
|
+
async handleModule(t, r) {
|
|
63
|
+
if (t !== ".vue") {
|
|
64
|
+
if (t === ".json") {
|
|
65
|
+
const e = await r(), {
|
|
67
66
|
render: a
|
|
68
|
-
} =
|
|
69
|
-
data:
|
|
70
|
-
context:
|
|
67
|
+
} = A({
|
|
68
|
+
data: e?.nodes || {},
|
|
69
|
+
context: e?.data || {}
|
|
71
70
|
});
|
|
72
|
-
return () =>
|
|
71
|
+
return () => b(a, null, null);
|
|
73
72
|
}
|
|
74
|
-
return
|
|
73
|
+
return r();
|
|
75
74
|
}
|
|
76
75
|
},
|
|
77
|
-
customBlockHandler(
|
|
78
|
-
if (
|
|
79
|
-
const
|
|
80
|
-
for (const
|
|
81
|
-
|
|
76
|
+
customBlockHandler(t) {
|
|
77
|
+
if (t.type === "i18n") {
|
|
78
|
+
const r = JSON.parse(t.content);
|
|
79
|
+
for (const e in r)
|
|
80
|
+
u(e, r[e]);
|
|
82
81
|
}
|
|
83
82
|
},
|
|
84
|
-
getFile: async (
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
path: typeof ((t = r == null ? void 0 : r.remote) == null ? void 0 : t.apiRoutePath) == "function" ? (a = r == null ? void 0 : r.remote) == null ? void 0 : a.apiRoutePath(e) : ((u = r == null ? void 0 : r.remote) == null ? void 0 : u.apiRoutePath) || "static",
|
|
83
|
+
getFile: async (t) => {
|
|
84
|
+
t = l(t, ".vue"), t = l(t, ".json");
|
|
85
|
+
const r = await c.request({
|
|
86
|
+
path: typeof i?.remote?.apiRoutePath == "function" ? i?.remote?.apiRoutePath(t) : i?.remote?.apiRoutePath || "static",
|
|
89
87
|
payload: {
|
|
90
|
-
path:
|
|
88
|
+
path: t
|
|
91
89
|
},
|
|
92
|
-
method:
|
|
93
|
-
}).then((
|
|
94
|
-
throw new Error(`${
|
|
90
|
+
method: i?.remote?.apiMethod || "POST"
|
|
91
|
+
}).then((e) => e?.data).catch((e) => {
|
|
92
|
+
throw new Error(`${e?.message} ${t}`);
|
|
95
93
|
});
|
|
96
94
|
return {
|
|
97
|
-
getContentData: () =>
|
|
98
|
-
type: `${
|
|
95
|
+
getContentData: () => r?.content,
|
|
96
|
+
type: `${r?.type || "vue"}`
|
|
99
97
|
};
|
|
100
98
|
},
|
|
101
99
|
getResource({
|
|
102
|
-
refPath:
|
|
103
|
-
relPath:
|
|
104
|
-
},
|
|
100
|
+
refPath: t,
|
|
101
|
+
relPath: r
|
|
102
|
+
}, e) {
|
|
105
103
|
const {
|
|
106
104
|
moduleCache: a,
|
|
107
|
-
pathResolve:
|
|
108
|
-
getFile:
|
|
109
|
-
} =
|
|
110
|
-
refPath:
|
|
111
|
-
relPath:
|
|
112
|
-
},
|
|
105
|
+
pathResolve: v,
|
|
106
|
+
getFile: w
|
|
107
|
+
} = e, [$, ...h] = r.match(/([^!]+!)|[^!]+$/g).reverse(), x = (o, m, p, P) => h.reduce((S, j) => a[j](S, m, p, P), o), n = v({
|
|
108
|
+
refPath: t,
|
|
109
|
+
relPath: $
|
|
110
|
+
}, e), C = h.join("") + n, R = (o) => o.startsWith("@") ? !0 : !o.includes("/") && !o.startsWith(".");
|
|
113
111
|
return {
|
|
114
|
-
id:
|
|
115
|
-
path:
|
|
112
|
+
id: C,
|
|
113
|
+
path: n,
|
|
116
114
|
async getContent() {
|
|
117
|
-
if (
|
|
118
|
-
throw new Error(`Package ${
|
|
115
|
+
if (R(n))
|
|
116
|
+
throw new Error(`Package ${n} not imported`);
|
|
119
117
|
const {
|
|
120
|
-
getContentData:
|
|
121
|
-
type:
|
|
122
|
-
} = await
|
|
118
|
+
getContentData: o,
|
|
119
|
+
type: m
|
|
120
|
+
} = await w(n);
|
|
123
121
|
return {
|
|
124
|
-
getContentData: async (
|
|
125
|
-
type:
|
|
122
|
+
getContentData: async (p) => x(await o(p), n, m, e),
|
|
123
|
+
type: m
|
|
126
124
|
};
|
|
127
125
|
}
|
|
128
126
|
};
|
|
129
127
|
},
|
|
130
|
-
addStyle(
|
|
131
|
-
const
|
|
132
|
-
if (
|
|
128
|
+
addStyle(t) {
|
|
129
|
+
const r = H(t);
|
|
130
|
+
if (f.has(r))
|
|
133
131
|
return;
|
|
134
|
-
|
|
135
|
-
const
|
|
136
|
-
|
|
132
|
+
f.set(r, !0);
|
|
133
|
+
const e = document.createElement("style");
|
|
134
|
+
e.textContent = t, e.setAttribute("data-hash", r), document.head.appendChild(e);
|
|
137
135
|
}
|
|
138
136
|
};
|
|
139
|
-
return () =>
|
|
140
|
-
...
|
|
137
|
+
return () => W(`${s}`, {
|
|
138
|
+
...y
|
|
141
139
|
});
|
|
142
140
|
}
|
|
143
|
-
function
|
|
144
|
-
const
|
|
145
|
-
return
|
|
141
|
+
function l(s, c) {
|
|
142
|
+
const u = new RegExp(`${c}$`);
|
|
143
|
+
return s.replace(u, "");
|
|
146
144
|
}
|
|
147
145
|
export {
|
|
148
|
-
|
|
146
|
+
ut as sfcLoader
|
|
149
147
|
};
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useRoute as
|
|
1
|
+
import { defineComponent as r, defineAsyncComponent as n, createVNode as m } from "vue";
|
|
2
|
+
import { useRoute as p } from "vue-router";
|
|
3
3
|
import "pinia";
|
|
4
4
|
import "lodash-es";
|
|
5
|
-
import { useRouteStore as
|
|
6
|
-
import { sfcLoader as
|
|
7
|
-
const
|
|
5
|
+
import { useRouteStore as u } from "../../../stores/route.js";
|
|
6
|
+
import { sfcLoader as s } from "./loader.js";
|
|
7
|
+
const C = /* @__PURE__ */ r({
|
|
8
8
|
name: "DuxRemoteRender",
|
|
9
|
-
setup(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
loader: c((o = e == null ? void 0 : e.meta) == null ? void 0 : o.path)
|
|
9
|
+
setup(c) {
|
|
10
|
+
const e = p(), o = u().searchRouteName(e.name), t = n({
|
|
11
|
+
loader: s(o?.meta?.path)
|
|
13
12
|
});
|
|
14
|
-
return () =>
|
|
13
|
+
return () => m(t, null, null);
|
|
15
14
|
}
|
|
16
15
|
});
|
|
17
16
|
export {
|
|
18
|
-
|
|
17
|
+
C as DuxRemoteRender
|
|
19
18
|
};
|
|
@@ -24,15 +24,15 @@ const v = /* @__PURE__ */ r({
|
|
|
24
24
|
},
|
|
25
25
|
setup(e) {
|
|
26
26
|
const {
|
|
27
|
-
visible:
|
|
27
|
+
visible: o,
|
|
28
28
|
resolve: s,
|
|
29
|
-
reject:
|
|
29
|
+
reject: n
|
|
30
30
|
} = m({
|
|
31
31
|
duration: e.duration
|
|
32
|
-
}), a =
|
|
33
|
-
a.onConfirm = s, a.onClose =
|
|
32
|
+
}), a = e?.componentProps || {};
|
|
33
|
+
a.onConfirm = s, a.onClose = n;
|
|
34
34
|
const i = u(e.component), c = () => {
|
|
35
|
-
e.maskClosable &&
|
|
35
|
+
e.maskClosable && n();
|
|
36
36
|
};
|
|
37
37
|
return () => t("div", {
|
|
38
38
|
class: "fixed inset-0 flex items-center justify-center overflow-auto",
|
|
@@ -47,7 +47,7 @@ const v = /* @__PURE__ */ r({
|
|
|
47
47
|
leaveFromClass: "opacity-100",
|
|
48
48
|
leaveToClass: "opacity-0"
|
|
49
49
|
}, {
|
|
50
|
-
default: () => [
|
|
50
|
+
default: () => [o.value && e.mask && t("div", {
|
|
51
51
|
class: "fixed inset-0 bg-black bg-opacity-30",
|
|
52
52
|
style: {
|
|
53
53
|
transitionDuration: `${e.duration}ms`
|
|
@@ -62,7 +62,7 @@ const v = /* @__PURE__ */ r({
|
|
|
62
62
|
leaveFromClass: "opacity-100 scale-100",
|
|
63
63
|
leaveToClass: "opacity-0 scale-95"
|
|
64
64
|
}, {
|
|
65
|
-
default: () => [
|
|
65
|
+
default: () => [o.value && t(i, a, null)]
|
|
66
66
|
})]);
|
|
67
67
|
}
|
|
68
68
|
});
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useRoute as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as l, ref as u, onErrorCaptured as a, createVNode as n, createTextVNode as c } from "vue";
|
|
2
|
+
import { useRoute as s } from "vue-router";
|
|
3
|
+
const f = /* @__PURE__ */ l({
|
|
4
4
|
name: "DuxException",
|
|
5
|
-
setup(
|
|
5
|
+
setup(i, {
|
|
6
6
|
slots: t
|
|
7
7
|
}) {
|
|
8
|
-
const
|
|
9
|
-
return
|
|
8
|
+
const e = u(null), r = s();
|
|
9
|
+
return a((o) => (console.error(o), r.name ? e.value = {
|
|
10
10
|
title: "500",
|
|
11
|
-
desc:
|
|
12
|
-
} :
|
|
11
|
+
desc: o?.message || "Internal Server Error"
|
|
12
|
+
} : e.value = {
|
|
13
13
|
title: "404",
|
|
14
14
|
desc: "Page not found"
|
|
15
|
-
}, !1)), () =>
|
|
16
|
-
var e, u, l;
|
|
17
|
-
return n.value ? o("div", null, [o("h1", null, [((e = n.value) == null ? void 0 : e.title) || "Unknown"]), o("p", null, [((u = n.value) == null ? void 0 : u.desc) || "Unknown Description"]), o("p", null, [p("Use config.components.exception to configure the exception layout")])]) : (l = t.default) == null ? void 0 : l.call(t);
|
|
18
|
-
};
|
|
15
|
+
}, !1)), () => e.value ? n("div", null, [n("h1", null, [e.value?.title || "Unknown"]), n("p", null, [e.value?.desc || "Unknown Description"]), n("p", null, [c("Use config.components.exception to configure the exception layout")])]) : t.default?.();
|
|
19
16
|
}
|
|
20
17
|
});
|
|
21
18
|
export {
|
|
22
|
-
|
|
19
|
+
f as DuxException
|
|
23
20
|
};
|