@duxweb/dvha-core 1.0.14 → 1.0.16

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("vue"),q=require("./json/index.cjs"),E=require("./json/utils/contextManager.cjs");function T(n){const R=(n==null?void 0:n.adaptors)||q.defaultAdaptors,h=(n==null?void 0:n.components)||{},v=u.computed(()=>u.isRef(n==null?void 0:n.data)?n==null?void 0:n.data.value:n==null?void 0:n.data);function A(){return(u.isRef(n==null?void 0:n.context)?n==null?void 0:n.context.value:n==null?void 0:n.context)||{}}function J(e){const r={};return Object.entries(e).forEach(([t,a])=>{if(t==="_context")return;const g=t==="modelValue"||t.startsWith("modelValue")||t!=="value"&&(t.includes("model")||t.includes("Model"));r[t]=g&&u.isRef(a)?u.unref(a):a}),r}function l(e,r,t){return typeof e=="string"?e:typeof e=="function"?l(e(r),r,t):Array.isArray(e)?e.flatMap(a=>l(a,r,t)).filter(Boolean):e!=null&&e.tag?i(e,!0,t):e}function O(e,r,t){if(e)return typeof e=="string"?e:Array.isArray(e)?e.flatMap(a=>typeof a=="string"?a:i(a,r,t)).filter(Boolean):i(e,r,t)}function i(e,r=!1,t={}){const{tag:a,attrs:g={},children:V,slots:M}=e,f={...A(),...t};let d={...g};Object.keys(f).length>0&&(d={...d,...E.injectContext({},f)});for(const s of R){const c=s.process(e,d);if(c){if(d=c.props,c.skip)return null;if(c.nodes)return c.nodes.map(m=>{var B;const b=((B=m.attrs)==null?void 0:B._context)||{};return i(m,r,{...f,...b})}).filter(Boolean)}}const o=typeof a=="string"&&h[a]?h[a]:a,j=typeof o!="string",x=J(d);if(M&&j&&!r){const s={};return Object.entries(M).forEach(([c,m])=>{s[c]=(b={})=>l(m,b,f)}),u.h(o,x,s)}const y=O(V,r,f);return j&&y!==void 0?u.h(o,x,{default:()=>y}):u.h(o,x,y)}const P=u.defineComponent({name:"JsonSchemaRenderer",render(){var e;return((e=v.value)==null?void 0:e.map(r=>i(r)).filter(Boolean))||[]}});function S(e){return u.defineComponent({name:"DynamicJsonSchemaRenderer",render(){var t;const r={...A(),...e.context};return(t=e.data)==null?void 0:t.map(a=>i(a,!1,r)).filter(Boolean)}})}return{render:P,renderAsync:S}}exports.useJsonSchema=T;
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;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("lodash-es"),a=require("vue"),h=require("vue-router");require("pinia");const p=require("../stores/manage.cjs");function q(u){const o=a.inject("dux.manage");if(u||(u=o==null?void 0:o.value),!u)throw new Error("manage name is not defined");const{config:t}=p.useManageStore(u),f=e=>`${t==null?void 0:t.routePrefix}/${s.trimStart(e||"","/")}`,l=(e,n)=>{var i,c;const r=(i=t==null?void 0:t.dataProvider)==null?void 0:i[n||"default"];return((c=r==null?void 0:r.apiUrl)==null?void 0:c.call(r,e))||""},g=h.useRoute();return{config:t,getRoutePath:f,getApiUrl:l,getPath:()=>{const e=g.path,n=(t==null?void 0:t.routePrefix)||"";return s.trimStart(e.replace(n,""),"/")}}}exports.useManage=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("lodash-es"),p=require("vue"),a=require("vue-router");require("pinia");const g=require("../stores/manage.cjs");function P(u){const o=p.inject("dux.manage");if(u||(u=o==null?void 0:o.value),!u)throw new Error("manage name is not defined");const{config:t}=g.useManageStore(u),f=e=>`${t==null?void 0:t.routePrefix}/${c.trimStart(e||"","/")}`,l=(e,n)=>{var i,s;const r=(i=t==null?void 0:t.dataProvider)==null?void 0:i[n||"default"];return((s=r==null?void 0:r.apiUrl)==null?void 0:s.call(r,e,t==null?void 0:t.apiBasePath))||""},h=a.useRoute();return{config:t,getRoutePath:f,getApiUrl:l,getPath:()=>{const e=h.path,n=(t==null?void 0:t.routePrefix)||"";return c.trimStart(e.replace(n,""),"/")}}}exports.useManage=P;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./components/auth/can.cjs"),i=require("./components/common/logo.cjs"),n=require("./components/common/icon.cjs"),a=require("./components/loader/iframe.cjs"),c=require("./components/overlay/overlay.cjs"),d=require("./components/status/error.cjs"),q=require("./components/status/exception.cjs"),p=require("./components/status/notAuthorized.cjs"),l=require("./components/status/notFound.cjs"),v=require("./config/color.cjs"),r=require("./hooks/auth.cjs"),m=require("./hooks/config.cjs"),e=require("./hooks/data.cjs"),x=require("./hooks/export.cjs"),D=require("./hooks/exportCsv.cjs"),h=require("./hooks/form.cjs"),A=require("./hooks/formExtend.cjs"),o=require("./hooks/formValidate.cjs"),g=require("./hooks/i18n.cjs"),C=require("./hooks/import.cjs"),S=require("./hooks/importCsv.cjs"),T=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"),N=require("./provider/app.cjs"),z=require("./provider/tab.cjs"),j=require("./router/route.cjs"),k=require("./stores/auth.cjs"),G=require("./stores/i18n.cjs"),J=require("./stores/manage.cjs"),_=require("./stores/route.cjs"),u=require("./stores/tab.cjs"),B=require("./stores/theme.cjs"),H=require("./utils/bus.cjs"),K=require("./utils/theme.cjs"),t=require("./utils/tree.cjs"),Q=require("./hooks/json/vFor.cjs"),W=require("./hooks/json/vIf.cjs"),X=require("./hooks/json/vModel.cjs"),Y=require("./hooks/json/vOn.cjs"),Z=require("./hooks/json/vShow.cjs"),ee=require("./hooks/json/vText.cjs");exports.DuxCan=s.DuxCan;exports.DuxLogo=i.DuxLogo;exports.DuxLogoIcon=n.DuxLogoIcon;exports.DuxLoaderIframe=a.default;exports.DuxOverlay=c.DuxOverlay;exports.DuxError=d.DuxError;exports.DuxException=q.DuxException;exports.DuxNotAuthorized=p.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=m.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=x.useExport;exports.useExportCsv=D.useExportCsv;exports.useForm=h.useForm;exports.useExtendForm=A.useExtendForm;exports.initFormValidate=o.initFormValidate;exports.useValidateForm=o.useValidateForm;exports.useI18n=g.useI18n;exports.useImport=C.useImport;exports.useImportCsv=S.useImportCsv;exports.useJsonSchema=T.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=N.DuxAppProvider;exports.DuxTabRouterView=z.DuxTabRouterView;exports.initRouter=j.initRouter;exports.useAuthStore=k.useAuthStore;exports.useI18nStore=G.useI18nStore;exports.useManageStore=J.useManageStore;exports.useRouteStore=_.useRouteStore;exports.createTabStore=u.createTabStore;exports.useTabStore=u.useTabStore;exports.useThemeStore=B.useThemeStore;exports.emitter=H.emitter;exports.themePreset=K.themePreset;exports.arrayToTree=t.arrayToTree;exports.searchTree=t.searchTree;exports.treeToArr=t.treeToArr;exports.vForAdaptor=Q.vForAdaptor;exports.vIfAdaptor=W.vIfAdaptor;exports.vModelAdaptor=X.vModelAdaptor;exports.vOnAdaptor=Y.vOnAdaptor;exports.vShowAdaptor=Z.vShowAdaptor;exports.vTextAdaptor=ee.vTextAdaptor;
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 n=require("axios"),h=require("lodash-es");function s(l){const d=a=>a?`${l.apiUrl}/${h.trimStart(a||"","/")}`:l.apiUrl;return{apiUrl:d,getList:(a,r,t)=>{const e={};return a.pagination&&typeof a.pagination=="object"&&(e.page=a.pagination.page,e.pageSize=a.pagination.pageSize),n.get(d(a.path)||"",{params:{...e,...a.filters,...a.sorters},headers:{Authorization:t==null?void 0:t.token},...a.meta}).then(c=>l.successCallback?l.successCallback(c):k(c)).catch(c=>{throw l.errorCallback?l.errorCallback(c):b(c)})},create:(a,r,t)=>n.post(d(a.path)||"",a.data,{headers:{Authorization:t==null?void 0:t.token},...a.meta}).then(e=>l.successCallback?l.successCallback(e):k(e)).catch(e=>{throw l.errorCallback?l.errorCallback(e):b(e)}),update:(a,r,t)=>n.put(d(a.id?`${a.path}/${a.id}`:a.path)||"",a.data,{headers:{Authorization:t==null?void 0:t.token},...a.meta}).then(e=>l.successCallback?l.successCallback(e):k(e)).catch(e=>{throw l.errorCallback?l.errorCallback(e):b(e)}),deleteOne:(a,r,t)=>n.delete(d(a.id?`${a.path}/${a.id}`:a.path)||"",{headers:{Authorization:t==null?void 0:t.token},...a.meta}).then(e=>l.successCallback?l.successCallback(e):k(e)).catch(e=>{throw l.errorCallback?l.errorCallback(e):b(e)}),getOne:(a,r,t)=>n.get(d(a.id?`${a.path}/${a.id}`:a.path)||"",{headers:{Authorization:t==null?void 0:t.token},...a.meta}).then(e=>l.successCallback?l.successCallback(e):k(e)).catch(e=>{throw l.errorCallback?l.errorCallback(e):b(e)}),getMany:(a,r,t)=>n.get(d(a.path)||"",{params:{ids:a.ids},headers:{Authorization:t==null?void 0:t.token},...a.meta}).then(e=>l.successCallback?l.successCallback(e):k(e)).catch(e=>{throw l.errorCallback?l.errorCallback(e):b(e)}),createMany:(a,r,t)=>n.post(d(a.path)||"",a.data,{headers:{Authorization:t==null?void 0:t.token},...a.meta}).then(e=>l.successCallback?l.successCallback(e):k(e)).catch(e=>{throw l.errorCallback?l.errorCallback(e):b(e)}),updateMany:(a,r,t)=>n.put(d(a.path)||"",{ids:a.ids,data:a.data},{headers:{Authorization:t==null?void 0:t.token},...a.meta}).then(e=>l.successCallback?l.successCallback(e):k(e)).catch(e=>{throw l.errorCallback?l.errorCallback(e):b(e)}),deleteMany:(a,r,t)=>n.delete(d(a.path)||"",{params:{ids:a.ids},headers:{Authorization:t==null?void 0:t.token},...a.meta}).then(e=>l.successCallback?l.successCallback(e):k(e)).catch(e=>{throw l.errorCallback?l.errorCallback(e):b(e)}),custom:(a,r,t)=>{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}),n.request({url:d(a.path||""),method:a.method||"GET",data:a.payload,params:e,signal:a.signal,headers:{Authorization:t==null?void 0:t.token,...a.headers},onUploadProgress:c=>{var m;const C=Math.round(c.loaded*100/(c.total||1));(m=a.onUploadProgress)==null||m.call(a,{loaded:c.loaded,total:c.total,percent:C})},onDownloadProgress:c=>{var m;const C=Math.round(c.loaded*100/(c.total||1));(m=a.onDownloadProgress)==null||m.call(a,{loaded:c.loaded,total:c.total,percent:C})},...a.meta}).then(c=>l.successCallback?l.successCallback(c):k(c)).catch(c=>{throw l.errorCallback?l.errorCallback(c):b(c)})},getTotal:a=>{var r;return l.getTotal?l.getTotal(a):((r=a.meta)==null?void 0:r.total)||0}}}function k(l){var d,a,r;return{message:(d=l.data)==null?void 0:d.message,data:(a=l.data)==null?void 0:a.data,meta:(r=l.data)==null?void 0:r.meta,raw:l.data}}function b(l){var d,a,r,t,e,c,C,m,u,g;return{message:((a=(d=l.response)==null?void 0:d.data)==null?void 0:a.message)||(l==null?void 0:l.message),data:(t=(r=l.response)==null?void 0:r.data)==null?void 0:t.data,meta:(c=(e=l.response)==null?void 0:e.data)==null?void 0:c.meta,status:((m=(C=l.response)==null?void 0:C.data)==null?void 0:m.code)||((u=l.response)==null?void 0:u.status)||500,raw:(g=l.response)==null?void 0:g.data}}exports.simpleDataProvider=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("axios"),s=require("lodash-es");function P(c){const d=(a,t)=>{const l=`${s.trim(c.apiUrl,"/")}${t?`/${s.trim(t,"/")}`:""}`;return a?`${l}/${s.trim(a||"","/")}`:l};return{apiUrl:d,getList:(a,t,l)=>{const e={};return a.pagination&&typeof a.pagination=="object"&&(e.page=a.pagination.page,e.pageSize=a.pagination.pageSize),k.get(d(a.path,t==null?void 0:t.config.apiBasePath)||"",{params:{...e,...a.filters,...a.sorters},headers:{Authorization:l==null?void 0:l.token},...a.meta}).then(r=>c.successCallback?c.successCallback(r):b(r)).catch(r=>{throw c.errorCallback?c.errorCallback(r):C(r)})},create:(a,t,l)=>k.post(d(a.path,t==null?void 0:t.config.apiBasePath)||"",a.data,{headers:{Authorization:l==null?void 0:l.token},...a.meta}).then(e=>c.successCallback?c.successCallback(e):b(e)).catch(e=>{throw c.errorCallback?c.errorCallback(e):C(e)}),update:(a,t,l)=>k.put(d(a.id?`${a.path}/${a.id}`:a.path,t==null?void 0:t.config.apiBasePath)||"",a.data,{headers:{Authorization:l==null?void 0:l.token},...a.meta}).then(e=>c.successCallback?c.successCallback(e):b(e)).catch(e=>{throw c.errorCallback?c.errorCallback(e):C(e)}),deleteOne:(a,t,l)=>k.delete(d(a.id?`${a.path}/${a.id}`:a.path,t==null?void 0:t.config.apiBasePath)||"",{headers:{Authorization:l==null?void 0:l.token},...a.meta}).then(e=>c.successCallback?c.successCallback(e):b(e)).catch(e=>{throw c.errorCallback?c.errorCallback(e):C(e)}),getOne:(a,t,l)=>k.get(d(a.id?`${a.path}/${a.id}`:a.path,t==null?void 0:t.config.apiBasePath)||"",{headers:{Authorization:l==null?void 0:l.token},...a.meta}).then(e=>c.successCallback?c.successCallback(e):b(e)).catch(e=>{throw c.errorCallback?c.errorCallback(e):C(e)}),getMany:(a,t,l)=>k.get(d(a.path,t==null?void 0:t.config.apiBasePath)||"",{params:{ids:a.ids},headers:{Authorization:l==null?void 0:l.token},...a.meta}).then(e=>c.successCallback?c.successCallback(e):b(e)).catch(e=>{throw c.errorCallback?c.errorCallback(e):C(e)}),createMany:(a,t,l)=>k.post(d(a.path,t==null?void 0:t.config.apiBasePath)||"",a.data,{headers:{Authorization:l==null?void 0:l.token},...a.meta}).then(e=>c.successCallback?c.successCallback(e):b(e)).catch(e=>{throw c.errorCallback?c.errorCallback(e):C(e)}),updateMany:(a,t,l)=>k.put(d(a.path,t==null?void 0:t.config.apiBasePath)||"",{ids:a.ids,data:a.data},{headers:{Authorization:l==null?void 0:l.token},...a.meta}).then(e=>c.successCallback?c.successCallback(e):b(e)).catch(e=>{throw c.errorCallback?c.errorCallback(e):C(e)}),deleteMany:(a,t,l)=>k.delete(d(a.path,t==null?void 0:t.config.apiBasePath)||"",{params:{ids:a.ids},headers:{Authorization:l==null?void 0:l.token},...a.meta}).then(e=>c.successCallback?c.successCallback(e):b(e)).catch(e=>{throw c.errorCallback?c.errorCallback(e):C(e)}),custom:(a,t,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}),k.request({url:d(a.path,t==null?void 0:t.config.apiBasePath)||"",method:a.method||"GET",data:a.payload,params:e,signal:a.signal,headers:{Authorization:l==null?void 0:l.token,...a.headers},onUploadProgress:r=>{var h;const i=Math.round(r.loaded*100/(r.total||1));(h=a.onUploadProgress)==null||h.call(a,{loaded:r.loaded,total:r.total,percent:i})},onDownloadProgress:r=>{var h;const i=Math.round(r.loaded*100/(r.total||1));(h=a.onDownloadProgress)==null||h.call(a,{loaded:r.loaded,total:r.total,percent:i})},...a.meta}).then(r=>c.successCallback?c.successCallback(r):b(r)).catch(r=>{throw c.errorCallback?c.errorCallback(r):C(r)})},getTotal:a=>{var t;return c.getTotal?c.getTotal(a):((t=a.meta)==null?void 0:t.total)||0}}}function b(c){var d,a,t;return{message:(d=c.data)==null?void 0:d.message,data:(a=c.data)==null?void 0:a.data,meta:(t=c.data)==null?void 0:t.meta,raw:c.data}}function C(c){var d,a,t,l,e,r,i,h,u,f;return{message:((a=(d=c.response)==null?void 0:d.data)==null?void 0:a.message)||(c==null?void 0:c.message),data:(l=(t=c.response)==null?void 0:t.data)==null?void 0:l.data,meta:(r=(e=c.response)==null?void 0:e.data)==null?void 0:r.meta,status:((h=(i=c.response)==null?void 0:i.data)==null?void 0:h.code)||((u=c.response)==null?void 0:u.status)||500,raw:(f=c.response)==null?void 0:f.data}}exports.simpleDataProvider=P;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("vue"),T=require("@overlastic/vue"),U=require("vue-router"),B=require("../hooks/auth.cjs"),G=require("../hooks/config.cjs");require("@tanstack/vue-query");const H=require("../hooks/manage.cjs");require("json-2-csv");require("lodash-es");require("@vee-validate/rules");require("vee-validate");const J=require("../stores/auth.cjs"),K=require("../stores/i18n.cjs"),Q=require("../stores/manage.cjs"),W=require("../stores/route.cjs");require("pinia");require("@vueuse/core");require("../hooks/json/index.cjs");require("../utils/bus.cjs");require("colorizr");require("axios");require("clsx");const X=require("../components/status/error.cjs"),Y=require("../components/status/notAuthorized.cjs"),Z=require("../components/status/notFound.cjs"),x=h.defineComponent({name:"DuxAppProvider",props:{},setup(ee,{slots:p}){const f=h.inject("dux.manage"),s=G.useConfig(),d=U.useRouter();return d.beforeEach(async(o,re,a)=>{var P,b,$,A,R,S,M,k,z,D,w,y,F,I;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 m=Q.useManageStore(r);m.isInit()||m.setConfig(($=s.manages)==null?void 0:$.find(e=>e.name===r),s);const i=W.useRouteStore(r),n=H.useManage(r),l=J.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(!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||Z.DuxNotFound,hidden:!0,meta:{can:!1}}),u.push({name:`${r}.notAuthorized`,label:"403",path:"notAuthorized",component:e.notAuthorized||Y.DuxNotAuthorized,hidden:!0,meta:{can:!1}}),u.push({name:`${r}.error`,label:"500",path:"error",component:e.error||X.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 N,C,E,L;if(!t.path)return;const c={name:t.name,path:t.path,meta:t.meta};switch(t.loader){case"iframe":c.component=((C=(N=n.config)==null?void 0:N.components)==null?void 0:C.iframe)||(()=>Promise.resolve().then(()=>require("../components/loader/iframe.cjs")));break;case"remote":c.component=((L=(E=n.config)==null?void 0:E.components)==null?void 0:L.remote)||(()=>Promise.resolve().then(()=>require("../components/loader/loader.cjs")));break;case"link":c.beforeEnter=()=>{var j;const _=((j=t.meta)==null?void 0:j.url)||t.path;return _&&window.open(_,"_blank"),!1},c.component=()=>Promise.resolve({template:"<div></div>"});break;default:t.component&&(c.component=t.component);break}d.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=B.useCan(r);return(((F=o.meta)==null?void 0:F.can)===void 0||((I=o.meta)==null?void 0:I.can)===!0)&&!V(o.name)?a({name:`${r}.notAuthorized`}):a()}),()=>h.createVNode(T.OverlaysProvider,null,{default:()=>{var o;return[(o=p.default)==null?void 0:o.call(p)]}})}});exports.DuxAppProvider=x;
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;
@@ -1,95 +1,132 @@
1
- import { computed as F, isRef as A, defineComponent as J, h as B, unref as G } from "vue";
2
- import { defaultAdaptors as N } from "./json/index.js";
3
- import { injectContext as S } from "./json/utils/contextManager.js";
4
- function w(n) {
5
- const O = (n == null ? void 0 : n.adaptors) || N, b = (n == null ? void 0 : n.components) || {}, P = F(() => A(n == null ? void 0 : n.data) ? n == null ? void 0 : n.data.value : n == null ? void 0 : n.data);
6
- function j() {
7
- return (A(n == null ? void 0 : n.context) ? n == null ? void 0 : n.context.value : n == null ? void 0 : n.context) || {};
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 R(e) {
34
+ function S(n) {
10
35
  const r = {};
11
- return Object.entries(e).forEach(([t, a]) => {
36
+ return Object.entries(n).forEach(([t, a]) => {
12
37
  if (t === "_context") return;
13
- const l = t === "modelValue" || t.startsWith("modelValue") || t !== "value" && (t.includes("model") || t.includes("Model"));
14
- r[t] = l && A(a) ? G(a) : a;
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 s(e, r, t) {
18
- return typeof e == "string" ? e : typeof e == "function" ? s(e(r), r, t) : Array.isArray(e) ? e.flatMap((a) => s(a, r, t)).filter(Boolean) : e != null && e.tag ? c(e, !0, t) : e;
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 V(e, r, t) {
21
- if (e)
22
- return typeof e == "string" ? e : Array.isArray(e) ? e.flatMap((a) => typeof a == "string" ? a : c(a, r, t)).filter(Boolean) : c(e, r, t);
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 c(e, r = !1, t = {}) {
49
+ function d(n, r = !1, t = {}) {
25
50
  const {
26
51
  tag: a,
27
- attrs: l = {},
28
- children: D,
29
- slots: M
30
- } = e, u = {
31
- ...j(),
52
+ attrs: A = {},
53
+ children: w,
54
+ slots: N
55
+ } = n, g = {
56
+ ...y(),
32
57
  ...t
33
58
  };
34
- let i = {
35
- ...l
59
+ let j = {
60
+ ...A
36
61
  };
37
- Object.keys(u).length > 0 && (i = {
38
- ...i,
39
- ...S({}, u)
62
+ Object.keys(g).length > 0 && (j = {
63
+ ...j,
64
+ ...L({}, g)
40
65
  });
41
- for (const o of O) {
42
- const f = o.process(e, i);
43
- if (f) {
44
- if (i = f.props, f.skip) return null;
45
- if (f.nodes)
46
- return f.nodes.map((m) => {
47
- var v;
48
- const y = ((v = m.attrs) == null ? void 0 : v._context) || {};
49
- return c(m, r, {
50
- ...u,
51
- ...y
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
- const d = typeof a == "string" && b[a] ? b[a] : a, h = typeof d != "string", g = R(i);
57
- if (M && h && !r) {
58
- const o = {};
59
- return Object.entries(M).forEach(([f, m]) => {
60
- o[f] = (y = {}) => s(m, y, u);
61
- }), B(d, g, o);
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 x = V(D, r, u);
64
- return h && x !== void 0 ? B(d, g, {
65
- default: () => x
66
- }) : B(d, g, x);
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 E = /* @__PURE__ */ J({
104
+ const V = /* @__PURE__ */ R({
69
105
  name: "JsonSchemaRenderer",
70
106
  render() {
71
- var e;
72
- return ((e = P.value) == null ? void 0 : e.map((r) => c(r)).filter(Boolean)) || [];
107
+ var n;
108
+ return ((n = i.value) == null ? void 0 : n.map((r) => d(r)).filter(Boolean)) || [];
73
109
  }
74
110
  });
75
- function _(e) {
76
- return /* @__PURE__ */ J({
111
+ function $(n) {
112
+ return /* @__PURE__ */ R({
77
113
  name: "DynamicJsonSchemaRenderer",
78
114
  render() {
79
115
  var t;
80
116
  const r = {
81
- ...j(),
82
- ...e.context
117
+ ...y(),
118
+ ...n.context
83
119
  };
84
- return (t = e.data) == null ? void 0 : t.map((a) => c(a, !1, r)).filter(Boolean);
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: E,
90
- renderAsync: _
125
+ render: V,
126
+ renderAsync: $
91
127
  };
92
128
  }
93
129
  export {
94
- w as useJsonSchema
130
+ X as initJsonSchemaComponents,
131
+ Y as useJsonSchema
95
132
  };
@@ -1,24 +1,24 @@
1
1
  import { trimStart as f } from "lodash-es";
2
- import { inject as h } from "vue";
2
+ import { inject as l } from "vue";
3
3
  import { useRoute as x } from "vue-router";
4
4
  import "pinia";
5
- import { useManageStore as g } from "../stores/manage.js";
5
+ import { useManageStore as P } from "../stores/manage.js";
6
6
  function $(e) {
7
- const i = h("dux.manage");
7
+ const i = l("dux.manage");
8
8
  if (e || (e = i == null ? void 0 : i.value), !e)
9
9
  throw new Error("manage name is not defined");
10
- const { config: t } = g(e), s = (r) => `${t == null ? void 0 : t.routePrefix}/${f(r || "", "/")}`, p = (r, n) => {
11
- var u, c;
12
- const o = (u = t == null ? void 0 : t.dataProvider) == null ? void 0 : u[n || "default"];
13
- return ((c = o == null ? void 0 : o.apiUrl) == null ? void 0 : c.call(o, r)) || "";
14
- }, l = x();
10
+ const { config: t } = P(e), s = (r) => `${t == null ? void 0 : t.routePrefix}/${f(r || "", "/")}`, p = (r, u) => {
11
+ var n, c;
12
+ const o = (n = t == null ? void 0 : t.dataProvider) == null ? void 0 : n[u || "default"];
13
+ return ((c = o == null ? void 0 : o.apiUrl) == null ? void 0 : c.call(o, r, t == null ? void 0 : t.apiBasePath)) || "";
14
+ }, h = x();
15
15
  return {
16
16
  config: t,
17
17
  getRoutePath: s,
18
18
  getApiUrl: p,
19
19
  getPath: () => {
20
- const r = l.path, n = (t == null ? void 0 : t.routePrefix) || "";
21
- return f(r.replace(n, ""), "/");
20
+ const r = h.path, u = (t == null ? void 0 : t.routePrefix) || "";
21
+ return f(r.replace(u, ""), "/");
22
22
  }
23
23
  };
24
24
  }
package/dist/esm/index.js CHANGED
@@ -1,138 +1,141 @@
1
- import { DuxCan as o } from "./components/auth/can.js";
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 x } from "./components/common/icon.js";
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 d } from "./components/status/error.js";
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 h } from "./components/status/notFound.js";
10
- import { themeColor as c } from "./config/color.js";
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 V, useCreateMany as N, useCustom as k, useCustomMutation as z, useDelete as G, useDeleteMany as J, 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";
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 oe } from "./hooks/formExtend.js";
18
- import { initFormValidate as pe, useValidateForm as ue } from "./hooks/formValidate.js";
19
- import { useI18n as me } from "./hooks/i18n.js";
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 ie } from "./hooks/importCsv.js";
22
- import { useJsonSchema as ne } from "./hooks/json.js";
23
- import { defaultAdaptors as ve } from "./hooks/json/index.js";
24
- import { useExtendList as Ae } from "./hooks/list.js";
25
- import { useManage as Ce } from "./hooks/manage.js";
26
- import { useMenu as Se } from "./hooks/menu.js";
27
- import { useOverlay as ge } from "./hooks/overlay.js";
28
- import { useSelect as Le } from "./hooks/select.js";
29
- import { useTheme as ye } from "./hooks/theme.js";
30
- import { useTree as Fe } from "./hooks/tree.js";
31
- import { useUpload as Ue } from "./hooks/upload.js";
32
- import { createLocalUploadDriver as Oe } from "./hooks/upload/local.js";
33
- import { createS3UploadDriver as be } from "./hooks/upload/s3.js";
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 Je } from "./preset/dataProvider.js";
37
- import { i18nProvider as qe } from "./preset/i18nProvider.js";
38
- import { DuxAppProvider as He } from "./provider/app.js";
39
- import { DuxTabRouterView as Qe } from "./provider/tab.js";
40
- import { initRouter as Xe } from "./router/route.js";
41
- import { useAuthStore as Ze } from "./stores/auth.js";
42
- import { useI18nStore as $e } from "./stores/i18n.js";
43
- import { useManageStore as rr } from "./stores/manage.js";
44
- import { useRouteStore as tr } from "./stores/route.js";
45
- import { createTabStore as ur, useTabStore as xr } from "./stores/tab.js";
46
- import { useThemeStore as sr } from "./stores/theme.js";
47
- import { emitter as ar } from "./utils/bus.js";
48
- import { themePreset as dr } from "./utils/theme.js";
49
- import { arrayToTree as lr, searchTree as vr, treeToArr as Dr } from "./utils/tree.js";
50
- import { vForAdaptor as hr } from "./hooks/json/vFor.js";
51
- import { vIfAdaptor as cr } from "./hooks/json/vIf.js";
52
- import { vModelAdaptor as Tr } from "./hooks/json/vModel.js";
53
- import { vOnAdaptor as Ir } from "./hooks/json/vOn.js";
54
- import { vShowAdaptor as Mr } from "./hooks/json/vShow.js";
55
- import { vTextAdaptor as Er } from "./hooks/json/vText.js";
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
- He as DuxAppProvider,
58
- o as DuxCan,
59
- d as DuxError,
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
- x as DuxLogoIcon,
64
+ u as DuxLogoIcon,
64
65
  D as DuxNotAuthorized,
65
- h as DuxNotFound,
66
+ S as DuxNotFound,
66
67
  a as DuxOverlay,
67
- Qe as DuxTabRouterView,
68
- lr as arrayToTree,
68
+ We as DuxTabRouterView,
69
+ So as arrayToTree,
69
70
  Ne as createDux,
70
- Oe as createLocalUploadDriver,
71
- be as createS3UploadDriver,
72
- ur as createTabStore,
73
- ve as defaultAdaptors,
74
- ar as emitter,
75
- qe as i18nProvider,
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
- Xe as initRouter,
78
- vr as searchTree,
78
+ de as initJsonSchemaComponents,
79
+ Ye as initRouter,
80
+ co as searchTree,
79
81
  ze as simpleAuthProvider,
80
- Je as simpleDataProvider,
81
- c as themeColor,
82
- dr as themePreset,
83
- Dr as treeToArr,
84
- Ze as useAuthStore,
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
- V as useCreate,
90
- N as useCreateMany,
91
- k as useCustom,
92
- z as useCustomMutation,
93
- G as useDelete,
94
- J as useDeleteMany,
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
- oe as useExtendForm,
99
- Ae as useExtendList,
100
+ re as useExtendForm,
101
+ Se as useExtendList,
100
102
  L as useForgotPassword,
101
103
  ee as useForm,
102
104
  M as useGetAuth,
103
- me as useI18n,
104
- $e as useI18nStore,
105
+ xe as useI18n,
106
+ eo as useI18nStore,
105
107
  fe as useImport,
106
- ie as useImportCsv,
108
+ ne as useImportCsv,
107
109
  j as useInfiniteList,
108
110
  q as useInvalidate,
109
111
  y as useIsLogin,
110
- ne as useJsonSchema,
112
+ le as useJsonSchema,
113
+ ro as useJsonSchemaStore,
111
114
  B as useList,
112
115
  E as useLogin,
113
116
  F as useLogout,
114
- Ce as useManage,
115
- rr as useManageStore,
117
+ Ae as useManage,
118
+ po as useManageStore,
116
119
  H as useMany,
117
- Se as useMenu,
120
+ Te as useMenu,
118
121
  K as useOne,
119
- ge as useOverlay,
122
+ Ie as useOverlay,
120
123
  P as useRegister,
121
- tr as useRouteStore,
122
- Le as useSelect,
123
- xr as useTabStore,
124
- ye as useTheme,
125
- sr as useThemeStore,
126
- Fe as useTree,
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
- Ue as useUpload,
131
- ue as useValidateForm,
132
- hr as vForAdaptor,
133
- cr as vIfAdaptor,
134
- Tr as vModelAdaptor,
135
- Ir as vOnAdaptor,
136
- Mr as vShowAdaptor,
137
- Er as vTextAdaptor
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
  };
@@ -1,99 +1,102 @@
1
1
  import k from "axios";
2
- import { trimStart as h } from "lodash-es";
3
- function w(l) {
4
- const d = (a) => a ? `${l.apiUrl}/${h(a || "", "/")}` : l.apiUrl;
2
+ import { trim as i } from "lodash-es";
3
+ function z(c) {
4
+ const d = (a, t) => {
5
+ const l = `${i(c.apiUrl, "/")}${t ? `/${i(t, "/")}` : ""}`;
6
+ return a ? `${l}/${i(a || "", "/")}` : l;
7
+ };
5
8
  return {
6
9
  apiUrl: d,
7
- getList: (a, r, c) => {
10
+ getList: (a, t, l) => {
8
11
  const e = {};
9
- return a.pagination && typeof a.pagination == "object" && (e.page = a.pagination.page, e.pageSize = a.pagination.pageSize), k.get(d(a.path) || "", {
12
+ return a.pagination && typeof a.pagination == "object" && (e.page = a.pagination.page, e.pageSize = a.pagination.pageSize), k.get(d(a.path, t == null ? void 0 : t.config.apiBasePath) || "", {
10
13
  params: {
11
14
  ...e,
12
15
  ...a.filters,
13
16
  ...a.sorters
14
17
  },
15
18
  headers: {
16
- Authorization: c == null ? void 0 : c.token
19
+ Authorization: l == null ? void 0 : l.token
17
20
  },
18
21
  ...a.meta
19
- }).then((t) => l.successCallback ? l.successCallback(t) : n(t)).catch((t) => {
20
- throw l.errorCallback ? l.errorCallback(t) : m(t);
22
+ }).then((r) => c.successCallback ? c.successCallback(r) : b(r)).catch((r) => {
23
+ throw c.errorCallback ? c.errorCallback(r) : C(r);
21
24
  });
22
25
  },
23
- create: (a, r, c) => k.post(d(a.path) || "", a.data, {
26
+ create: (a, t, l) => k.post(d(a.path, t == null ? void 0 : t.config.apiBasePath) || "", a.data, {
24
27
  headers: {
25
- Authorization: c == null ? void 0 : c.token
28
+ Authorization: l == null ? void 0 : l.token
26
29
  },
27
30
  ...a.meta
28
- }).then((e) => l.successCallback ? l.successCallback(e) : n(e)).catch((e) => {
29
- throw l.errorCallback ? l.errorCallback(e) : m(e);
31
+ }).then((e) => c.successCallback ? c.successCallback(e) : b(e)).catch((e) => {
32
+ throw c.errorCallback ? c.errorCallback(e) : C(e);
30
33
  }),
31
- update: (a, r, c) => k.put(d(a.id ? `${a.path}/${a.id}` : a.path) || "", a.data, {
34
+ update: (a, t, l) => k.put(d(a.id ? `${a.path}/${a.id}` : a.path, t == null ? void 0 : t.config.apiBasePath) || "", a.data, {
32
35
  headers: {
33
- Authorization: c == null ? void 0 : c.token
36
+ Authorization: l == null ? void 0 : l.token
34
37
  },
35
38
  ...a.meta
36
- }).then((e) => l.successCallback ? l.successCallback(e) : n(e)).catch((e) => {
37
- throw l.errorCallback ? l.errorCallback(e) : m(e);
39
+ }).then((e) => c.successCallback ? c.successCallback(e) : b(e)).catch((e) => {
40
+ throw c.errorCallback ? c.errorCallback(e) : C(e);
38
41
  }),
39
- deleteOne: (a, r, c) => k.delete(d(a.id ? `${a.path}/${a.id}` : a.path) || "", {
42
+ deleteOne: (a, t, l) => k.delete(d(a.id ? `${a.path}/${a.id}` : a.path, t == null ? void 0 : t.config.apiBasePath) || "", {
40
43
  headers: {
41
- Authorization: c == null ? void 0 : c.token
44
+ Authorization: l == null ? void 0 : l.token
42
45
  },
43
46
  ...a.meta
44
- }).then((e) => l.successCallback ? l.successCallback(e) : n(e)).catch((e) => {
45
- throw l.errorCallback ? l.errorCallback(e) : m(e);
47
+ }).then((e) => c.successCallback ? c.successCallback(e) : b(e)).catch((e) => {
48
+ throw c.errorCallback ? c.errorCallback(e) : C(e);
46
49
  }),
47
- getOne: (a, r, c) => k.get(d(a.id ? `${a.path}/${a.id}` : a.path) || "", {
50
+ getOne: (a, t, l) => k.get(d(a.id ? `${a.path}/${a.id}` : a.path, t == null ? void 0 : t.config.apiBasePath) || "", {
48
51
  headers: {
49
- Authorization: c == null ? void 0 : c.token
52
+ Authorization: l == null ? void 0 : l.token
50
53
  },
51
54
  ...a.meta
52
- }).then((e) => l.successCallback ? l.successCallback(e) : n(e)).catch((e) => {
53
- throw l.errorCallback ? l.errorCallback(e) : m(e);
55
+ }).then((e) => c.successCallback ? c.successCallback(e) : b(e)).catch((e) => {
56
+ throw c.errorCallback ? c.errorCallback(e) : C(e);
54
57
  }),
55
- getMany: (a, r, c) => k.get(d(a.path) || "", {
58
+ getMany: (a, t, l) => k.get(d(a.path, t == null ? void 0 : t.config.apiBasePath) || "", {
56
59
  params: {
57
60
  ids: a.ids
58
61
  },
59
62
  headers: {
60
- Authorization: c == null ? void 0 : c.token
63
+ Authorization: l == null ? void 0 : l.token
61
64
  },
62
65
  ...a.meta
63
- }).then((e) => l.successCallback ? l.successCallback(e) : n(e)).catch((e) => {
64
- throw l.errorCallback ? l.errorCallback(e) : m(e);
66
+ }).then((e) => c.successCallback ? c.successCallback(e) : b(e)).catch((e) => {
67
+ throw c.errorCallback ? c.errorCallback(e) : C(e);
65
68
  }),
66
- createMany: (a, r, c) => k.post(d(a.path) || "", a.data, {
69
+ createMany: (a, t, l) => k.post(d(a.path, t == null ? void 0 : t.config.apiBasePath) || "", a.data, {
67
70
  headers: {
68
- Authorization: c == null ? void 0 : c.token
71
+ Authorization: l == null ? void 0 : l.token
69
72
  },
70
73
  ...a.meta
71
- }).then((e) => l.successCallback ? l.successCallback(e) : n(e)).catch((e) => {
72
- throw l.errorCallback ? l.errorCallback(e) : m(e);
74
+ }).then((e) => c.successCallback ? c.successCallback(e) : b(e)).catch((e) => {
75
+ throw c.errorCallback ? c.errorCallback(e) : C(e);
73
76
  }),
74
- updateMany: (a, r, c) => k.put(d(a.path) || "", {
77
+ updateMany: (a, t, l) => k.put(d(a.path, t == null ? void 0 : t.config.apiBasePath) || "", {
75
78
  ids: a.ids,
76
79
  data: a.data
77
80
  }, {
78
81
  headers: {
79
- Authorization: c == null ? void 0 : c.token
82
+ Authorization: l == null ? void 0 : l.token
80
83
  },
81
84
  ...a.meta
82
- }).then((e) => l.successCallback ? l.successCallback(e) : n(e)).catch((e) => {
83
- throw l.errorCallback ? l.errorCallback(e) : m(e);
85
+ }).then((e) => c.successCallback ? c.successCallback(e) : b(e)).catch((e) => {
86
+ throw c.errorCallback ? c.errorCallback(e) : C(e);
84
87
  }),
85
- deleteMany: (a, r, c) => k.delete(d(a.path) || "", {
88
+ deleteMany: (a, t, l) => k.delete(d(a.path, t == null ? void 0 : t.config.apiBasePath) || "", {
86
89
  params: {
87
90
  ids: a.ids
88
91
  },
89
92
  headers: {
90
- Authorization: c == null ? void 0 : c.token
93
+ Authorization: l == null ? void 0 : l.token
91
94
  },
92
95
  ...a.meta
93
- }).then((e) => l.successCallback ? l.successCallback(e) : n(e)).catch((e) => {
94
- throw l.errorCallback ? l.errorCallback(e) : m(e);
96
+ }).then((e) => c.successCallback ? c.successCallback(e) : b(e)).catch((e) => {
97
+ throw c.errorCallback ? c.errorCallback(e) : C(e);
95
98
  }),
96
- custom: (a, r, c) => {
99
+ custom: (a, t, l) => {
97
100
  let e = {
98
101
  ...a.query
99
102
  };
@@ -104,63 +107,63 @@ function w(l) {
104
107
  ...e,
105
108
  ...a.filters
106
109
  }), k.request({
107
- url: d(a.path || ""),
110
+ url: d(a.path, t == null ? void 0 : t.config.apiBasePath) || "",
108
111
  method: a.method || "GET",
109
112
  data: a.payload,
110
113
  params: e,
111
114
  signal: a.signal,
112
115
  headers: {
113
- Authorization: c == null ? void 0 : c.token,
116
+ Authorization: l == null ? void 0 : l.token,
114
117
  ...a.headers
115
118
  },
116
- onUploadProgress: (t) => {
117
- var b;
118
- const C = Math.round(t.loaded * 100 / (t.total || 1));
119
- (b = a.onUploadProgress) == null || b.call(a, {
120
- loaded: t.loaded,
121
- total: t.total,
122
- percent: C
119
+ onUploadProgress: (r) => {
120
+ var h;
121
+ const s = Math.round(r.loaded * 100 / (r.total || 1));
122
+ (h = a.onUploadProgress) == null || h.call(a, {
123
+ loaded: r.loaded,
124
+ total: r.total,
125
+ percent: s
123
126
  });
124
127
  },
125
- onDownloadProgress: (t) => {
126
- var b;
127
- const C = Math.round(t.loaded * 100 / (t.total || 1));
128
- (b = a.onDownloadProgress) == null || b.call(a, {
129
- loaded: t.loaded,
130
- total: t.total,
131
- percent: C
128
+ onDownloadProgress: (r) => {
129
+ var h;
130
+ const s = Math.round(r.loaded * 100 / (r.total || 1));
131
+ (h = a.onDownloadProgress) == null || h.call(a, {
132
+ loaded: r.loaded,
133
+ total: r.total,
134
+ percent: s
132
135
  });
133
136
  },
134
137
  ...a.meta
135
- }).then((t) => l.successCallback ? l.successCallback(t) : n(t)).catch((t) => {
136
- throw l.errorCallback ? l.errorCallback(t) : m(t);
138
+ }).then((r) => c.successCallback ? c.successCallback(r) : b(r)).catch((r) => {
139
+ throw c.errorCallback ? c.errorCallback(r) : C(r);
137
140
  });
138
141
  },
139
142
  getTotal: (a) => {
140
- var r;
141
- return l.getTotal ? l.getTotal(a) : ((r = a.meta) == null ? void 0 : r.total) || 0;
143
+ var t;
144
+ return c.getTotal ? c.getTotal(a) : ((t = a.meta) == null ? void 0 : t.total) || 0;
142
145
  }
143
146
  };
144
147
  }
145
- function n(l) {
146
- var d, a, r;
148
+ function b(c) {
149
+ var d, a, t;
147
150
  return {
148
- message: (d = l.data) == null ? void 0 : d.message,
149
- data: (a = l.data) == null ? void 0 : a.data,
150
- meta: (r = l.data) == null ? void 0 : r.meta,
151
- raw: l.data
151
+ message: (d = c.data) == null ? void 0 : d.message,
152
+ data: (a = c.data) == null ? void 0 : a.data,
153
+ meta: (t = c.data) == null ? void 0 : t.meta,
154
+ raw: c.data
152
155
  };
153
156
  }
154
- function m(l) {
155
- var d, a, r, c, e, t, C, b, g, u;
157
+ function C(c) {
158
+ var d, a, t, l, e, r, s, h, u, f;
156
159
  return {
157
- message: ((a = (d = l.response) == null ? void 0 : d.data) == null ? void 0 : a.message) || (l == null ? void 0 : l.message),
158
- data: (c = (r = l.response) == null ? void 0 : r.data) == null ? void 0 : c.data,
159
- meta: (t = (e = l.response) == null ? void 0 : e.data) == null ? void 0 : t.meta,
160
- status: ((b = (C = l.response) == null ? void 0 : C.data) == null ? void 0 : b.code) || ((g = l.response) == null ? void 0 : g.status) || 500,
161
- raw: (u = l.response) == null ? void 0 : u.data
160
+ message: ((a = (d = c.response) == null ? void 0 : d.data) == null ? void 0 : a.message) || (c == null ? void 0 : c.message),
161
+ data: (l = (t = c.response) == null ? void 0 : t.data) == null ? void 0 : l.data,
162
+ meta: (r = (e = c.response) == null ? void 0 : e.data) == null ? void 0 : r.meta,
163
+ status: ((h = (s = c.response) == null ? void 0 : s.data) == null ? void 0 : h.code) || ((u = c.response) == null ? void 0 : u.status) || 500,
164
+ raw: (f = c.response) == null ? void 0 : f.data
162
165
  };
163
166
  }
164
167
  export {
165
- w as simpleDataProvider
168
+ z as simpleDataProvider
166
169
  };
@@ -1,7 +1,7 @@
1
- import { defineComponent as V, inject as q, createVNode as B } from "vue";
2
- import { OverlaysProvider as G } from "@overlastic/vue";
3
- import { useRouter as H } from "vue-router";
4
- import { useCan as J } from "../hooks/auth.js";
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 Z } from "../components/status/error.js";
24
- import { DuxNotAuthorized as x } from "../components/status/notAuthorized.js";
25
- import { DuxNotFound as ee } from "../components/status/notFound.js";
26
- const we = /* @__PURE__ */ V({
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 = q("dux.manage"), u = K(), s = H();
33
- return s.beforeEach(async (a, oe, n) => {
34
- var P, b, R, A, S, $, k, M, z, D, w, I, N, C;
35
- const t = a.meta.manageName, O = a.meta.authorization === !1;
36
- if (!t) {
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 n({
39
+ return a({
39
40
  path: `/${e}`,
40
41
  replace: !0
41
42
  });
42
43
  }
43
- f && (f.value = t);
44
- const h = X(t);
45
- h.isInit() || h.setConfig((R = u.manages) == null ? void 0 : R.find((e) => e.name === t), u);
46
- const i = Y(t), r = Q(t), d = T(t), l = W(t);
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 O ? n() : n({
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: `${t}.notFound`,
64
+ name: `${o}.notFound`,
64
65
  label: "404",
65
66
  path: ":pathMatch(.*)*",
66
- component: e.notFound || ee,
67
+ component: e.notFound || oe,
67
68
  hidden: !0,
68
69
  meta: {
69
70
  can: !1
70
71
  }
71
72
  }), p.push({
72
- name: `${t}.notAuthorized`,
73
+ name: `${o}.notAuthorized`,
73
74
  label: "403",
74
75
  path: "notAuthorized",
75
- component: e.notAuthorized || x,
76
+ component: e.notAuthorized || ee,
76
77
  hidden: !0,
77
78
  meta: {
78
79
  can: !1
79
80
  }
80
81
  }), p.push({
81
- name: `${t}.error`,
82
+ name: `${o}.error`,
82
83
  label: "500",
83
84
  path: "error",
84
- component: e.error || Z,
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((o) => {
97
- i.appendRoutes(g(o.data || []));
97
+ }, r, d.getUser()).then((t) => {
98
+ i.appendRoutes(g(t.data || []));
98
99
  }));
99
- } catch (o) {
100
- console.error(o);
100
+ } catch (t) {
101
+ console.error(t);
101
102
  }
102
- return i.appendRoutes(p), i.getRoutes().forEach((o) => {
103
+ return i.appendRoutes(p), i.getRoutes().forEach((t) => {
103
104
  var E, F, y, L;
104
- if (!o.path)
105
+ if (!t.path)
105
106
  return;
106
107
  const m = {
107
- name: o.name,
108
- path: o.path,
109
- meta: o.meta
108
+ name: t.name,
109
+ path: t.path,
110
+ meta: t.meta
110
111
  };
111
- switch (o.loader) {
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 = o.meta) == null ? void 0 : j.url) || o.path;
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
- o.component && (m.component = o.component);
129
+ t.component && (m.component = t.component);
129
130
  break;
130
131
  }
131
- s.addRoute(`${t}.auth`, m);
132
- }), n({
133
- path: ((I = a.redirectedFrom) == null ? void 0 : I.path) || a.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 = ["", "/", `/${t}`, `/${t}/`];
138
- if (v.includes(a.path)) {
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"), n()) : n({
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 U = J(t);
146
- return (((N = a.meta) == null ? void 0 : N.can) === void 0 || ((C = a.meta) == null ? void 0 : C.can) === !0) && !U(a.name) ? n({
147
- name: `${t}.notAuthorized`
148
- }) : n();
149
- }), () => B(G, null, {
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 a;
152
- return [(a = c.default) == null ? void 0 : a.call(c)];
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
- we as DuxAppProvider
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, any>;
12
+ components?: Record<string, Component> | Component[];
7
13
  context?: Record<string, any> | Ref<Record<string, any>>;
8
14
  }
9
15
  /**
@@ -1,5 +1,6 @@
1
1
  export * from './auth';
2
2
  export * from './i18n';
3
+ export * from './jsonSchema';
3
4
  export * from './manage';
4
5
  export * from './route';
5
6
  export * from './tab';
@@ -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 {
@@ -5,7 +5,7 @@ import type { IUserState } from '../stores';
5
5
  * 为全局或管理端提供自定义数据源处理服务
6
6
  */
7
7
  export interface IDataProvider {
8
- apiUrl?: (path?: string) => string;
8
+ apiUrl?: (path?: string, basePath?: string) => string;
9
9
  getList: (options: IDataProviderListOptions, manage?: IManageHook, auth?: IUserState) => Promise<IDataProviderResponse>;
10
10
  create: (options: IDataProviderCreateOptions, manage?: IManageHook, auth?: IUserState) => Promise<IDataProviderResponse>;
11
11
  update: (options: IDataProviderUpdateOptions, manage?: IManageHook, auth?: IUserState) => Promise<IDataProviderResponse>;
@@ -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';
@@ -27,10 +29,15 @@ export interface IManage {
27
29
  menus?: IMenu[];
28
30
  components?: IConfigComponent;
29
31
  theme?: IConfigTheme;
32
+ apiBasePath?: string;
30
33
  remote?: {
31
34
  packages?: Options;
32
35
  apiMethod?: string;
33
36
  apiRoutePath?: string | ((path: string) => string);
34
37
  };
38
+ jsonSchema?: {
39
+ adaptors?: IJsonAdaptor[];
40
+ components?: Record<string, Component> | Component[];
41
+ };
35
42
  [key: string]: any;
36
43
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@duxweb/dvha-core",
3
3
  "type": "module",
4
- "version": "1.0.14",
4
+ "version": "1.0.16",
5
5
  "author": "DuxWeb",
6
6
  "license": "MIT",
7
7
  "repository": {