@duxweb/dvha-core 1.0.15 → 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 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 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,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
  }
@@ -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
  };
@@ -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>;
@@ -29,6 +29,7 @@ export interface IManage {
29
29
  menus?: IMenu[];
30
30
  components?: IConfigComponent;
31
31
  theme?: IConfigTheme;
32
+ apiBasePath?: string;
32
33
  remote?: {
33
34
  packages?: Options;
34
35
  apiMethod?: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@duxweb/dvha-core",
3
3
  "type": "module",
4
- "version": "1.0.15",
4
+ "version": "1.0.16",
5
5
  "author": "DuxWeb",
6
6
  "license": "MIT",
7
7
  "repository": {