@duxweb/dvha-pro 1.0.22 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/component.cjs +1 -1
- package/dist/cjs/components/card/card.cjs +1 -1
- package/dist/cjs/components/card/store.cjs +1 -1
- package/dist/cjs/components/carousel/carousel.cjs +1 -1
- package/dist/cjs/components/crop/imageCrop.cjs +1 -1
- package/dist/cjs/components/crop/imageCropModal.cjs +1 -1
- package/dist/cjs/components/dashboard/hello.cjs +1 -1
- package/dist/cjs/components/dashboard/helloBig.cjs +1 -1
- package/dist/cjs/components/dashboard/quick.cjs +1 -1
- package/dist/cjs/components/data/dynamicData.cjs +1 -1
- package/dist/cjs/components/data/dynamicSelect.cjs +1 -1
- package/dist/cjs/components/data/selectModal.cjs +1 -1
- package/dist/cjs/components/dialog/dialog.cjs +1 -1
- package/dist/cjs/components/drawer/drawer.cjs +1 -1
- package/dist/cjs/components/drawer/drawerPage.cjs +1 -1
- package/dist/cjs/components/editor/aiEditor.cjs +1 -1
- package/dist/cjs/components/form/drawerForm.cjs +1 -0
- package/dist/cjs/components/form/formItem.cjs +1 -1
- package/dist/cjs/components/form/formLayout.cjs +1 -1
- package/dist/cjs/components/form/modalForm.cjs +1 -1
- package/dist/cjs/components/form/pageForm.cjs +1 -1
- package/dist/cjs/components/form/settingForm.cjs +1 -1
- package/dist/cjs/components/icon/iconPicker.cjs +1 -1
- package/dist/cjs/components/layout/filter.cjs +1 -1
- package/dist/cjs/components/layout/filterLayout.cjs +1 -1
- package/dist/cjs/components/layout/list.cjs +1 -1
- package/dist/cjs/components/layout/table.cjs +1 -1
- package/dist/cjs/components/layout/tools.cjs +1 -1
- package/dist/cjs/components/list/card.cjs +1 -1
- package/dist/cjs/components/list/list.cjs +1 -1
- package/dist/cjs/components/media/media.cjs +1 -1
- package/dist/cjs/components/modal/modal.cjs +1 -1
- package/dist/cjs/components/modal/modalPage.cjs +1 -1
- package/dist/cjs/components/modal/modalTab.cjs +1 -1
- package/dist/cjs/components/panel/alert.cjs +1 -1
- package/dist/cjs/components/panel/collapse.cjs +1 -1
- package/dist/cjs/components/panel/setting.cjs +1 -1
- package/dist/cjs/components/select/cardSelect.cjs +1 -1
- package/dist/cjs/components/status/listEmpty.cjs +1 -1
- package/dist/cjs/components/table/tablePage.cjs +1 -1
- package/dist/cjs/components/tree/treeFilter.cjs +1 -1
- package/dist/cjs/components/upload/config.cjs +1 -1
- package/dist/cjs/components/upload/file.cjs +1 -1
- package/dist/cjs/components/upload/image.cjs +1 -1
- package/dist/cjs/components/upload/manage/item.cjs +1 -1
- package/dist/cjs/components/upload/manager.cjs +1 -1
- package/dist/cjs/components/widget/connect.cjs +1 -1
- package/dist/cjs/dvha-pro.css +1 -1
- package/dist/cjs/hooks/action.cjs +1 -1
- package/dist/cjs/hooks/download.cjs +1 -1
- package/dist/cjs/hooks/echart.cjs +1 -1
- package/dist/cjs/hooks/image.cjs +1 -1
- package/dist/cjs/hooks/level.cjs +1 -1
- package/dist/cjs/hooks/table/color.cjs +1 -0
- package/dist/cjs/hooks/table/column.cjs +1 -1
- package/dist/cjs/hooks/table/image.cjs +1 -1
- package/dist/cjs/hooks/table/input.cjs +1 -1
- package/dist/cjs/hooks/table/map.cjs +1 -1
- package/dist/cjs/hooks/table/status.cjs +1 -1
- package/dist/cjs/hooks/table/switch.cjs +1 -1
- package/dist/cjs/hooks/table.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/pages/layout/global.cjs +1 -1
- package/dist/cjs/pages/layout/tab.cjs +1 -1
- package/dist/cjs/pages/login.cjs +1 -1
- package/dist/cjs/pages/menu/avatar.cjs +1 -1
- package/dist/cjs/pages/menu/button.cjs +1 -1
- package/dist/cjs/pages/menu/cmd.cjs +1 -1
- package/dist/cjs/pages/page.cjs +1 -1
- package/dist/cjs/pages/pageStatus.cjs +1 -1
- package/dist/cjs/stores/ui.cjs +1 -1
- package/dist/cjs/theme/uno.css.cjs +2 -1
- package/dist/esm/component.js +3 -3
- package/dist/esm/components/card/card.js +24 -27
- package/dist/esm/components/card/store.js +33 -39
- package/dist/esm/components/carousel/carousel.js +16 -19
- package/dist/esm/components/crop/imageCrop.js +32 -35
- package/dist/esm/components/crop/imageCropModal.js +36 -37
- package/dist/esm/components/dashboard/hello.js +27 -30
- package/dist/esm/components/dashboard/helloBig.js +328 -331
- package/dist/esm/components/dashboard/quick.js +30 -33
- package/dist/esm/components/data/dynamicData.js +86 -98
- package/dist/esm/components/data/dynamicSelect.js +29 -31
- package/dist/esm/components/data/selectModal.js +45 -49
- package/dist/esm/components/dialog/dialog.js +54 -55
- package/dist/esm/components/drawer/drawer.js +23 -22
- package/dist/esm/components/drawer/drawerPage.js +39 -49
- package/dist/esm/components/editor/aiEditor.js +64 -70
- package/dist/esm/components/form/drawerForm.js +149 -0
- package/dist/esm/components/form/formItem.js +44 -50
- package/dist/esm/components/form/formLayout.js +7 -10
- package/dist/esm/components/form/modalForm.js +50 -50
- package/dist/esm/components/form/pageForm.js +47 -50
- package/dist/esm/components/form/settingForm.js +34 -37
- package/dist/esm/components/icon/iconPicker.js +54 -58
- package/dist/esm/components/layout/filter.js +13 -16
- package/dist/esm/components/layout/filterLayout.js +7 -10
- package/dist/esm/components/layout/list.js +299 -326
- package/dist/esm/components/layout/table.js +268 -283
- package/dist/esm/components/layout/tools.js +38 -41
- package/dist/esm/components/list/card.js +35 -38
- package/dist/esm/components/list/list.js +15 -18
- package/dist/esm/components/media/media.js +35 -36
- package/dist/esm/components/modal/modal.js +10 -10
- package/dist/esm/components/modal/modalPage.js +32 -36
- package/dist/esm/components/modal/modalTab.js +39 -45
- package/dist/esm/components/panel/alert.js +19 -22
- package/dist/esm/components/panel/collapse.js +33 -36
- package/dist/esm/components/panel/setting.js +25 -31
- package/dist/esm/components/select/cardSelect.js +27 -28
- package/dist/esm/components/status/listEmpty.js +13 -13
- package/dist/esm/components/table/tablePage.js +25 -25
- package/dist/esm/components/tree/treeFilter.js +137 -147
- package/dist/esm/components/upload/config.js +15 -27
- package/dist/esm/components/upload/file.js +90 -94
- package/dist/esm/components/upload/image.js +116 -123
- package/dist/esm/components/upload/manage/item.js +44 -47
- package/dist/esm/components/upload/manager.js +190 -207
- package/dist/esm/components/widget/connect.js +103 -106
- package/dist/esm/dvha-pro.css +1 -1
- package/dist/esm/hooks/action.js +141 -157
- package/dist/esm/hooks/download.js +55 -56
- package/dist/esm/hooks/echart.js +156 -179
- package/dist/esm/hooks/image.js +14 -15
- package/dist/esm/hooks/level.js +7 -7
- package/dist/esm/hooks/table/color.js +19 -0
- package/dist/esm/hooks/table/column.js +25 -23
- package/dist/esm/hooks/table/image.js +2 -2
- package/dist/esm/hooks/table/input.js +28 -28
- package/dist/esm/hooks/table/map.js +7 -7
- package/dist/esm/hooks/table/status.js +8 -9
- package/dist/esm/hooks/table/switch.js +19 -19
- package/dist/esm/hooks/table.js +27 -31
- package/dist/esm/index.js +162 -158
- package/dist/esm/pages/layout/global.js +12 -15
- package/dist/esm/pages/layout/tab.js +58 -71
- package/dist/esm/pages/login.js +81 -85
- package/dist/esm/pages/menu/avatar.js +136 -149
- package/dist/esm/pages/menu/button.js +16 -20
- package/dist/esm/pages/menu/cmd.js +68 -74
- package/dist/esm/pages/page.js +21 -25
- package/dist/esm/pages/pageStatus.js +21 -24
- package/dist/esm/stores/ui.js +15 -15
- package/dist/esm/theme/uno.css.js +2 -1
- package/dist/types/components/drawer/drawerPage.d.ts +1 -1
- package/dist/types/components/form/drawerForm.d.ts +104 -0
- package/dist/types/components/form/index.d.ts +1 -0
- package/dist/types/components/form/modalForm.d.ts +6 -0
- package/dist/types/components/form/pageForm.d.ts +6 -0
- package/dist/types/components/form/settingForm.d.ts +6 -0
- package/dist/types/components/layout/table.d.ts +9 -0
- package/dist/types/components/table/tablePage.d.ts +9 -0
- package/dist/types/hooks/table/color.d.ts +13 -0
- package/dist/types/hooks/table/column.d.ts +1 -0
- package/dist/types/hooks/table/index.d.ts +1 -0
- package/dist/types/hooks/table/types.d.ts +2 -2
- package/package.json +3 -3
package/dist/esm/hooks/action.js
CHANGED
|
@@ -1,208 +1,192 @@
|
|
|
1
|
-
import { useI18n as
|
|
2
|
-
import { useMessage as
|
|
3
|
-
import { h as
|
|
4
|
-
import { useRouter as
|
|
5
|
-
import { useDialog as
|
|
6
|
-
import { useDrawer as
|
|
7
|
-
import { useModal as
|
|
8
|
-
function
|
|
9
|
-
const
|
|
10
|
-
t:
|
|
11
|
-
} =
|
|
12
|
-
onSuccess: (
|
|
13
|
-
|
|
1
|
+
import { useI18n as h, useManage as A, useCustomMutation as M, useDelete as S } from "@duxweb/dvha-core";
|
|
2
|
+
import { useMessage as D, NButton as b, NDropdown as C } from "naive-ui";
|
|
3
|
+
import { h as l } from "vue";
|
|
4
|
+
import { useRouter as I } from "vue-router";
|
|
5
|
+
import { useDialog as N } from "./dialog.js";
|
|
6
|
+
import { useDrawer as $ } from "./drawer.js";
|
|
7
|
+
import { useModal as B } from "./modal.js";
|
|
8
|
+
function K(o) {
|
|
9
|
+
const u = B(), i = $(), m = N(), {
|
|
10
|
+
t: n
|
|
11
|
+
} = h(), c = D(), g = A(), w = I(), P = M({
|
|
12
|
+
onSuccess: (t) => {
|
|
13
|
+
c.success(t.message || n("common.success"));
|
|
14
14
|
},
|
|
15
|
-
onError: (
|
|
16
|
-
|
|
15
|
+
onError: (t) => {
|
|
16
|
+
c.error(t.message || n("common.error"));
|
|
17
17
|
}
|
|
18
|
-
}),
|
|
19
|
-
onSuccess: (
|
|
20
|
-
|
|
18
|
+
}), k = S({
|
|
19
|
+
onSuccess: (t) => {
|
|
20
|
+
c.success(t.message || n("common.success"));
|
|
21
21
|
},
|
|
22
|
-
onError: (
|
|
23
|
-
|
|
22
|
+
onError: (t) => {
|
|
23
|
+
c.error(t.message || n("common.error"));
|
|
24
24
|
}
|
|
25
|
-
}),
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
component: t.component,
|
|
25
|
+
}), r = o?.path || g.getPath(), f = (t) => {
|
|
26
|
+
const a = n(t.item.title || "", {}, t.item.title), s = n(t.item.label || "", {}, t.item.label);
|
|
27
|
+
if (t.item.type === "modal") {
|
|
28
|
+
const e = t.item, d = typeof e.componentProps == "function" ? e.componentProps(t.data) : e.componentProps;
|
|
29
|
+
u.show({
|
|
30
|
+
title: a || s,
|
|
31
|
+
component: e.component,
|
|
33
32
|
componentProps: {
|
|
34
|
-
id:
|
|
35
|
-
...
|
|
33
|
+
id: t.id,
|
|
34
|
+
...d
|
|
36
35
|
},
|
|
37
|
-
width:
|
|
38
|
-
draggable:
|
|
36
|
+
width: e.width,
|
|
37
|
+
draggable: e.draggable !== void 0 ? e.draggable : !0
|
|
39
38
|
});
|
|
40
39
|
}
|
|
41
|
-
if (
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
title:
|
|
45
|
-
component:
|
|
40
|
+
if (t.item.type === "drawer") {
|
|
41
|
+
const e = t.item, d = typeof e.componentProps == "function" ? e.componentProps(t.data) : e.componentProps;
|
|
42
|
+
i.show({
|
|
43
|
+
title: a || s,
|
|
44
|
+
component: e.component,
|
|
46
45
|
componentProps: {
|
|
47
|
-
id:
|
|
48
|
-
...
|
|
46
|
+
id: t.id,
|
|
47
|
+
...d
|
|
49
48
|
},
|
|
50
|
-
width:
|
|
51
|
-
maxWidth:
|
|
49
|
+
width: e.width,
|
|
50
|
+
maxWidth: e.maxWidth
|
|
52
51
|
});
|
|
53
52
|
}
|
|
54
|
-
if (
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
title:
|
|
58
|
-
content:
|
|
59
|
-
}).then((
|
|
60
|
-
|
|
61
|
-
m && ((h = t.callback) == null || h.call(t, e.id, e.data));
|
|
53
|
+
if (t.item.type === "confirm") {
|
|
54
|
+
const e = t.item;
|
|
55
|
+
m.confirm({
|
|
56
|
+
title: a || s,
|
|
57
|
+
content: e.content
|
|
58
|
+
}).then((d) => {
|
|
59
|
+
d && e.callback?.(t.id, t.data);
|
|
62
60
|
});
|
|
63
61
|
}
|
|
64
|
-
if (
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
title:
|
|
68
|
-
content:
|
|
62
|
+
if (t.item.type === "request") {
|
|
63
|
+
const e = t.item;
|
|
64
|
+
m.confirm({
|
|
65
|
+
title: a || s,
|
|
66
|
+
content: e.content
|
|
69
67
|
}).then(() => {
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
path:
|
|
73
|
-
method:
|
|
74
|
-
payload:
|
|
68
|
+
const d = typeof e.data == "function" ? e.data(t.id, t.data) : e.data, j = (e.method || "post").toLowerCase(), v = typeof e.path == "function" ? e.path(t.id, t.data) : e.path || r;
|
|
69
|
+
P.mutate({
|
|
70
|
+
path: v,
|
|
71
|
+
method: j,
|
|
72
|
+
payload: d
|
|
75
73
|
});
|
|
76
74
|
});
|
|
77
75
|
}
|
|
78
|
-
if (
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
title:
|
|
82
|
-
content:
|
|
76
|
+
if (t.item.type === "delete") {
|
|
77
|
+
const e = t.item;
|
|
78
|
+
m.confirm({
|
|
79
|
+
title: a || s,
|
|
80
|
+
content: e.content
|
|
83
81
|
}).then(() => {
|
|
84
|
-
|
|
85
|
-
id:
|
|
86
|
-
path: t.path ||
|
|
82
|
+
k.mutate({
|
|
83
|
+
id: t.id,
|
|
84
|
+
path: typeof e.path == "function" ? e.path(t.id, t.data) : e.path || r
|
|
87
85
|
});
|
|
88
86
|
});
|
|
89
87
|
}
|
|
90
|
-
if (
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
if (e.item.type === "callback") {
|
|
95
|
-
const t = e.item;
|
|
96
|
-
(k = t.callback) == null || k.call(t, e.id, e.data);
|
|
88
|
+
if (t.item.type === "link") {
|
|
89
|
+
const e = t.item, d = typeof e.path == "function" ? e.path?.(t.id, t.data) : g.getRoutePath(t.id ? `${e.path || r}${t.data === void 0 ? "" : `/${t.id}`}` : e.path || r);
|
|
90
|
+
w.push(d);
|
|
97
91
|
}
|
|
98
|
-
|
|
92
|
+
t.item.type === "callback" && t.item.callback?.(t.id, t.data);
|
|
93
|
+
}, y = E(), x = T();
|
|
99
94
|
return {
|
|
100
|
-
target:
|
|
101
|
-
renderTable: (
|
|
102
|
-
const
|
|
103
|
-
id:
|
|
104
|
-
data:
|
|
105
|
-
index:
|
|
106
|
-
target:
|
|
107
|
-
text:
|
|
108
|
-
align:
|
|
95
|
+
target: f,
|
|
96
|
+
renderTable: (t) => (a, s) => {
|
|
97
|
+
const e = {
|
|
98
|
+
id: a[t.key || o?.key || "id"],
|
|
99
|
+
data: a,
|
|
100
|
+
index: s,
|
|
101
|
+
target: f,
|
|
102
|
+
text: t.text !== void 0 ? t.text : o?.text || !1,
|
|
103
|
+
align: t.align !== void 0 ? t.align : o?.align || "left"
|
|
109
104
|
};
|
|
110
|
-
return (
|
|
111
|
-
...
|
|
112
|
-
action:
|
|
113
|
-
}) :
|
|
114
|
-
...
|
|
115
|
-
action:
|
|
105
|
+
return (t.type || o?.type) === "button" ? y.render({
|
|
106
|
+
...e,
|
|
107
|
+
action: t || o
|
|
108
|
+
}) : x.render({
|
|
109
|
+
...e,
|
|
110
|
+
action: t || o
|
|
116
111
|
});
|
|
117
112
|
},
|
|
118
|
-
renderAction: (
|
|
119
|
-
const
|
|
120
|
-
target:
|
|
121
|
-
text:
|
|
122
|
-
align:
|
|
113
|
+
renderAction: (t) => {
|
|
114
|
+
const a = {
|
|
115
|
+
target: f,
|
|
116
|
+
text: t.text !== void 0 ? t.text : o?.text || !1,
|
|
117
|
+
align: t.align !== void 0 ? t.align : o?.align || "left"
|
|
123
118
|
};
|
|
124
|
-
return (
|
|
125
|
-
...
|
|
126
|
-
action:
|
|
127
|
-
}) :
|
|
128
|
-
...
|
|
129
|
-
action:
|
|
119
|
+
return (t.type || o?.type) === "button" ? y.render({
|
|
120
|
+
...a,
|
|
121
|
+
action: t || o
|
|
122
|
+
}) : x.render({
|
|
123
|
+
...a,
|
|
124
|
+
action: t || o
|
|
130
125
|
});
|
|
131
126
|
}
|
|
132
127
|
};
|
|
133
128
|
}
|
|
134
|
-
function
|
|
129
|
+
function E() {
|
|
135
130
|
const {
|
|
136
|
-
t:
|
|
137
|
-
} =
|
|
131
|
+
t: o
|
|
132
|
+
} = h();
|
|
138
133
|
return {
|
|
139
|
-
render: (
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
key: l,
|
|
146
|
-
type: a.color || (a.type === "delete" ? "error" : "primary"),
|
|
147
|
-
text: d.text,
|
|
148
|
-
secondary: !d.text,
|
|
134
|
+
render: (i) => {
|
|
135
|
+
const m = i.action.items?.filter((n) => !n.show || n.show?.(i.data, i.index)).map((n, c) => l(b, {
|
|
136
|
+
key: c,
|
|
137
|
+
type: n.color || (n.type === "delete" ? "error" : "primary"),
|
|
138
|
+
text: i.text,
|
|
139
|
+
secondary: !i.text,
|
|
149
140
|
onClick: () => {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
item: a
|
|
141
|
+
i?.target?.({
|
|
142
|
+
id: i.id,
|
|
143
|
+
data: i.data,
|
|
144
|
+
item: n
|
|
155
145
|
});
|
|
156
146
|
},
|
|
157
|
-
renderIcon:
|
|
158
|
-
class: ["n-icon",
|
|
147
|
+
renderIcon: n.icon ? () => l("div", {
|
|
148
|
+
class: ["n-icon", n.icon]
|
|
159
149
|
}) : void 0
|
|
160
|
-
}, () => n
|
|
161
|
-
return
|
|
162
|
-
class: ["flex gap-2 flex-wrap items-center",
|
|
163
|
-
},
|
|
150
|
+
}, () => o(n.label || "", {}, n.label)));
|
|
151
|
+
return l("div", {
|
|
152
|
+
class: ["flex gap-2 flex-wrap items-center", i.align === "right" ? "justify-end" : i.align === "center" ? "justify-center" : "justify-start"]
|
|
153
|
+
}, m);
|
|
164
154
|
}
|
|
165
155
|
};
|
|
166
156
|
}
|
|
167
|
-
function
|
|
157
|
+
function T() {
|
|
168
158
|
const {
|
|
169
|
-
t:
|
|
170
|
-
} =
|
|
159
|
+
t: o
|
|
160
|
+
} = h();
|
|
171
161
|
return {
|
|
172
|
-
render: (
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
label: n(a.label || "", {}, a.label),
|
|
179
|
-
key: l,
|
|
180
|
-
icon: a.icon ? () => s("div", {
|
|
181
|
-
class: ["n-icon", a.icon]
|
|
162
|
+
render: (i) => {
|
|
163
|
+
const m = i.action.items?.filter((n) => !n.show || n.show?.(i.data, i.index)).map((n, c) => ({
|
|
164
|
+
label: o(n.label || "", {}, n.label),
|
|
165
|
+
key: c,
|
|
166
|
+
icon: n.icon ? () => l("div", {
|
|
167
|
+
class: ["n-icon", n.icon]
|
|
182
168
|
}) : void 0,
|
|
183
169
|
onSelect: () => {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
item: a
|
|
170
|
+
i?.target?.({
|
|
171
|
+
id: i.id,
|
|
172
|
+
data: i.data,
|
|
173
|
+
item: n
|
|
189
174
|
});
|
|
190
175
|
}
|
|
191
176
|
}));
|
|
192
|
-
return
|
|
177
|
+
return l(C, {
|
|
193
178
|
trigger: "click",
|
|
194
|
-
options:
|
|
195
|
-
onSelect: (
|
|
196
|
-
|
|
197
|
-
(u = l == null ? void 0 : l.onSelect) == null || u.call(l);
|
|
179
|
+
options: m,
|
|
180
|
+
onSelect: (n, c) => {
|
|
181
|
+
c?.onSelect?.();
|
|
198
182
|
}
|
|
199
|
-
}, () => [
|
|
200
|
-
class: ["flex items-center",
|
|
201
|
-
},
|
|
183
|
+
}, () => [l("div", {
|
|
184
|
+
class: ["flex items-center", i.align === "right" ? "justify-end" : i.align === "center" ? "justify-center" : "justify-start"]
|
|
185
|
+
}, l(b, {
|
|
202
186
|
type: "default",
|
|
203
|
-
text:
|
|
204
|
-
secondary: !
|
|
205
|
-
renderIcon: () =>
|
|
187
|
+
text: i.text,
|
|
188
|
+
secondary: !i.text,
|
|
189
|
+
renderIcon: () => l("div", {
|
|
206
190
|
class: ["n-icon", "i-tabler:dots-vertical"]
|
|
207
191
|
})
|
|
208
192
|
}))]);
|
|
@@ -210,7 +194,7 @@ function q() {
|
|
|
210
194
|
};
|
|
211
195
|
}
|
|
212
196
|
export {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
197
|
+
K as useAction,
|
|
198
|
+
E as useActionButton,
|
|
199
|
+
T as useActionDropdown
|
|
216
200
|
};
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { useI18n as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { useMessage as
|
|
5
|
-
import { ref as
|
|
6
|
-
function
|
|
7
|
-
const { t:
|
|
1
|
+
import { useI18n as B, useClient as M } from "@duxweb/dvha-core";
|
|
2
|
+
import x from "dayjs";
|
|
3
|
+
import C from "mime";
|
|
4
|
+
import { useMessage as k } from "naive-ui";
|
|
5
|
+
import { ref as y } from "vue";
|
|
6
|
+
function I() {
|
|
7
|
+
const { t: f } = B(), T = M(), p = y(!1), d = y({
|
|
8
8
|
loaded: 0,
|
|
9
9
|
total: 0,
|
|
10
10
|
percent: 0,
|
|
11
11
|
speed: 0,
|
|
12
12
|
speedText: "0 B/s",
|
|
13
13
|
remainingTime: 0
|
|
14
|
-
}),
|
|
15
|
-
if (
|
|
14
|
+
}), b = k(), g = (o) => {
|
|
15
|
+
if (o === 0)
|
|
16
16
|
return "0 B/s";
|
|
17
|
-
const
|
|
18
|
-
return `${(
|
|
19
|
-
},
|
|
20
|
-
const e = window.URL || window.webkitURL,
|
|
21
|
-
|
|
17
|
+
const n = ["B/s", "KB/s", "MB/s", "GB/s"], e = Math.floor(Math.log(o) / Math.log(1024));
|
|
18
|
+
return `${(o / 1024 ** e).toFixed(1)} ${n[e]}`;
|
|
19
|
+
}, l = (o, n) => {
|
|
20
|
+
const e = window.URL || window.webkitURL, a = e.createObjectURL(o), s = document.createElement("a");
|
|
21
|
+
s.href = a, s.download = n || "", document.body.appendChild(s), s.click(), document.body.removeChild(s), e.revokeObjectURL(a);
|
|
22
22
|
};
|
|
23
23
|
return {
|
|
24
|
-
file: (
|
|
25
|
-
|
|
24
|
+
file: (o, n, e, a, s) => {
|
|
25
|
+
p.value = !0, d.value = {
|
|
26
26
|
loaded: 0,
|
|
27
27
|
total: 0,
|
|
28
28
|
percent: 0,
|
|
@@ -30,71 +30,70 @@ function q() {
|
|
|
30
30
|
speedText: "0 B/s",
|
|
31
31
|
remainingTime: 0
|
|
32
32
|
};
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
path:
|
|
33
|
+
const u = Date.now();
|
|
34
|
+
T.request({
|
|
35
|
+
path: o,
|
|
36
36
|
method: "GET",
|
|
37
|
-
query:
|
|
37
|
+
query: n,
|
|
38
38
|
onDownloadProgress: (t) => {
|
|
39
|
-
const
|
|
39
|
+
const m = (Date.now() - u) / 1e3, r = m > 0 ? t.loaded / m : 0, c = (t.total || 0) - t.loaded, v = r > 0 ? c / r : 0, w = {
|
|
40
40
|
loaded: t.loaded,
|
|
41
41
|
total: t.total,
|
|
42
42
|
percent: t.percent || 0,
|
|
43
|
-
speed: Math.round(
|
|
44
|
-
speedText:
|
|
45
|
-
remainingTime: Math.round(
|
|
43
|
+
speed: Math.round(r),
|
|
44
|
+
speedText: g(r),
|
|
45
|
+
remainingTime: Math.round(v)
|
|
46
46
|
};
|
|
47
|
-
|
|
47
|
+
d.value = w, s?.(w);
|
|
48
48
|
}
|
|
49
49
|
}).then((t) => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
s && (s == null ? void 0 : s.length) > 1 && (d = decodeURIComponent(s[1]));
|
|
50
|
+
const i = e || t.data.headers["content-type"], h = t.data.headers["content-disposition"];
|
|
51
|
+
if (a || (a = x().format("YYYY-MM-DD-HH:mm:ss"), i && (a = `${a}.${C.getExtension(i)}`)), h) {
|
|
52
|
+
const c = /filename=["']?([^"']+)/.exec(h);
|
|
53
|
+
c && c?.length > 1 && (a = decodeURIComponent(c[1]));
|
|
55
54
|
}
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
loaded:
|
|
60
|
-
total:
|
|
55
|
+
const m = t.data?.data instanceof Blob ? t.data?.data : new Blob([t.data?.data], { type: i || "application/octet-stream" });
|
|
56
|
+
l(m, a);
|
|
57
|
+
const r = {
|
|
58
|
+
loaded: d.value.total || d.value.loaded,
|
|
59
|
+
total: d.value.total || d.value.loaded,
|
|
61
60
|
percent: 100,
|
|
62
61
|
speed: 0,
|
|
63
|
-
speedText:
|
|
62
|
+
speedText: g(0),
|
|
64
63
|
remainingTime: 0
|
|
65
64
|
};
|
|
66
|
-
|
|
65
|
+
d.value = r, s?.(r);
|
|
67
66
|
}).catch((t) => {
|
|
68
|
-
|
|
67
|
+
b.error(t.error || f("hooks.download.failed"));
|
|
69
68
|
}).finally(() => {
|
|
70
|
-
|
|
69
|
+
p.value = !1;
|
|
71
70
|
});
|
|
72
71
|
},
|
|
73
|
-
url: (
|
|
72
|
+
url: (o, n) => {
|
|
74
73
|
const e = document.createElement("a");
|
|
75
|
-
e.href =
|
|
74
|
+
e.href = o, e.download = n || "", document.body.appendChild(e), e.click(), document.body.removeChild(e);
|
|
76
75
|
},
|
|
77
|
-
blob:
|
|
78
|
-
base64: (
|
|
79
|
-
const e = atob(
|
|
76
|
+
blob: l,
|
|
77
|
+
base64: (o, n) => {
|
|
78
|
+
const e = atob(o.split(",")[1]), a = Array.from({ length: e.length });
|
|
80
79
|
for (let t = 0; t < e.length; t++)
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
|
|
80
|
+
a[t] = e.charCodeAt(t);
|
|
81
|
+
const s = new Uint8Array(a), u = new Blob([s], { type: "application/octet-stream" });
|
|
82
|
+
l(u, n);
|
|
84
83
|
},
|
|
85
|
-
loading:
|
|
86
|
-
progress:
|
|
87
|
-
image: (
|
|
88
|
-
fetch(
|
|
89
|
-
|
|
90
|
-
|
|
84
|
+
loading: p,
|
|
85
|
+
progress: d,
|
|
86
|
+
image: (o) => {
|
|
87
|
+
fetch(o).then((n) => {
|
|
88
|
+
n.blob().then((e) => {
|
|
89
|
+
l(e);
|
|
91
90
|
});
|
|
92
|
-
}).catch((
|
|
93
|
-
|
|
91
|
+
}).catch((n) => {
|
|
92
|
+
b.error(n.error || f("hooks.download.failed"));
|
|
94
93
|
});
|
|
95
94
|
}
|
|
96
95
|
};
|
|
97
96
|
}
|
|
98
97
|
export {
|
|
99
|
-
|
|
98
|
+
I as useDownload
|
|
100
99
|
};
|