@duxweb/dvha-pro 1.0.23 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/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 -1
- 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/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 -23
- 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 +48 -48
- package/dist/esm/components/form/formItem.js +45 -51
- 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 +115 -131
- 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 +167 -165
- 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/form/drawerForm.d.ts +6 -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/package.json +3 -3
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useI18n as
|
|
3
|
-
import { useExtendOverlay as
|
|
4
|
-
import { NModal as
|
|
5
|
-
function r(
|
|
6
|
-
return typeof
|
|
1
|
+
import { defineComponent as p, reactive as y, ref as v, createVNode as o, h as x, isVNode as h } from "vue";
|
|
2
|
+
import { useI18n as w, useJsonSchema as S } from "@duxweb/dvha-core";
|
|
3
|
+
import { useExtendOverlay as k } from "@overlastic/vue";
|
|
4
|
+
import { NModal as j, NForm as D, NButton as d } from "naive-ui";
|
|
5
|
+
function r(e) {
|
|
6
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !h(e);
|
|
7
7
|
}
|
|
8
|
-
const
|
|
8
|
+
const _ = /* @__PURE__ */ p({
|
|
9
9
|
name: "DuxDialog",
|
|
10
10
|
props: {
|
|
11
11
|
title: String,
|
|
@@ -15,37 +15,37 @@ const z = /* @__PURE__ */ v({
|
|
|
15
15
|
defaultValue: Object,
|
|
16
16
|
render: Function
|
|
17
17
|
},
|
|
18
|
-
setup(
|
|
18
|
+
setup(e) {
|
|
19
19
|
const {
|
|
20
|
-
t:
|
|
21
|
-
} =
|
|
22
|
-
visible:
|
|
23
|
-
resolve:
|
|
20
|
+
t: n
|
|
21
|
+
} = w(), {
|
|
22
|
+
visible: u,
|
|
23
|
+
resolve: f,
|
|
24
24
|
reject: l,
|
|
25
|
-
vanish:
|
|
26
|
-
} =
|
|
25
|
+
vanish: m
|
|
26
|
+
} = k({
|
|
27
27
|
duration: 1e3
|
|
28
|
-
}),
|
|
29
|
-
title:
|
|
30
|
-
content:
|
|
28
|
+
}), t = y({
|
|
29
|
+
title: e?.title,
|
|
30
|
+
content: e?.content,
|
|
31
31
|
button: "default"
|
|
32
32
|
});
|
|
33
|
-
|
|
34
|
-
const s =
|
|
35
|
-
...
|
|
33
|
+
e.type === "confirm" && (t.title = t.title || n("components.dialog.confirm.title"), t.content = t.content || n("components.dialog.confirm.content"), t.button = "primary"), e.type === "success" && (t.title = t.title || n("components.dialog.success.title"), t.content = t.content || n("components.dialog.success.content"), t.button = "success"), e.type === "error" && (t.title = t.title || n("components.dialog.error.title"), t.content = t.content || n("components.dialog.error.content"), t.button = "error"), e.type === "prompt" && (t.title = t.title || n("components.dialog.prompt.title"), t.button = "primary");
|
|
34
|
+
const s = v({
|
|
35
|
+
...e.defaultValue
|
|
36
36
|
}), {
|
|
37
|
-
render:
|
|
38
|
-
} =
|
|
39
|
-
data:
|
|
37
|
+
render: b
|
|
38
|
+
} = S({
|
|
39
|
+
data: e.formSchema || [],
|
|
40
40
|
context: {
|
|
41
41
|
form: s.value
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
|
-
return () =>
|
|
44
|
+
return () => o(j, {
|
|
45
45
|
displayDirective: "show",
|
|
46
|
-
show:
|
|
46
|
+
show: u.value,
|
|
47
47
|
onAfterLeave: () => {
|
|
48
|
-
|
|
48
|
+
m();
|
|
49
49
|
},
|
|
50
50
|
onClose: () => {
|
|
51
51
|
l();
|
|
@@ -58,61 +58,60 @@ const z = /* @__PURE__ */ v({
|
|
|
58
58
|
draggable: !0
|
|
59
59
|
}, {
|
|
60
60
|
default: ({
|
|
61
|
-
draggableClass:
|
|
61
|
+
draggableClass: g
|
|
62
62
|
}) => {
|
|
63
|
-
var d;
|
|
64
63
|
let a, c, i;
|
|
65
|
-
return
|
|
64
|
+
return o("div", {
|
|
66
65
|
class: ["w-400px rounded border border-muted max-w-full shadow-lg shadow-gray-950/10 bg-white/70 dark:shadow-gray-950/80 dark:bg-gray-900/70 backdrop-blur"]
|
|
67
|
-
}, [
|
|
68
|
-
class: ["p-6 pb-2 flex gap-4",
|
|
69
|
-
}, [
|
|
66
|
+
}, [e.type !== "node" ? o("div", {
|
|
67
|
+
class: ["p-6 pb-2 flex gap-4", g]
|
|
68
|
+
}, [o("div", null, [(e.type === "confirm" || e.type === "prompt") && o("div", {
|
|
70
69
|
class: "bg-warning bg-opacity-10 text-warning rounded-full p-2"
|
|
71
|
-
}, [
|
|
70
|
+
}, [o("div", {
|
|
72
71
|
class: "i-tabler:info-circle size-5"
|
|
73
|
-
}, null)]),
|
|
72
|
+
}, null)]), e.type === "success" && o("div", {
|
|
74
73
|
class: "bg-success bg-opacity-10 text-success rounded-full p-2"
|
|
75
|
-
}, [
|
|
74
|
+
}, [o("div", {
|
|
76
75
|
class: "i-tabler:check size-5"
|
|
77
|
-
}, null)]),
|
|
76
|
+
}, null)]), e.type === "error" && o("div", {
|
|
78
77
|
class: "bg-error bg-opacity-10 text-error rounded-full p-2"
|
|
79
|
-
}, [
|
|
78
|
+
}, [o("div", {
|
|
80
79
|
class: "i-tabler:alert-triangle size-5"
|
|
81
|
-
}, null)])]),
|
|
80
|
+
}, null)])]), o("div", {
|
|
82
81
|
class: "flex flex-1 flex-col gap-2"
|
|
83
|
-
}, [
|
|
82
|
+
}, [o("div", {
|
|
84
83
|
class: "text-base font-bold"
|
|
85
|
-
}, [
|
|
84
|
+
}, [t.title]), e.type === "prompt" ? o(D, {
|
|
86
85
|
labelAlign: "left",
|
|
87
86
|
showLabel: !1,
|
|
88
87
|
showFeedback: !1,
|
|
89
88
|
class: "py-2"
|
|
90
|
-
}, r(a =
|
|
89
|
+
}, r(a = x(b)) ? a : {
|
|
91
90
|
default: () => [a]
|
|
92
|
-
}) :
|
|
91
|
+
}) : o("div", {
|
|
93
92
|
class: "text-sm text-gray-500"
|
|
94
|
-
}, [
|
|
93
|
+
}, [t.content])])]) : o("div", {
|
|
95
94
|
class: "p-4 flex flex-col gap-4"
|
|
96
|
-
}, [
|
|
95
|
+
}, [o("div", {
|
|
97
96
|
class: "text-base font-bold"
|
|
98
|
-
}, [
|
|
97
|
+
}, [t.title]), e.render?.()]), o("div", {
|
|
99
98
|
class: "px-4 pb-4 flex justify-end gap-2"
|
|
100
|
-
}, [(
|
|
99
|
+
}, [(e.type === "confirm" || e.type === "prompt") && o(d, {
|
|
101
100
|
tertiary: !0,
|
|
102
|
-
"aria-label":
|
|
103
|
-
type:
|
|
101
|
+
"aria-label": n("components.button.cancel"),
|
|
102
|
+
type: t.button,
|
|
104
103
|
onClick: () => {
|
|
105
104
|
l();
|
|
106
105
|
}
|
|
107
|
-
}, r(c =
|
|
106
|
+
}, r(c = n("components.button.cancel")) ? c : {
|
|
108
107
|
default: () => [c]
|
|
109
|
-
}),
|
|
110
|
-
"aria-label":
|
|
111
|
-
type:
|
|
108
|
+
}), o(d, {
|
|
109
|
+
"aria-label": n("components.button.confirm"),
|
|
110
|
+
type: t.button,
|
|
112
111
|
onClick: () => {
|
|
113
|
-
|
|
112
|
+
f(s.value);
|
|
114
113
|
}
|
|
115
|
-
}, r(i =
|
|
114
|
+
}, r(i = n("components.button.confirm")) ? i : {
|
|
116
115
|
default: () => [i]
|
|
117
116
|
})])]);
|
|
118
117
|
}
|
|
@@ -120,5 +119,5 @@ const z = /* @__PURE__ */ v({
|
|
|
120
119
|
}
|
|
121
120
|
});
|
|
122
121
|
export {
|
|
123
|
-
|
|
122
|
+
_ as default
|
|
124
123
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useExtendOverlay as
|
|
3
|
-
import { NDrawer as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as s, defineAsyncComponent as u, createVNode as t, Suspense as c } from "vue";
|
|
2
|
+
import { useExtendOverlay as m } from "@overlastic/vue";
|
|
3
|
+
import { NDrawer as d, NSpin as f } from "naive-ui";
|
|
4
|
+
const v = /* @__PURE__ */ s({
|
|
5
5
|
name: "DuxDrawer",
|
|
6
6
|
props: {
|
|
7
7
|
title: String,
|
|
@@ -19,38 +19,38 @@ const w = /* @__PURE__ */ c({
|
|
|
19
19
|
},
|
|
20
20
|
setup(e) {
|
|
21
21
|
const {
|
|
22
|
-
visible:
|
|
23
|
-
resolve:
|
|
24
|
-
reject:
|
|
25
|
-
vanish:
|
|
26
|
-
} =
|
|
22
|
+
visible: a,
|
|
23
|
+
resolve: o,
|
|
24
|
+
reject: l,
|
|
25
|
+
vanish: i
|
|
26
|
+
} = m({
|
|
27
27
|
duration: 1e3
|
|
28
|
-
}), n =
|
|
29
|
-
n.title = e.title, n.onConfirm =
|
|
30
|
-
const
|
|
31
|
-
return () => t(
|
|
28
|
+
}), n = e?.componentProps || {};
|
|
29
|
+
n.title = e.title, n.onConfirm = o, n.onClose = l;
|
|
30
|
+
const r = typeof e.component == "function" ? u(e.component) : e.component;
|
|
31
|
+
return () => t(d, {
|
|
32
32
|
closeOnEsc: !1,
|
|
33
33
|
maskClosable: !1,
|
|
34
34
|
minWidth: 200,
|
|
35
|
-
maxWidth:
|
|
36
|
-
defaultWidth:
|
|
35
|
+
maxWidth: e?.maxWidth || 800,
|
|
36
|
+
defaultWidth: e?.width || 400,
|
|
37
37
|
resizable: !0,
|
|
38
38
|
placement: e.placement,
|
|
39
|
-
show:
|
|
40
|
-
onUpdateShow: () =>
|
|
39
|
+
show: a.value,
|
|
40
|
+
onUpdateShow: () => o(),
|
|
41
41
|
onAfterLeave: () => {
|
|
42
|
-
|
|
42
|
+
i();
|
|
43
43
|
},
|
|
44
44
|
onEsc: () => {
|
|
45
|
-
|
|
45
|
+
l();
|
|
46
46
|
},
|
|
47
47
|
autoFocus: !1
|
|
48
48
|
}, {
|
|
49
49
|
default: () => [t("div", {
|
|
50
50
|
class: "h-full"
|
|
51
|
-
}, [t(
|
|
52
|
-
default: () => t(
|
|
53
|
-
fallback: () => t(
|
|
51
|
+
}, [t(c, null, {
|
|
52
|
+
default: () => t(r, n, null),
|
|
53
|
+
fallback: () => t(f, {
|
|
54
54
|
show: !0,
|
|
55
55
|
class: "h-full"
|
|
56
56
|
}, {
|
|
@@ -63,5 +63,5 @@ const w = /* @__PURE__ */ c({
|
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
export {
|
|
66
|
-
|
|
66
|
+
v as default
|
|
67
67
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { NButton as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as n, ref as a, watch as f, nextTick as i, createVNode as e } from "vue";
|
|
2
|
+
import { NButton as c, NScrollbar as u } from "naive-ui";
|
|
3
|
+
const m = /* @__PURE__ */ n({
|
|
4
4
|
name: "DuxDrawerPage",
|
|
5
5
|
props: {
|
|
6
6
|
title: String,
|
|
@@ -11,55 +11,45 @@ const h = /* @__PURE__ */ t({
|
|
|
11
11
|
default: !0
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
-
setup(
|
|
15
|
-
slots:
|
|
14
|
+
setup(l, {
|
|
15
|
+
slots: t
|
|
16
16
|
}) {
|
|
17
|
-
const
|
|
18
|
-
return
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
(i = (r = f.$el) == null ? void 0 : r.focus) == null || i.call(r);
|
|
17
|
+
const o = a();
|
|
18
|
+
return f(o, (r) => {
|
|
19
|
+
r && i(() => {
|
|
20
|
+
r.$el?.focus?.();
|
|
22
21
|
});
|
|
23
|
-
}), () => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return [(l = e.default) == null ? void 0 : l.call(e)];
|
|
53
|
-
}
|
|
54
|
-
}) : (r = e.default) == null ? void 0 : r.call(e)]), e.footer && a("div", {
|
|
55
|
-
class: "flex-none border-t border-muted p-4 flex justify-end gap-2"
|
|
56
|
-
}, [(i = e.footer) == null ? void 0 : i.call(e, {
|
|
57
|
-
onClose: n.onClose,
|
|
58
|
-
onConfirm: n.onConfirm
|
|
59
|
-
})])]);
|
|
60
|
-
};
|
|
22
|
+
}), () => e("div", {
|
|
23
|
+
class: "h-full flex flex-col"
|
|
24
|
+
}, [e("div", {
|
|
25
|
+
class: "flex justify-between items-center p-2 border-b border-default"
|
|
26
|
+
}, [e("div", {
|
|
27
|
+
class: "text-base"
|
|
28
|
+
}, [l?.title]), e("div", {
|
|
29
|
+
class: "flex items-center gap-2"
|
|
30
|
+
}, [t.header?.(), e(c, {
|
|
31
|
+
quaternary: !0,
|
|
32
|
+
ref: o,
|
|
33
|
+
size: "small",
|
|
34
|
+
color: "default",
|
|
35
|
+
class: "!px-1 h-6",
|
|
36
|
+
onClick: () => l.onClose?.()
|
|
37
|
+
}, {
|
|
38
|
+
default: () => [e("div", {
|
|
39
|
+
class: "i-tabler:x w-5 h-5"
|
|
40
|
+
}, null)]
|
|
41
|
+
})])]), e("div", {
|
|
42
|
+
class: "flex-1 min-h-1"
|
|
43
|
+
}, [l.scrollbar ? e(u, null, {
|
|
44
|
+
default: () => [t.default?.()]
|
|
45
|
+
}) : t.default?.()]), t.footer && e("div", {
|
|
46
|
+
class: "flex-none border-t border-muted p-4 flex justify-end gap-2"
|
|
47
|
+
}, [t.footer?.({
|
|
48
|
+
onClose: l.onClose,
|
|
49
|
+
onConfirm: l.onConfirm
|
|
50
|
+
})])]);
|
|
61
51
|
}
|
|
62
52
|
});
|
|
63
53
|
export {
|
|
64
|
-
|
|
54
|
+
m as DuxDrawerPage
|
|
65
55
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useTheme as
|
|
3
|
-
import { useVModel as
|
|
4
|
-
import { AiEditor as
|
|
5
|
-
import { useMessage as
|
|
6
|
-
const
|
|
1
|
+
import { defineComponent as H, ref as y, computed as S, watch as p, onMounted as k, onUnmounted as V, createVNode as w } from "vue";
|
|
2
|
+
import { useTheme as x, useManage as A, useGetAuth as E, useI18n as M, useUpload as C } from "@duxweb/dvha-core";
|
|
3
|
+
import { useVModel as D } from "@vueuse/core";
|
|
4
|
+
import { AiEditor as F } from "aieditor";
|
|
5
|
+
import { useMessage as N } from "naive-ui";
|
|
6
|
+
const T = /* @__PURE__ */ H({
|
|
7
7
|
name: "DuxAiEditor",
|
|
8
8
|
props: {
|
|
9
9
|
value: String,
|
|
@@ -17,94 +17,88 @@ const z = /* @__PURE__ */ y({
|
|
|
17
17
|
},
|
|
18
18
|
onUpdateValue: Function
|
|
19
19
|
},
|
|
20
|
-
setup(
|
|
21
|
-
emit:
|
|
20
|
+
setup(a, {
|
|
21
|
+
emit: c
|
|
22
22
|
}) {
|
|
23
|
-
const
|
|
24
|
-
let
|
|
25
|
-
const
|
|
26
|
-
config:
|
|
27
|
-
} =
|
|
28
|
-
t:
|
|
29
|
-
} =
|
|
23
|
+
const t = y();
|
|
24
|
+
let l = null;
|
|
25
|
+
const s = x(), {
|
|
26
|
+
config: m
|
|
27
|
+
} = A(), g = E(), {
|
|
28
|
+
t: f
|
|
29
|
+
} = M(), v = N(), d = D(a, "value", c, {
|
|
30
30
|
passive: !0
|
|
31
|
-
}),
|
|
32
|
-
|
|
33
|
-
return e.uploadPath || ((a = p.apiPath) == null ? void 0 : a.upload) || "upload";
|
|
34
|
-
}), i = E({
|
|
35
|
-
path: n.value,
|
|
31
|
+
}), r = S(() => a.uploadPath || m.apiPath?.upload || "upload"), n = C({
|
|
32
|
+
path: r.value,
|
|
36
33
|
autoUpload: !1
|
|
37
34
|
});
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
o && (o.setContent(a || ""), (t = e.onUpdateValue) == null || t.call(e, s.value || ""));
|
|
35
|
+
p(d, (e) => {
|
|
36
|
+
l && (l.setContent(e || ""), a.onUpdateValue?.(d.value || ""));
|
|
41
37
|
}, {
|
|
42
38
|
immediate: !0
|
|
43
39
|
});
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
t({
|
|
40
|
+
const i = (e) => new Promise((o, P) => {
|
|
41
|
+
n.addFiles([e], "file").then(() => {
|
|
42
|
+
n.trigger().then((u) => {
|
|
43
|
+
u.forEach((h) => {
|
|
44
|
+
const U = h?.data?.data;
|
|
45
|
+
o({
|
|
51
46
|
errorCode: 0,
|
|
52
47
|
data: {
|
|
53
|
-
src:
|
|
54
|
-
alt:
|
|
48
|
+
src: U?.url,
|
|
49
|
+
alt: h?.filename
|
|
55
50
|
}
|
|
56
51
|
});
|
|
57
52
|
});
|
|
58
|
-
}).catch((
|
|
59
|
-
|
|
53
|
+
}).catch((u) => {
|
|
54
|
+
v.error(u.message), P(u);
|
|
60
55
|
}).finally(() => {
|
|
61
|
-
|
|
56
|
+
n.clearFiles();
|
|
62
57
|
});
|
|
63
58
|
});
|
|
64
59
|
});
|
|
65
|
-
return
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
s.value = t.getHtml();
|
|
60
|
+
return k(() => {
|
|
61
|
+
l = new F({
|
|
62
|
+
theme: s.isDark.value ? "dark" : "light",
|
|
63
|
+
element: t.value,
|
|
64
|
+
placeholder: f("components.editor.placeholder"),
|
|
65
|
+
content: a.defaultValue || "",
|
|
66
|
+
onBlur: (e) => {
|
|
67
|
+
d.value = e.getHtml();
|
|
74
68
|
},
|
|
75
69
|
image: {
|
|
76
|
-
uploadUrl:
|
|
77
|
-
uploadHeaders:
|
|
78
|
-
uploader:
|
|
70
|
+
uploadUrl: r.value,
|
|
71
|
+
uploadHeaders: a.uploadHeaders || {},
|
|
72
|
+
uploader: i
|
|
79
73
|
},
|
|
80
74
|
video: {
|
|
81
|
-
uploadUrl:
|
|
82
|
-
uploadHeaders:
|
|
83
|
-
uploader:
|
|
75
|
+
uploadUrl: r.value,
|
|
76
|
+
uploadHeaders: a.uploadHeaders || {},
|
|
77
|
+
uploader: i
|
|
84
78
|
},
|
|
85
79
|
attachment: {
|
|
86
|
-
uploadUrl:
|
|
87
|
-
uploadHeaders:
|
|
88
|
-
uploader:
|
|
80
|
+
uploadUrl: r.value,
|
|
81
|
+
uploadHeaders: a.uploadHeaders || {},
|
|
82
|
+
uploader: i
|
|
89
83
|
},
|
|
90
84
|
ai: {
|
|
91
85
|
models: {
|
|
92
86
|
custom: {
|
|
93
|
-
url:
|
|
87
|
+
url: a.aiPath || m.apiPath?.ai || "ai",
|
|
94
88
|
headers: () => ({
|
|
95
89
|
"Content-Type": "application/json",
|
|
96
|
-
Authorization:
|
|
90
|
+
Authorization: g.token
|
|
97
91
|
}),
|
|
98
|
-
wrapPayload: (
|
|
99
|
-
prompt:
|
|
92
|
+
wrapPayload: (e) => JSON.stringify({
|
|
93
|
+
prompt: e
|
|
100
94
|
}),
|
|
101
|
-
parseMessage: (
|
|
102
|
-
const
|
|
95
|
+
parseMessage: (e) => {
|
|
96
|
+
const o = JSON.parse(e);
|
|
103
97
|
return {
|
|
104
98
|
role: "assistant",
|
|
105
|
-
content:
|
|
106
|
-
index:
|
|
107
|
-
status:
|
|
99
|
+
content: o.message,
|
|
100
|
+
index: o.number,
|
|
101
|
+
status: o.status
|
|
108
102
|
};
|
|
109
103
|
},
|
|
110
104
|
protocol: "sse"
|
|
@@ -112,18 +106,18 @@ const z = /* @__PURE__ */ y({
|
|
|
112
106
|
}
|
|
113
107
|
}
|
|
114
108
|
});
|
|
115
|
-
}),
|
|
116
|
-
|
|
117
|
-
}),
|
|
118
|
-
|
|
109
|
+
}), V(() => {
|
|
110
|
+
l?.destroy();
|
|
111
|
+
}), p(s.isDark, (e) => {
|
|
112
|
+
t.value && (t.value.classList.remove("aie-theme-dark", "aie-theme-light"), t.value.classList.add(e ? "aie-theme-dark" : "aie-theme-light"));
|
|
119
113
|
}, {
|
|
120
114
|
immediate: !0
|
|
121
|
-
}), () =>
|
|
122
|
-
ref:
|
|
123
|
-
style: `height: ${
|
|
115
|
+
}), () => w("div", {
|
|
116
|
+
ref: t,
|
|
117
|
+
style: `height: ${a.height}; width:100%`
|
|
124
118
|
}, null);
|
|
125
119
|
}
|
|
126
120
|
});
|
|
127
121
|
export {
|
|
128
|
-
|
|
122
|
+
T as DuxAiEditor
|
|
129
123
|
};
|