@duxweb/dvha-core 1.0.14 → 1.0.15
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/hooks/json.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/provider/app.cjs +1 -1
- package/dist/cjs/stores/jsonSchema.cjs +1 -0
- package/dist/esm/hooks/json.js +96 -59
- package/dist/esm/index.js +95 -92
- package/dist/esm/provider/app.js +54 -53
- package/dist/esm/stores/jsonSchema.js +43 -0
- package/dist/types/hooks/json.d.ts +8 -2
- package/dist/types/stores/index.d.ts +1 -0
- package/dist/types/stores/jsonSchema.d.ts +27 -0
- package/dist/types/types/config.d.ts +6 -0
- package/dist/types/types/manage.d.ts +6 -0
- package/package.json +1 -1
package/dist/cjs/hooks/json.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 c=require("vue"),q=require("../stores/jsonSchema.cjs"),V=require("./config.cjs"),$=require("./json/index.cjs"),z=require("./json/utils/contextManager.cjs");function T(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function R(e,d){Array.isArray(e)?e.forEach(i=>{const u=i;let f=u.name;!f&&u.__name&&(f=u.__name.replace(/\.(vue|ts|tsx|js|jsx)$/,"").split("/").pop()),f&&d.addComponent(c.markRaw(i),f)}):typeof e=="object"&&e!==null&&Object.entries(e).forEach(([i,u])=>{d.addComponent(c.markRaw(u),i)})}function U(e,d){var u,f;const i=q.useJsonSchemaStore(d);(u=e.jsonSchema)!=null&&u.components&&R(e.jsonSchema.components,i),(f=e.manages)==null||f.forEach(g=>{var b;(b=g.jsonSchema)!=null&&b.components&&R(g.jsonSchema.components,i)})}function k(e){var v;const d=V.useConfig(),i=q.useJsonSchemaStore(),u=[...$.defaultAdaptors,...((v=d.jsonSchema)==null?void 0:v.adaptors)||[],...(e==null?void 0:e.adaptors)||[]];e!=null&&e.components&&R(e.components,i);const f=c.computed(()=>c.isRef(e==null?void 0:e.data)?e==null?void 0:e.data.value:e==null?void 0:e.data);function g(){return(c.isRef(e==null?void 0:e.context)?e==null?void 0:e.context.value:e==null?void 0:e.context)||{}}function b(n){const r={};return Object.entries(n).forEach(([t,a])=>{if(t==="_context")return;const A=t==="modelValue"||t.startsWith("modelValue")||t!=="value"&&(t.includes("model")||t.includes("Model"));r[t]=A&&c.isRef(a)?c.unref(a):a}),r}function C(n,r,t){return typeof n=="string"?n:typeof n=="function"?C(n(r),r,t):Array.isArray(n)?n.flatMap(a=>C(a,r,t)).filter(Boolean):n!=null&&n.tag?l(n,!0,t):n}function E(n,r,t){if(n)return typeof n=="string"?n:Array.isArray(n)?n.flatMap(a=>typeof a=="string"?a:l(a,r,t)).filter(Boolean):l(n,r,t)}function l(n,r=!1,t={}){const{tag:a,attrs:A={},children:N,slots:_}=n,S={...g(),...t};let y={...A};Object.keys(S).length>0&&(y={...y,...z.injectContext({},S)});for(const m of u){const o=m.process(n,y);if(o){if(y=o.props,o.skip)return null;if(o.nodes)return o.nodes.map(h=>{var x;const j=((x=h.attrs)==null?void 0:x._context)||{};return l(h,r,{...S,...j})}).filter(Boolean)}}let s=typeof a=="string"&&(m=>{let o=i.getComponentByName(m);if(o)return o;const h=T(m);if(o=i.getComponentByName(h),o)return o;const j=m.replace(/-([a-z])/g,(x,P)=>P.toUpperCase()).replace(/^[a-z]/,x=>x.toUpperCase());return o=i.getComponentByName(j),o||null})(a)||a;typeof s!="string"&&typeof s=="object"&&(s=c.markRaw(s));const M=typeof s!="string",B=b(y);if(_&&M&&!r){const m={};return Object.entries(_).forEach(([o,h])=>{m[o]=(j={})=>C(h,j,S)}),c.h(s,B,m)}const J=E(N,r,S);return M&&J!==void 0?c.h(s,B,{default:()=>J}):c.h(s,B,J)}const O=c.defineComponent({name:"JsonSchemaRenderer",render(){var n;return((n=f.value)==null?void 0:n.map(r=>l(r)).filter(Boolean))||[]}});function w(n){return c.defineComponent({name:"DynamicJsonSchemaRenderer",render(){var t;const r={...g(),...n.context};return(t=n.data)==null?void 0:t.map(a=>l(a,!1,r)).filter(Boolean)}})}return{render:O,renderAsync:w}}exports.initJsonSchemaComponents=U;exports.useJsonSchema=k;
|
package/dist/cjs/index.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 n=require("./components/auth/can.cjs"),i=require("./components/common/logo.cjs"),a=require("./components/common/icon.cjs"),c=require("./components/loader/iframe.cjs"),d=require("./components/overlay/overlay.cjs"),q=require("./components/status/error.cjs"),p=require("./components/status/exception.cjs"),m=require("./components/status/notAuthorized.cjs"),l=require("./components/status/notFound.cjs"),v=require("./config/color.cjs"),r=require("./hooks/auth.cjs"),x=require("./hooks/config.cjs"),e=require("./hooks/data.cjs"),h=require("./hooks/export.cjs"),D=require("./hooks/exportCsv.cjs"),S=require("./hooks/form.cjs"),C=require("./hooks/formExtend.cjs"),t=require("./hooks/formValidate.cjs"),A=require("./hooks/i18n.cjs"),g=require("./hooks/import.cjs"),T=require("./hooks/importCsv.cjs"),u=require("./hooks/json.cjs"),I=require("./hooks/json/index.cjs"),M=require("./hooks/list.cjs"),L=require("./hooks/manage.cjs"),y=require("./hooks/menu.cjs"),P=require("./hooks/overlay.cjs"),f=require("./hooks/select.cjs"),F=require("./hooks/theme.cjs"),E=require("./hooks/tree.cjs"),U=require("./hooks/upload.cjs"),b=require("./hooks/upload/local.cjs"),O=require("./hooks/upload/s3.cjs"),w=require("./main.cjs"),$=require("./preset/authProvider.cjs"),R=require("./preset/dataProvider.cjs"),V=require("./preset/i18nProvider.cjs"),J=require("./provider/app.cjs"),N=require("./provider/tab.cjs"),j=require("./router/route.cjs"),z=require("./stores/auth.cjs"),k=require("./stores/i18n.cjs"),G=require("./stores/jsonSchema.cjs"),_=require("./stores/manage.cjs"),B=require("./stores/route.cjs"),s=require("./stores/tab.cjs"),H=require("./stores/theme.cjs"),K=require("./utils/bus.cjs"),Q=require("./utils/theme.cjs"),o=require("./utils/tree.cjs"),W=require("./hooks/json/vFor.cjs"),X=require("./hooks/json/vIf.cjs"),Y=require("./hooks/json/vModel.cjs"),Z=require("./hooks/json/vOn.cjs"),ee=require("./hooks/json/vShow.cjs"),re=require("./hooks/json/vText.cjs");exports.DuxCan=n.DuxCan;exports.DuxLogo=i.DuxLogo;exports.DuxLogoIcon=a.DuxLogoIcon;exports.DuxLoaderIframe=c.default;exports.DuxOverlay=d.DuxOverlay;exports.DuxError=q.DuxError;exports.DuxException=p.DuxException;exports.DuxNotAuthorized=m.DuxNotAuthorized;exports.DuxNotFound=l.DuxNotFound;exports.themeColor=v.themeColor;exports.useCan=r.useCan;exports.useCheck=r.useCheck;exports.useError=r.useError;exports.useForgotPassword=r.useForgotPassword;exports.useGetAuth=r.useGetAuth;exports.useIsLogin=r.useIsLogin;exports.useLogin=r.useLogin;exports.useLogout=r.useLogout;exports.useRegister=r.useRegister;exports.useUpdatePassword=r.useUpdatePassword;exports.useConfig=x.useConfig;exports.useClient=e.useClient;exports.useCreate=e.useCreate;exports.useCreateMany=e.useCreateMany;exports.useCustom=e.useCustom;exports.useCustomMutation=e.useCustomMutation;exports.useDelete=e.useDelete;exports.useDeleteMany=e.useDeleteMany;exports.useInfiniteList=e.useInfiniteList;exports.useInvalidate=e.useInvalidate;exports.useList=e.useList;exports.useMany=e.useMany;exports.useOne=e.useOne;exports.useUpdate=e.useUpdate;exports.useUpdateMany=e.useUpdateMany;exports.useExport=h.useExport;exports.useExportCsv=D.useExportCsv;exports.useForm=S.useForm;exports.useExtendForm=C.useExtendForm;exports.initFormValidate=t.initFormValidate;exports.useValidateForm=t.useValidateForm;exports.useI18n=A.useI18n;exports.useImport=g.useImport;exports.useImportCsv=T.useImportCsv;exports.initJsonSchemaComponents=u.initJsonSchemaComponents;exports.useJsonSchema=u.useJsonSchema;exports.defaultAdaptors=I.defaultAdaptors;exports.useExtendList=M.useExtendList;exports.useManage=L.useManage;exports.useMenu=y.useMenu;exports.useOverlay=P.useOverlay;exports.useSelect=f.useSelect;exports.useTheme=F.useTheme;exports.useTree=E.useTree;exports.useUpload=U.useUpload;exports.createLocalUploadDriver=b.createLocalUploadDriver;exports.createS3UploadDriver=O.createS3UploadDriver;exports.createDux=w.createDux;exports.simpleAuthProvider=$.simpleAuthProvider;exports.simpleDataProvider=R.simpleDataProvider;exports.i18nProvider=V.i18nProvider;exports.DuxAppProvider=J.DuxAppProvider;exports.DuxTabRouterView=N.DuxTabRouterView;exports.initRouter=j.initRouter;exports.useAuthStore=z.useAuthStore;exports.useI18nStore=k.useI18nStore;exports.useJsonSchemaStore=G.useJsonSchemaStore;exports.useManageStore=_.useManageStore;exports.useRouteStore=B.useRouteStore;exports.createTabStore=s.createTabStore;exports.useTabStore=s.useTabStore;exports.useThemeStore=H.useThemeStore;exports.emitter=K.emitter;exports.themePreset=Q.themePreset;exports.arrayToTree=o.arrayToTree;exports.searchTree=o.searchTree;exports.treeToArr=o.treeToArr;exports.vForAdaptor=W.vForAdaptor;exports.vIfAdaptor=X.vIfAdaptor;exports.vModelAdaptor=Y.vModelAdaptor;exports.vOnAdaptor=Z.vOnAdaptor;exports.vShowAdaptor=ee.vShowAdaptor;exports.vTextAdaptor=re.vTextAdaptor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("vue"),J=require("@overlastic/vue"),T=require("vue-router"),U=require("../hooks/auth.cjs"),B=require("../hooks/config.cjs");require("@tanstack/vue-query");const G=require("../hooks/manage.cjs");require("json-2-csv");require("lodash-es");require("@vee-validate/rules");require("vee-validate");const H=require("../stores/auth.cjs"),K=require("../stores/i18n.cjs");require("pinia");const Q=require("../stores/manage.cjs"),W=require("../stores/route.cjs");require("@vueuse/core");const X=require("../hooks/json.cjs");require("../hooks/json/index.cjs");require("../utils/bus.cjs");require("colorizr");require("axios");require("clsx");const Y=require("../components/status/error.cjs"),Z=require("../components/status/notAuthorized.cjs"),x=require("../components/status/notFound.cjs"),ee=h.defineComponent({name:"DuxAppProvider",props:{},setup(re,{slots:p}){const f=h.inject("dux.manage"),s=B.useConfig(),m=T.useRouter();return m.beforeEach(async(o,te,a)=>{var P,b,$,A,R,S,M,k,z,D,w,y,C,F;const r=o.meta.manageName,O=o.meta.authorization===!1;if(!r){const e=s.defaultManage||((b=(P=s.manages)==null?void 0:P[0])==null?void 0:b.name)||"";return a({path:`/${e}`,replace:!0})}f&&(f.value=r);const d=Q.useManageStore(r);d.isInit()||d.setConfig(($=s.manages)==null?void 0:$.find(e=>e.name===r),s);const i=W.useRouteStore(r),n=G.useManage(r),l=H.useAuthStore(r),g=K.useI18nStore(r);if((A=n.config)!=null&&A.i18nProvider&&!g.isInit()){const e=g.getLocale();e&&((R=n.config)==null||R.i18nProvider.changeLocale(e))}if(X.initJsonSchemaComponents(s,r),!l.isLogin())return O?a():a({path:n.getRoutePath("login"),replace:!0});const q=e=>e==null?void 0:e.map(u=>({...u,path:u.path?n.getRoutePath(u.path):void 0}));if(!i.getRouteInit()){const e=((S=n.config)==null?void 0:S.components)||{},u=[];if(u.push({name:`${r}.notFound`,label:"404",path:":pathMatch(.*)*",component:e.notFound||x.DuxNotFound,hidden:!0,meta:{can:!1}}),u.push({name:`${r}.notAuthorized`,label:"403",path:"notAuthorized",component:e.notAuthorized||Z.DuxNotAuthorized,hidden:!0,meta:{can:!1}}),u.push({name:`${r}.error`,label:"500",path:"error",component:e.error||Y.DuxError,hidden:!0,meta:{can:!1}}),i.setRoutes(q(((M=n.config)==null?void 0:M.menus)||[])),(k=n.config)!=null&&k.apiRoutePath)try{await((w=(D=(z=n.config)==null?void 0:z.dataProvider)==null?void 0:D.default)==null?void 0:w.custom({path:n.config.apiRoutePath,meta:{timeout:5e3}},n,l.getUser()).then(t=>{i.appendRoutes(q(t.data||[]))}))}catch(t){console.error(t)}return i.appendRoutes(u),i.getRoutes().forEach(t=>{var I,N,E,j;if(!t.path)return;const c={name:t.name,path:t.path,meta:t.meta};switch(t.loader){case"iframe":c.component=((N=(I=n.config)==null?void 0:I.components)==null?void 0:N.iframe)||(()=>Promise.resolve().then(()=>require("../components/loader/iframe.cjs")));break;case"remote":c.component=((j=(E=n.config)==null?void 0:E.components)==null?void 0:j.remote)||(()=>Promise.resolve().then(()=>require("../components/loader/loader.cjs")));break;case"link":c.beforeEnter=()=>{var _;const L=((_=t.meta)==null?void 0:_.url)||t.path;return L&&window.open(L,"_blank"),!1},c.component=()=>Promise.resolve({template:"<div></div>"});break;default:t.component&&(c.component=t.component);break}m.addRoute(`${r}.auth`,c)}),a({path:((y=o.redirectedFrom)==null?void 0:y.path)||o.path,replace:!0})}const v=["","/",`/${r}`,`/${r}/`];if(v.includes(o.path)){const e=i.getIndexRoute();return!(e!=null&&e.path)||v.includes(e==null?void 0:e.path)?(console.warn("[Dux] index route not found, skip redirect"),a()):a({path:(e==null?void 0:e.path)||"/",replace:!0})}const V=U.useCan(r);return(((C=o.meta)==null?void 0:C.can)===void 0||((F=o.meta)==null?void 0:F.can)===!0)&&!V(o.name)?a({name:`${r}.notAuthorized`}):a()}),()=>h.createVNode(J.OverlaysProvider,null,{default:()=>{var o;return[(o=p.default)==null?void 0:o.call(p)]}})}});exports.DuxAppProvider=ee;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("pinia"),a=require("vue");function i(t,e){const o=t.toString?t.toString():String(t);return`${e}-${o.slice(0,32)}`}function l(t){const e=a.inject("dux.manage");if(t||(t=(e==null?void 0:e.value)||""),!t)throw new Error("manage not found");return S(t)()}function S(t){return u.defineStore(`jsonSchema-${t}`,()=>{const e=a.ref(new Map),o=a.ref(new Map);return{componentCache:e,componentsByName:o,addComponent:(n,r,s)=>{const c=i(n,r);return e.value.has(c)||(e.value.set(c,{component:n,name:r,originalName:s||r,cacheKey:c}),o.value.set(r,n)),c},getComponent:n=>{var r;return(r=e.value.get(n))==null?void 0:r.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=l;
|
package/dist/esm/hooks/json.js
CHANGED
|
@@ -1,95 +1,132 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { computed as U, isRef as _, defineComponent as R, markRaw as E, h as v, unref as D } from "vue";
|
|
2
|
+
import { useJsonSchemaStore as z } from "../stores/jsonSchema.js";
|
|
3
|
+
import { useConfig as F } from "./config.js";
|
|
4
|
+
import { defaultAdaptors as G } from "./json/index.js";
|
|
5
|
+
import { injectContext as L } from "./json/utils/contextManager.js";
|
|
6
|
+
function W(e) {
|
|
7
|
+
return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
8
|
+
}
|
|
9
|
+
function J(e, s) {
|
|
10
|
+
Array.isArray(e) ? e.forEach((c) => {
|
|
11
|
+
const f = c;
|
|
12
|
+
let i = f.name;
|
|
13
|
+
!i && f.__name && (i = f.__name.replace(/\.(vue|ts|tsx|js|jsx)$/, "").split("/").pop()), i && s.addComponent(E(c), i);
|
|
14
|
+
}) : typeof e == "object" && e !== null && Object.entries(e).forEach(([c, f]) => {
|
|
15
|
+
s.addComponent(E(f), c);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function X(e, s) {
|
|
19
|
+
var f, i;
|
|
20
|
+
const c = z(s);
|
|
21
|
+
(f = e.jsonSchema) != null && f.components && J(e.jsonSchema.components, c), (i = e.manages) == null || i.forEach((y) => {
|
|
22
|
+
var S;
|
|
23
|
+
(S = y.jsonSchema) != null && S.components && J(y.jsonSchema.components, c);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function Y(e) {
|
|
27
|
+
var M;
|
|
28
|
+
const s = F(), c = z(), f = [...G, ...((M = s.jsonSchema) == null ? void 0 : M.adaptors) || [], ...(e == null ? void 0 : e.adaptors) || []];
|
|
29
|
+
e != null && e.components && J(e.components, c);
|
|
30
|
+
const i = U(() => _(e == null ? void 0 : e.data) ? e == null ? void 0 : e.data.value : e == null ? void 0 : e.data);
|
|
31
|
+
function y() {
|
|
32
|
+
return (_(e == null ? void 0 : e.context) ? e == null ? void 0 : e.context.value : e == null ? void 0 : e.context) || {};
|
|
8
33
|
}
|
|
9
|
-
function
|
|
34
|
+
function S(n) {
|
|
10
35
|
const r = {};
|
|
11
|
-
return Object.entries(
|
|
36
|
+
return Object.entries(n).forEach(([t, a]) => {
|
|
12
37
|
if (t === "_context") return;
|
|
13
|
-
const
|
|
14
|
-
r[t] =
|
|
38
|
+
const A = t === "modelValue" || t.startsWith("modelValue") || t !== "value" && (t.includes("model") || t.includes("Model"));
|
|
39
|
+
r[t] = A && _(a) ? D(a) : a;
|
|
15
40
|
}), r;
|
|
16
41
|
}
|
|
17
|
-
function
|
|
18
|
-
return typeof
|
|
42
|
+
function b(n, r, t) {
|
|
43
|
+
return typeof n == "string" ? n : typeof n == "function" ? b(n(r), r, t) : Array.isArray(n) ? n.flatMap((a) => b(a, r, t)).filter(Boolean) : n != null && n.tag ? d(n, !0, t) : n;
|
|
19
44
|
}
|
|
20
|
-
function
|
|
21
|
-
if (
|
|
22
|
-
return typeof
|
|
45
|
+
function P(n, r, t) {
|
|
46
|
+
if (n)
|
|
47
|
+
return typeof n == "string" ? n : Array.isArray(n) ? n.flatMap((a) => typeof a == "string" ? a : d(a, r, t)).filter(Boolean) : d(n, r, t);
|
|
23
48
|
}
|
|
24
|
-
function
|
|
49
|
+
function d(n, r = !1, t = {}) {
|
|
25
50
|
const {
|
|
26
51
|
tag: a,
|
|
27
|
-
attrs:
|
|
28
|
-
children:
|
|
29
|
-
slots:
|
|
30
|
-
} =
|
|
31
|
-
...
|
|
52
|
+
attrs: A = {},
|
|
53
|
+
children: w,
|
|
54
|
+
slots: N
|
|
55
|
+
} = n, g = {
|
|
56
|
+
...y(),
|
|
32
57
|
...t
|
|
33
58
|
};
|
|
34
|
-
let
|
|
35
|
-
...
|
|
59
|
+
let j = {
|
|
60
|
+
...A
|
|
36
61
|
};
|
|
37
|
-
Object.keys(
|
|
38
|
-
...
|
|
39
|
-
...
|
|
62
|
+
Object.keys(g).length > 0 && (j = {
|
|
63
|
+
...j,
|
|
64
|
+
...L({}, g)
|
|
40
65
|
});
|
|
41
|
-
for (const
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
44
|
-
if (
|
|
45
|
-
if (
|
|
46
|
-
return
|
|
47
|
-
var
|
|
48
|
-
const
|
|
49
|
-
return
|
|
50
|
-
...
|
|
51
|
-
...
|
|
66
|
+
for (const m of f) {
|
|
67
|
+
const o = m.process(n, j);
|
|
68
|
+
if (o) {
|
|
69
|
+
if (j = o.props, o.skip) return null;
|
|
70
|
+
if (o.nodes)
|
|
71
|
+
return o.nodes.map((l) => {
|
|
72
|
+
var x;
|
|
73
|
+
const h = ((x = l.attrs) == null ? void 0 : x._context) || {};
|
|
74
|
+
return d(l, r, {
|
|
75
|
+
...g,
|
|
76
|
+
...h
|
|
52
77
|
});
|
|
53
78
|
}).filter(Boolean);
|
|
54
79
|
}
|
|
55
80
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
81
|
+
let u = typeof a == "string" && ((m) => {
|
|
82
|
+
let o = c.getComponentByName(m);
|
|
83
|
+
if (o)
|
|
84
|
+
return o;
|
|
85
|
+
const l = W(m);
|
|
86
|
+
if (o = c.getComponentByName(l), o)
|
|
87
|
+
return o;
|
|
88
|
+
const h = m.replace(/-([a-z])/g, (x, T) => T.toUpperCase()).replace(/^[a-z]/, (x) => x.toUpperCase());
|
|
89
|
+
return o = c.getComponentByName(h), o || null;
|
|
90
|
+
})(a) || a;
|
|
91
|
+
typeof u != "string" && typeof u == "object" && (u = E(u));
|
|
92
|
+
const O = typeof u != "string", C = S(j);
|
|
93
|
+
if (N && O && !r) {
|
|
94
|
+
const m = {};
|
|
95
|
+
return Object.entries(N).forEach(([o, l]) => {
|
|
96
|
+
m[o] = (h = {}) => b(l, h, g);
|
|
97
|
+
}), v(u, C, m);
|
|
62
98
|
}
|
|
63
|
-
const
|
|
64
|
-
return
|
|
65
|
-
default: () =>
|
|
66
|
-
}) :
|
|
99
|
+
const B = P(w, r, g);
|
|
100
|
+
return O && B !== void 0 ? v(u, C, {
|
|
101
|
+
default: () => B
|
|
102
|
+
}) : v(u, C, B);
|
|
67
103
|
}
|
|
68
|
-
const
|
|
104
|
+
const V = /* @__PURE__ */ R({
|
|
69
105
|
name: "JsonSchemaRenderer",
|
|
70
106
|
render() {
|
|
71
|
-
var
|
|
72
|
-
return ((
|
|
107
|
+
var n;
|
|
108
|
+
return ((n = i.value) == null ? void 0 : n.map((r) => d(r)).filter(Boolean)) || [];
|
|
73
109
|
}
|
|
74
110
|
});
|
|
75
|
-
function
|
|
76
|
-
return /* @__PURE__ */
|
|
111
|
+
function $(n) {
|
|
112
|
+
return /* @__PURE__ */ R({
|
|
77
113
|
name: "DynamicJsonSchemaRenderer",
|
|
78
114
|
render() {
|
|
79
115
|
var t;
|
|
80
116
|
const r = {
|
|
81
|
-
...
|
|
82
|
-
...
|
|
117
|
+
...y(),
|
|
118
|
+
...n.context
|
|
83
119
|
};
|
|
84
|
-
return (t =
|
|
120
|
+
return (t = n.data) == null ? void 0 : t.map((a) => d(a, !1, r)).filter(Boolean);
|
|
85
121
|
}
|
|
86
122
|
});
|
|
87
123
|
}
|
|
88
124
|
return {
|
|
89
|
-
render:
|
|
90
|
-
renderAsync:
|
|
125
|
+
render: V,
|
|
126
|
+
renderAsync: $
|
|
91
127
|
};
|
|
92
128
|
}
|
|
93
129
|
export {
|
|
94
|
-
|
|
130
|
+
X as initJsonSchemaComponents,
|
|
131
|
+
Y as useJsonSchema
|
|
95
132
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -1,138 +1,141 @@
|
|
|
1
|
-
import { DuxCan as
|
|
1
|
+
import { DuxCan as r } from "./components/auth/can.js";
|
|
2
2
|
import { DuxLogo as p } from "./components/common/logo.js";
|
|
3
|
-
import { DuxLogoIcon as
|
|
3
|
+
import { DuxLogoIcon as u } from "./components/common/icon.js";
|
|
4
4
|
import { default as s } from "./components/loader/iframe.js";
|
|
5
5
|
import { DuxOverlay as a } from "./components/overlay/overlay.js";
|
|
6
|
-
import { DuxError as
|
|
6
|
+
import { DuxError as i } from "./components/status/error.js";
|
|
7
7
|
import { DuxException as l } from "./components/status/exception.js";
|
|
8
8
|
import { DuxNotAuthorized as D } from "./components/status/notAuthorized.js";
|
|
9
|
-
import { DuxNotFound as
|
|
10
|
-
import { themeColor as
|
|
9
|
+
import { DuxNotFound as S } from "./components/status/notFound.js";
|
|
10
|
+
import { themeColor as A } from "./config/color.js";
|
|
11
11
|
import { useCan as T, useCheck as g, useError as I, useForgotPassword as L, useGetAuth as M, useIsLogin as y, useLogin as E, useLogout as F, useRegister as P, useUpdatePassword as U } from "./hooks/auth.js";
|
|
12
12
|
import { useConfig as O } from "./hooks/config.js";
|
|
13
|
-
import { useClient as b, useCreate as
|
|
13
|
+
import { useClient as b, useCreate as J, useCreateMany as V, useCustom as N, useCustomMutation as k, useDelete as z, useDeleteMany as G, useInfiniteList as j, useInvalidate as q, useList as B, useMany as H, useOne as K, useUpdate as Q, useUpdateMany as W } from "./hooks/data.js";
|
|
14
14
|
import { useExport as Y } from "./hooks/export.js";
|
|
15
15
|
import { useExportCsv as _ } from "./hooks/exportCsv.js";
|
|
16
16
|
import { useForm as ee } from "./hooks/form.js";
|
|
17
|
-
import { useExtendForm as
|
|
18
|
-
import { initFormValidate as pe, useValidateForm as
|
|
19
|
-
import { useI18n as
|
|
17
|
+
import { useExtendForm as re } from "./hooks/formExtend.js";
|
|
18
|
+
import { initFormValidate as pe, useValidateForm as me } from "./hooks/formValidate.js";
|
|
19
|
+
import { useI18n as xe } from "./hooks/i18n.js";
|
|
20
20
|
import { useImport as fe } from "./hooks/import.js";
|
|
21
|
-
import { useImportCsv as
|
|
22
|
-
import { useJsonSchema as
|
|
23
|
-
import { defaultAdaptors as
|
|
24
|
-
import { useExtendList as
|
|
25
|
-
import { useManage as
|
|
26
|
-
import { useMenu as
|
|
27
|
-
import { useOverlay as
|
|
28
|
-
import { useSelect as
|
|
29
|
-
import { useTheme as
|
|
30
|
-
import { useTree as
|
|
31
|
-
import { useUpload as
|
|
32
|
-
import { createLocalUploadDriver as
|
|
33
|
-
import { createS3UploadDriver as
|
|
21
|
+
import { useImportCsv as ne } from "./hooks/importCsv.js";
|
|
22
|
+
import { initJsonSchemaComponents as de, useJsonSchema as le } from "./hooks/json.js";
|
|
23
|
+
import { defaultAdaptors as De } from "./hooks/json/index.js";
|
|
24
|
+
import { useExtendList as Se } from "./hooks/list.js";
|
|
25
|
+
import { useManage as Ae } from "./hooks/manage.js";
|
|
26
|
+
import { useMenu as Te } from "./hooks/menu.js";
|
|
27
|
+
import { useOverlay as Ie } from "./hooks/overlay.js";
|
|
28
|
+
import { useSelect as Me } from "./hooks/select.js";
|
|
29
|
+
import { useTheme as Ee } from "./hooks/theme.js";
|
|
30
|
+
import { useTree as Pe } from "./hooks/tree.js";
|
|
31
|
+
import { useUpload as we } from "./hooks/upload.js";
|
|
32
|
+
import { createLocalUploadDriver as Re } from "./hooks/upload/local.js";
|
|
33
|
+
import { createS3UploadDriver as Je } from "./hooks/upload/s3.js";
|
|
34
34
|
import { createDux as Ne } from "./main.js";
|
|
35
35
|
import { simpleAuthProvider as ze } from "./preset/authProvider.js";
|
|
36
|
-
import { simpleDataProvider as
|
|
37
|
-
import { i18nProvider as
|
|
38
|
-
import { DuxAppProvider as
|
|
39
|
-
import { DuxTabRouterView as
|
|
40
|
-
import { initRouter as
|
|
41
|
-
import { useAuthStore as
|
|
42
|
-
import { useI18nStore as
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
36
|
+
import { simpleDataProvider as je } from "./preset/dataProvider.js";
|
|
37
|
+
import { i18nProvider as Be } from "./preset/i18nProvider.js";
|
|
38
|
+
import { DuxAppProvider as Ke } from "./provider/app.js";
|
|
39
|
+
import { DuxTabRouterView as We } from "./provider/tab.js";
|
|
40
|
+
import { initRouter as Ye } from "./router/route.js";
|
|
41
|
+
import { useAuthStore as _e } from "./stores/auth.js";
|
|
42
|
+
import { useI18nStore as eo } from "./stores/i18n.js";
|
|
43
|
+
import { useJsonSchemaStore as ro } from "./stores/jsonSchema.js";
|
|
44
|
+
import { useManageStore as po } from "./stores/manage.js";
|
|
45
|
+
import { useRouteStore as uo } from "./stores/route.js";
|
|
46
|
+
import { createTabStore as so, useTabStore as fo } from "./stores/tab.js";
|
|
47
|
+
import { useThemeStore as no } from "./stores/theme.js";
|
|
48
|
+
import { emitter as lo } from "./utils/bus.js";
|
|
49
|
+
import { themePreset as Do } from "./utils/theme.js";
|
|
50
|
+
import { arrayToTree as So, searchTree as co, treeToArr as Ao } from "./utils/tree.js";
|
|
51
|
+
import { vForAdaptor as To } from "./hooks/json/vFor.js";
|
|
52
|
+
import { vIfAdaptor as Io } from "./hooks/json/vIf.js";
|
|
53
|
+
import { vModelAdaptor as Mo } from "./hooks/json/vModel.js";
|
|
54
|
+
import { vOnAdaptor as Eo } from "./hooks/json/vOn.js";
|
|
55
|
+
import { vShowAdaptor as Po } from "./hooks/json/vShow.js";
|
|
56
|
+
import { vTextAdaptor as wo } from "./hooks/json/vText.js";
|
|
56
57
|
export {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
Ke as DuxAppProvider,
|
|
59
|
+
r as DuxCan,
|
|
60
|
+
i as DuxError,
|
|
60
61
|
l as DuxException,
|
|
61
62
|
s as DuxLoaderIframe,
|
|
62
63
|
p as DuxLogo,
|
|
63
|
-
|
|
64
|
+
u as DuxLogoIcon,
|
|
64
65
|
D as DuxNotAuthorized,
|
|
65
|
-
|
|
66
|
+
S as DuxNotFound,
|
|
66
67
|
a as DuxOverlay,
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
We as DuxTabRouterView,
|
|
69
|
+
So as arrayToTree,
|
|
69
70
|
Ne as createDux,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
Re as createLocalUploadDriver,
|
|
72
|
+
Je as createS3UploadDriver,
|
|
73
|
+
so as createTabStore,
|
|
74
|
+
De as defaultAdaptors,
|
|
75
|
+
lo as emitter,
|
|
76
|
+
Be as i18nProvider,
|
|
76
77
|
pe as initFormValidate,
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
de as initJsonSchemaComponents,
|
|
79
|
+
Ye as initRouter,
|
|
80
|
+
co as searchTree,
|
|
79
81
|
ze as simpleAuthProvider,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
je as simpleDataProvider,
|
|
83
|
+
A as themeColor,
|
|
84
|
+
Do as themePreset,
|
|
85
|
+
Ao as treeToArr,
|
|
86
|
+
_e as useAuthStore,
|
|
85
87
|
T as useCan,
|
|
86
88
|
g as useCheck,
|
|
87
89
|
b as useClient,
|
|
88
90
|
O as useConfig,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
J as useCreate,
|
|
92
|
+
V as useCreateMany,
|
|
93
|
+
N as useCustom,
|
|
94
|
+
k as useCustomMutation,
|
|
95
|
+
z as useDelete,
|
|
96
|
+
G as useDeleteMany,
|
|
95
97
|
I as useError,
|
|
96
98
|
Y as useExport,
|
|
97
99
|
_ as useExportCsv,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
+
re as useExtendForm,
|
|
101
|
+
Se as useExtendList,
|
|
100
102
|
L as useForgotPassword,
|
|
101
103
|
ee as useForm,
|
|
102
104
|
M as useGetAuth,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
+
xe as useI18n,
|
|
106
|
+
eo as useI18nStore,
|
|
105
107
|
fe as useImport,
|
|
106
|
-
|
|
108
|
+
ne as useImportCsv,
|
|
107
109
|
j as useInfiniteList,
|
|
108
110
|
q as useInvalidate,
|
|
109
111
|
y as useIsLogin,
|
|
110
|
-
|
|
112
|
+
le as useJsonSchema,
|
|
113
|
+
ro as useJsonSchemaStore,
|
|
111
114
|
B as useList,
|
|
112
115
|
E as useLogin,
|
|
113
116
|
F as useLogout,
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
Ae as useManage,
|
|
118
|
+
po as useManageStore,
|
|
116
119
|
H as useMany,
|
|
117
|
-
|
|
120
|
+
Te as useMenu,
|
|
118
121
|
K as useOne,
|
|
119
|
-
|
|
122
|
+
Ie as useOverlay,
|
|
120
123
|
P as useRegister,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
uo as useRouteStore,
|
|
125
|
+
Me as useSelect,
|
|
126
|
+
fo as useTabStore,
|
|
127
|
+
Ee as useTheme,
|
|
128
|
+
no as useThemeStore,
|
|
129
|
+
Pe as useTree,
|
|
127
130
|
Q as useUpdate,
|
|
128
131
|
W as useUpdateMany,
|
|
129
132
|
U as useUpdatePassword,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
133
|
+
we as useUpload,
|
|
134
|
+
me as useValidateForm,
|
|
135
|
+
To as vForAdaptor,
|
|
136
|
+
Io as vIfAdaptor,
|
|
137
|
+
Mo as vModelAdaptor,
|
|
138
|
+
Eo as vOnAdaptor,
|
|
139
|
+
Po as vShowAdaptor,
|
|
140
|
+
wo as vTextAdaptor
|
|
138
141
|
};
|
package/dist/esm/provider/app.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { OverlaysProvider as
|
|
3
|
-
import { useRouter as
|
|
4
|
-
import { useCan as
|
|
1
|
+
import { defineComponent as U, inject as V, createVNode as q } from "vue";
|
|
2
|
+
import { OverlaysProvider as B } from "@overlastic/vue";
|
|
3
|
+
import { useRouter as G } from "vue-router";
|
|
4
|
+
import { useCan as H } from "../hooks/auth.js";
|
|
5
5
|
import { useConfig as K } from "../hooks/config.js";
|
|
6
6
|
import "@tanstack/vue-query";
|
|
7
7
|
import { useManage as Q } from "../hooks/manage.js";
|
|
@@ -11,45 +11,46 @@ import "@vee-validate/rules";
|
|
|
11
11
|
import "vee-validate";
|
|
12
12
|
import { useAuthStore as T } from "../stores/auth.js";
|
|
13
13
|
import { useI18nStore as W } from "../stores/i18n.js";
|
|
14
|
+
import "pinia";
|
|
14
15
|
import { useManageStore as X } from "../stores/manage.js";
|
|
15
16
|
import { useRouteStore as Y } from "../stores/route.js";
|
|
16
|
-
import "pinia";
|
|
17
17
|
import "@vueuse/core";
|
|
18
|
+
import { initJsonSchemaComponents as Z } from "../hooks/json.js";
|
|
18
19
|
import "../hooks/json/index.js";
|
|
19
20
|
import "../utils/bus.js";
|
|
20
21
|
import "colorizr";
|
|
21
22
|
import "axios";
|
|
22
23
|
import "clsx";
|
|
23
|
-
import { DuxError as
|
|
24
|
-
import { DuxNotAuthorized as
|
|
25
|
-
import { DuxNotFound as
|
|
26
|
-
const
|
|
24
|
+
import { DuxError as x } from "../components/status/error.js";
|
|
25
|
+
import { DuxNotAuthorized as ee } from "../components/status/notAuthorized.js";
|
|
26
|
+
import { DuxNotFound as oe } from "../components/status/notFound.js";
|
|
27
|
+
const Ie = /* @__PURE__ */ U({
|
|
27
28
|
name: "DuxAppProvider",
|
|
28
29
|
props: {},
|
|
29
30
|
setup(te, {
|
|
30
31
|
slots: c
|
|
31
32
|
}) {
|
|
32
|
-
const f =
|
|
33
|
-
return s.beforeEach(async (
|
|
34
|
-
var P, b, R, A, S, $, k, M, z, D, w, I, N
|
|
35
|
-
const
|
|
36
|
-
if (!
|
|
33
|
+
const f = V("dux.manage"), u = K(), s = G();
|
|
34
|
+
return s.beforeEach(async (n, re, a) => {
|
|
35
|
+
var P, b, R, A, S, $, k, M, z, D, w, C, I, N;
|
|
36
|
+
const o = n.meta.manageName, J = n.meta.authorization === !1;
|
|
37
|
+
if (!o) {
|
|
37
38
|
const e = u.defaultManage || ((b = (P = u.manages) == null ? void 0 : P[0]) == null ? void 0 : b.name) || "";
|
|
38
|
-
return
|
|
39
|
+
return a({
|
|
39
40
|
path: `/${e}`,
|
|
40
41
|
replace: !0
|
|
41
42
|
});
|
|
42
43
|
}
|
|
43
|
-
f && (f.value =
|
|
44
|
-
const h = X(
|
|
45
|
-
h.isInit() || h.setConfig((R = u.manages) == null ? void 0 : R.find((e) => e.name ===
|
|
46
|
-
const i = Y(
|
|
44
|
+
f && (f.value = o);
|
|
45
|
+
const h = X(o);
|
|
46
|
+
h.isInit() || h.setConfig((R = u.manages) == null ? void 0 : R.find((e) => e.name === o), u);
|
|
47
|
+
const i = Y(o), r = Q(o), d = T(o), l = W(o);
|
|
47
48
|
if ((A = r.config) != null && A.i18nProvider && !l.isInit()) {
|
|
48
49
|
const e = l.getLocale();
|
|
49
50
|
e && ((S = r.config) == null || S.i18nProvider.changeLocale(e));
|
|
50
51
|
}
|
|
51
|
-
if (!d.isLogin())
|
|
52
|
-
return
|
|
52
|
+
if (Z(u, o), !d.isLogin())
|
|
53
|
+
return J ? a() : a({
|
|
53
54
|
path: r.getRoutePath("login"),
|
|
54
55
|
replace: !0
|
|
55
56
|
});
|
|
@@ -60,28 +61,28 @@ const we = /* @__PURE__ */ V({
|
|
|
60
61
|
if (!i.getRouteInit()) {
|
|
61
62
|
const e = (($ = r.config) == null ? void 0 : $.components) || {}, p = [];
|
|
62
63
|
if (p.push({
|
|
63
|
-
name: `${
|
|
64
|
+
name: `${o}.notFound`,
|
|
64
65
|
label: "404",
|
|
65
66
|
path: ":pathMatch(.*)*",
|
|
66
|
-
component: e.notFound ||
|
|
67
|
+
component: e.notFound || oe,
|
|
67
68
|
hidden: !0,
|
|
68
69
|
meta: {
|
|
69
70
|
can: !1
|
|
70
71
|
}
|
|
71
72
|
}), p.push({
|
|
72
|
-
name: `${
|
|
73
|
+
name: `${o}.notAuthorized`,
|
|
73
74
|
label: "403",
|
|
74
75
|
path: "notAuthorized",
|
|
75
|
-
component: e.notAuthorized ||
|
|
76
|
+
component: e.notAuthorized || ee,
|
|
76
77
|
hidden: !0,
|
|
77
78
|
meta: {
|
|
78
79
|
can: !1
|
|
79
80
|
}
|
|
80
81
|
}), p.push({
|
|
81
|
-
name: `${
|
|
82
|
+
name: `${o}.error`,
|
|
82
83
|
label: "500",
|
|
83
84
|
path: "error",
|
|
84
|
-
component: e.error ||
|
|
85
|
+
component: e.error || x,
|
|
85
86
|
hidden: !0,
|
|
86
87
|
meta: {
|
|
87
88
|
can: !1
|
|
@@ -93,22 +94,22 @@ const we = /* @__PURE__ */ V({
|
|
|
93
94
|
meta: {
|
|
94
95
|
timeout: 5e3
|
|
95
96
|
}
|
|
96
|
-
}, r, d.getUser()).then((
|
|
97
|
-
i.appendRoutes(g(
|
|
97
|
+
}, r, d.getUser()).then((t) => {
|
|
98
|
+
i.appendRoutes(g(t.data || []));
|
|
98
99
|
}));
|
|
99
|
-
} catch (
|
|
100
|
-
console.error(
|
|
100
|
+
} catch (t) {
|
|
101
|
+
console.error(t);
|
|
101
102
|
}
|
|
102
|
-
return i.appendRoutes(p), i.getRoutes().forEach((
|
|
103
|
+
return i.appendRoutes(p), i.getRoutes().forEach((t) => {
|
|
103
104
|
var E, F, y, L;
|
|
104
|
-
if (!
|
|
105
|
+
if (!t.path)
|
|
105
106
|
return;
|
|
106
107
|
const m = {
|
|
107
|
-
name:
|
|
108
|
-
path:
|
|
109
|
-
meta:
|
|
108
|
+
name: t.name,
|
|
109
|
+
path: t.path,
|
|
110
|
+
meta: t.meta
|
|
110
111
|
};
|
|
111
|
-
switch (
|
|
112
|
+
switch (t.loader) {
|
|
112
113
|
case "iframe":
|
|
113
114
|
m.component = ((F = (E = r.config) == null ? void 0 : E.components) == null ? void 0 : F.iframe) || (() => import("../components/loader/iframe.js"));
|
|
114
115
|
break;
|
|
@@ -118,42 +119,42 @@ const we = /* @__PURE__ */ V({
|
|
|
118
119
|
case "link":
|
|
119
120
|
m.beforeEnter = () => {
|
|
120
121
|
var j;
|
|
121
|
-
const _ = ((j =
|
|
122
|
+
const _ = ((j = t.meta) == null ? void 0 : j.url) || t.path;
|
|
122
123
|
return _ && window.open(_, "_blank"), !1;
|
|
123
124
|
}, m.component = () => Promise.resolve({
|
|
124
125
|
template: "<div></div>"
|
|
125
126
|
});
|
|
126
127
|
break;
|
|
127
128
|
default:
|
|
128
|
-
|
|
129
|
+
t.component && (m.component = t.component);
|
|
129
130
|
break;
|
|
130
131
|
}
|
|
131
|
-
s.addRoute(`${
|
|
132
|
-
}),
|
|
133
|
-
path: ((
|
|
132
|
+
s.addRoute(`${o}.auth`, m);
|
|
133
|
+
}), a({
|
|
134
|
+
path: ((C = n.redirectedFrom) == null ? void 0 : C.path) || n.path,
|
|
134
135
|
replace: !0
|
|
135
136
|
});
|
|
136
137
|
}
|
|
137
|
-
const v = ["", "/", `/${
|
|
138
|
-
if (v.includes(
|
|
138
|
+
const v = ["", "/", `/${o}`, `/${o}/`];
|
|
139
|
+
if (v.includes(n.path)) {
|
|
139
140
|
const e = i.getIndexRoute();
|
|
140
|
-
return !(e != null && e.path) || v.includes(e == null ? void 0 : e.path) ? (console.warn("[Dux] index route not found, skip redirect"),
|
|
141
|
+
return !(e != null && e.path) || v.includes(e == null ? void 0 : e.path) ? (console.warn("[Dux] index route not found, skip redirect"), a()) : a({
|
|
141
142
|
path: (e == null ? void 0 : e.path) || "/",
|
|
142
143
|
replace: !0
|
|
143
144
|
});
|
|
144
145
|
}
|
|
145
|
-
const
|
|
146
|
-
return (((
|
|
147
|
-
name: `${
|
|
148
|
-
}) :
|
|
149
|
-
}), () => B
|
|
146
|
+
const O = H(o);
|
|
147
|
+
return (((I = n.meta) == null ? void 0 : I.can) === void 0 || ((N = n.meta) == null ? void 0 : N.can) === !0) && !O(n.name) ? a({
|
|
148
|
+
name: `${o}.notAuthorized`
|
|
149
|
+
}) : a();
|
|
150
|
+
}), () => q(B, null, {
|
|
150
151
|
default: () => {
|
|
151
|
-
var
|
|
152
|
-
return [(
|
|
152
|
+
var n;
|
|
153
|
+
return [(n = c.default) == null ? void 0 : n.call(c)];
|
|
153
154
|
}
|
|
154
155
|
});
|
|
155
156
|
}
|
|
156
157
|
});
|
|
157
158
|
export {
|
|
158
|
-
|
|
159
|
+
Ie as DuxAppProvider
|
|
159
160
|
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { defineStore as u } from "pinia";
|
|
2
|
+
import { inject as i, ref as a } from "vue";
|
|
3
|
+
function h(t, e) {
|
|
4
|
+
const o = t.toString ? t.toString() : String(t);
|
|
5
|
+
return `${e}-${o.slice(0, 32)}`;
|
|
6
|
+
}
|
|
7
|
+
function y(t) {
|
|
8
|
+
const e = i("dux.manage");
|
|
9
|
+
if (t || (t = (e == null ? void 0 : e.value) || ""), !t)
|
|
10
|
+
throw new Error("manage not found");
|
|
11
|
+
return l(t)();
|
|
12
|
+
}
|
|
13
|
+
function l(t) {
|
|
14
|
+
return u(`jsonSchema-${t}`, () => {
|
|
15
|
+
const e = a(/* @__PURE__ */ new Map()), o = a(/* @__PURE__ */ new Map());
|
|
16
|
+
return {
|
|
17
|
+
componentCache: e,
|
|
18
|
+
componentsByName: o,
|
|
19
|
+
addComponent: (n, r, s) => {
|
|
20
|
+
const c = h(n, r);
|
|
21
|
+
return e.value.has(c) || (e.value.set(c, {
|
|
22
|
+
component: n,
|
|
23
|
+
name: r,
|
|
24
|
+
originalName: s || r,
|
|
25
|
+
cacheKey: c
|
|
26
|
+
}), o.value.set(r, n)), c;
|
|
27
|
+
},
|
|
28
|
+
getComponent: (n) => {
|
|
29
|
+
var r;
|
|
30
|
+
return (r = e.value.get(n)) == null ? void 0 : r.component;
|
|
31
|
+
},
|
|
32
|
+
getComponentByName: (n) => o.value.get(n),
|
|
33
|
+
hasComponent: (n) => e.value.has(n),
|
|
34
|
+
clearCache: () => {
|
|
35
|
+
e.value.clear(), o.value.clear();
|
|
36
|
+
},
|
|
37
|
+
getCacheSize: () => e.value.size
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
y as useJsonSchemaStore
|
|
43
|
+
};
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import type { Ref } from 'vue';
|
|
1
|
+
import type { Component, Ref } from 'vue';
|
|
2
|
+
import type { IConfig } from '../types';
|
|
2
3
|
import type { JsonAdaptorOptions, JsonSchemaNode } from './json/index';
|
|
4
|
+
/**
|
|
5
|
+
* 初始化 JSON Schema 组件
|
|
6
|
+
* 在应用启动时调用,将配置中的组件加载到全局缓存
|
|
7
|
+
*/
|
|
8
|
+
export declare function initJsonSchemaComponents(config: IConfig, manageName?: string): void;
|
|
3
9
|
export type JsonSchemaData = JsonSchemaNode[] | Ref<JsonSchemaNode[]>;
|
|
4
10
|
export interface UseJsonSchemaProps extends JsonAdaptorOptions {
|
|
5
11
|
data?: JsonSchemaData;
|
|
6
|
-
components?: Record<string,
|
|
12
|
+
components?: Record<string, Component> | Component[];
|
|
7
13
|
context?: Record<string, any> | Ref<Record<string, any>>;
|
|
8
14
|
}
|
|
9
15
|
/**
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Component, Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* 组件缓存项
|
|
4
|
+
*/
|
|
5
|
+
interface ComponentCacheItem {
|
|
6
|
+
component: Component;
|
|
7
|
+
name: string;
|
|
8
|
+
originalName: string;
|
|
9
|
+
cacheKey: string;
|
|
10
|
+
}
|
|
11
|
+
export interface JsonSchemaStoreState {
|
|
12
|
+
componentCache: Ref<Map<string, ComponentCacheItem>>;
|
|
13
|
+
componentsByName: Ref<Map<string, Component>>;
|
|
14
|
+
addComponent: (component: Component, name: string, originalName?: string) => string;
|
|
15
|
+
getComponent: (key: string) => Component | undefined;
|
|
16
|
+
getComponentByName: (name: string) => Component | undefined;
|
|
17
|
+
hasComponent: (key: string) => boolean;
|
|
18
|
+
clearCache: () => void;
|
|
19
|
+
getCacheSize: () => number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* use json schema store
|
|
23
|
+
* @param manageName manage name
|
|
24
|
+
* @returns json schema store
|
|
25
|
+
*/
|
|
26
|
+
export declare function useJsonSchemaStore(manageName?: string): import("pinia").Store<string, Pick<JsonSchemaStoreState, "componentCache" | "componentsByName">, Pick<JsonSchemaStoreState, never>, Pick<JsonSchemaStoreState, "addComponent" | "getComponent" | "getComponentByName" | "hasComponent" | "clearCache" | "getCacheSize">>;
|
|
27
|
+
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { Component } from 'vue';
|
|
1
2
|
import type { Options } from 'vue3-sfc-loader';
|
|
2
3
|
import type { RouteComponent, RouteRecordRaw } from 'vue-router';
|
|
4
|
+
import type { IJsonAdaptor } from '../hooks';
|
|
3
5
|
import type { IAuthProvider } from './auth';
|
|
4
6
|
import type { IDataProvider } from './data';
|
|
5
7
|
import type { I18nProvider } from './i18n';
|
|
@@ -27,6 +29,10 @@ export interface IConfig {
|
|
|
27
29
|
apiMethod?: string;
|
|
28
30
|
apiRoutePath?: string | ((path: string) => string);
|
|
29
31
|
};
|
|
32
|
+
jsonSchema?: {
|
|
33
|
+
adaptors?: IJsonAdaptor[];
|
|
34
|
+
components?: Record<string, Component> | Component[];
|
|
35
|
+
};
|
|
30
36
|
[key: string]: any;
|
|
31
37
|
}
|
|
32
38
|
export interface IConfigComponent {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { Component } from 'vue';
|
|
1
2
|
import type { Options } from 'vue3-sfc-loader';
|
|
2
3
|
import type { RouteRecordRaw } from 'vue-router';
|
|
4
|
+
import type { IJsonAdaptor } from '../hooks';
|
|
3
5
|
import type { IAuthProvider } from './auth';
|
|
4
6
|
import type { IConfigComponent } from './config';
|
|
5
7
|
import type { IDataProvider } from './data';
|
|
@@ -32,5 +34,9 @@ export interface IManage {
|
|
|
32
34
|
apiMethod?: string;
|
|
33
35
|
apiRoutePath?: string | ((path: string) => string);
|
|
34
36
|
};
|
|
37
|
+
jsonSchema?: {
|
|
38
|
+
adaptors?: IJsonAdaptor[];
|
|
39
|
+
components?: Record<string, Component> | Component[];
|
|
40
|
+
};
|
|
35
41
|
[key: string]: any;
|
|
36
42
|
}
|