@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.
Files changed (152) hide show
  1. package/dist/cjs/components/card/card.cjs +1 -1
  2. package/dist/cjs/components/card/store.cjs +1 -1
  3. package/dist/cjs/components/carousel/carousel.cjs +1 -1
  4. package/dist/cjs/components/crop/imageCrop.cjs +1 -1
  5. package/dist/cjs/components/crop/imageCropModal.cjs +1 -1
  6. package/dist/cjs/components/dashboard/hello.cjs +1 -1
  7. package/dist/cjs/components/dashboard/helloBig.cjs +1 -1
  8. package/dist/cjs/components/dashboard/quick.cjs +1 -1
  9. package/dist/cjs/components/data/dynamicData.cjs +1 -1
  10. package/dist/cjs/components/data/dynamicSelect.cjs +1 -1
  11. package/dist/cjs/components/data/selectModal.cjs +1 -1
  12. package/dist/cjs/components/dialog/dialog.cjs +1 -1
  13. package/dist/cjs/components/drawer/drawer.cjs +1 -1
  14. package/dist/cjs/components/drawer/drawerPage.cjs +1 -1
  15. package/dist/cjs/components/editor/aiEditor.cjs +1 -1
  16. package/dist/cjs/components/form/drawerForm.cjs +1 -1
  17. package/dist/cjs/components/form/formItem.cjs +1 -1
  18. package/dist/cjs/components/form/formLayout.cjs +1 -1
  19. package/dist/cjs/components/form/modalForm.cjs +1 -1
  20. package/dist/cjs/components/form/pageForm.cjs +1 -1
  21. package/dist/cjs/components/form/settingForm.cjs +1 -1
  22. package/dist/cjs/components/icon/iconPicker.cjs +1 -1
  23. package/dist/cjs/components/layout/filter.cjs +1 -1
  24. package/dist/cjs/components/layout/filterLayout.cjs +1 -1
  25. package/dist/cjs/components/layout/list.cjs +1 -1
  26. package/dist/cjs/components/layout/table.cjs +1 -1
  27. package/dist/cjs/components/layout/tools.cjs +1 -1
  28. package/dist/cjs/components/list/card.cjs +1 -1
  29. package/dist/cjs/components/list/list.cjs +1 -1
  30. package/dist/cjs/components/media/media.cjs +1 -1
  31. package/dist/cjs/components/modal/modal.cjs +1 -1
  32. package/dist/cjs/components/modal/modalPage.cjs +1 -1
  33. package/dist/cjs/components/modal/modalTab.cjs +1 -1
  34. package/dist/cjs/components/panel/alert.cjs +1 -1
  35. package/dist/cjs/components/panel/collapse.cjs +1 -1
  36. package/dist/cjs/components/panel/setting.cjs +1 -1
  37. package/dist/cjs/components/select/cardSelect.cjs +1 -1
  38. package/dist/cjs/components/status/listEmpty.cjs +1 -1
  39. package/dist/cjs/components/table/tablePage.cjs +1 -1
  40. package/dist/cjs/components/tree/treeFilter.cjs +1 -1
  41. package/dist/cjs/components/upload/config.cjs +1 -1
  42. package/dist/cjs/components/upload/file.cjs +1 -1
  43. package/dist/cjs/components/upload/image.cjs +1 -1
  44. package/dist/cjs/components/upload/manage/item.cjs +1 -1
  45. package/dist/cjs/components/upload/manager.cjs +1 -1
  46. package/dist/cjs/components/widget/connect.cjs +1 -1
  47. package/dist/cjs/dvha-pro.css +1 -1
  48. package/dist/cjs/hooks/action.cjs +1 -1
  49. package/dist/cjs/hooks/download.cjs +1 -1
  50. package/dist/cjs/hooks/echart.cjs +1 -1
  51. package/dist/cjs/hooks/image.cjs +1 -1
  52. package/dist/cjs/hooks/level.cjs +1 -1
  53. package/dist/cjs/hooks/table/color.cjs +1 -0
  54. package/dist/cjs/hooks/table/column.cjs +1 -1
  55. package/dist/cjs/hooks/table/image.cjs +1 -1
  56. package/dist/cjs/hooks/table/input.cjs +1 -1
  57. package/dist/cjs/hooks/table/map.cjs +1 -1
  58. package/dist/cjs/hooks/table/status.cjs +1 -1
  59. package/dist/cjs/hooks/table/switch.cjs +1 -1
  60. package/dist/cjs/hooks/table.cjs +1 -1
  61. package/dist/cjs/index.cjs +1 -1
  62. package/dist/cjs/pages/layout/global.cjs +1 -1
  63. package/dist/cjs/pages/layout/tab.cjs +1 -1
  64. package/dist/cjs/pages/login.cjs +1 -1
  65. package/dist/cjs/pages/menu/avatar.cjs +1 -1
  66. package/dist/cjs/pages/menu/button.cjs +1 -1
  67. package/dist/cjs/pages/menu/cmd.cjs +1 -1
  68. package/dist/cjs/pages/page.cjs +1 -1
  69. package/dist/cjs/pages/pageStatus.cjs +1 -1
  70. package/dist/cjs/stores/ui.cjs +1 -1
  71. package/dist/cjs/theme/uno.css.cjs +2 -1
  72. package/dist/esm/components/card/card.js +24 -27
  73. package/dist/esm/components/card/store.js +33 -39
  74. package/dist/esm/components/carousel/carousel.js +16 -19
  75. package/dist/esm/components/crop/imageCrop.js +32 -35
  76. package/dist/esm/components/crop/imageCropModal.js +36 -37
  77. package/dist/esm/components/dashboard/hello.js +27 -30
  78. package/dist/esm/components/dashboard/helloBig.js +328 -331
  79. package/dist/esm/components/dashboard/quick.js +30 -33
  80. package/dist/esm/components/data/dynamicData.js +86 -98
  81. package/dist/esm/components/data/dynamicSelect.js +29 -31
  82. package/dist/esm/components/data/selectModal.js +45 -49
  83. package/dist/esm/components/dialog/dialog.js +54 -55
  84. package/dist/esm/components/drawer/drawer.js +23 -23
  85. package/dist/esm/components/drawer/drawerPage.js +39 -49
  86. package/dist/esm/components/editor/aiEditor.js +64 -70
  87. package/dist/esm/components/form/drawerForm.js +48 -48
  88. package/dist/esm/components/form/formItem.js +45 -51
  89. package/dist/esm/components/form/formLayout.js +7 -10
  90. package/dist/esm/components/form/modalForm.js +50 -50
  91. package/dist/esm/components/form/pageForm.js +47 -50
  92. package/dist/esm/components/form/settingForm.js +34 -37
  93. package/dist/esm/components/icon/iconPicker.js +54 -58
  94. package/dist/esm/components/layout/filter.js +13 -16
  95. package/dist/esm/components/layout/filterLayout.js +7 -10
  96. package/dist/esm/components/layout/list.js +299 -326
  97. package/dist/esm/components/layout/table.js +268 -283
  98. package/dist/esm/components/layout/tools.js +38 -41
  99. package/dist/esm/components/list/card.js +35 -38
  100. package/dist/esm/components/list/list.js +15 -18
  101. package/dist/esm/components/media/media.js +35 -36
  102. package/dist/esm/components/modal/modal.js +10 -10
  103. package/dist/esm/components/modal/modalPage.js +32 -36
  104. package/dist/esm/components/modal/modalTab.js +39 -45
  105. package/dist/esm/components/panel/alert.js +19 -22
  106. package/dist/esm/components/panel/collapse.js +33 -36
  107. package/dist/esm/components/panel/setting.js +25 -31
  108. package/dist/esm/components/select/cardSelect.js +27 -28
  109. package/dist/esm/components/status/listEmpty.js +13 -13
  110. package/dist/esm/components/table/tablePage.js +25 -25
  111. package/dist/esm/components/tree/treeFilter.js +137 -147
  112. package/dist/esm/components/upload/config.js +15 -27
  113. package/dist/esm/components/upload/file.js +90 -94
  114. package/dist/esm/components/upload/image.js +116 -123
  115. package/dist/esm/components/upload/manage/item.js +44 -47
  116. package/dist/esm/components/upload/manager.js +190 -207
  117. package/dist/esm/components/widget/connect.js +103 -106
  118. package/dist/esm/dvha-pro.css +1 -1
  119. package/dist/esm/hooks/action.js +115 -131
  120. package/dist/esm/hooks/download.js +55 -56
  121. package/dist/esm/hooks/echart.js +156 -179
  122. package/dist/esm/hooks/image.js +14 -15
  123. package/dist/esm/hooks/level.js +7 -7
  124. package/dist/esm/hooks/table/color.js +19 -0
  125. package/dist/esm/hooks/table/column.js +25 -23
  126. package/dist/esm/hooks/table/image.js +2 -2
  127. package/dist/esm/hooks/table/input.js +28 -28
  128. package/dist/esm/hooks/table/map.js +7 -7
  129. package/dist/esm/hooks/table/status.js +8 -9
  130. package/dist/esm/hooks/table/switch.js +19 -19
  131. package/dist/esm/hooks/table.js +27 -31
  132. package/dist/esm/index.js +167 -165
  133. package/dist/esm/pages/layout/global.js +12 -15
  134. package/dist/esm/pages/layout/tab.js +58 -71
  135. package/dist/esm/pages/login.js +81 -85
  136. package/dist/esm/pages/menu/avatar.js +136 -149
  137. package/dist/esm/pages/menu/button.js +16 -20
  138. package/dist/esm/pages/menu/cmd.js +68 -74
  139. package/dist/esm/pages/page.js +21 -25
  140. package/dist/esm/pages/pageStatus.js +21 -24
  141. package/dist/esm/stores/ui.js +15 -15
  142. package/dist/esm/theme/uno.css.js +2 -1
  143. package/dist/types/components/form/drawerForm.d.ts +6 -0
  144. package/dist/types/components/form/modalForm.d.ts +6 -0
  145. package/dist/types/components/form/pageForm.d.ts +6 -0
  146. package/dist/types/components/form/settingForm.d.ts +6 -0
  147. package/dist/types/components/layout/table.d.ts +9 -0
  148. package/dist/types/components/table/tablePage.d.ts +9 -0
  149. package/dist/types/hooks/table/color.d.ts +13 -0
  150. package/dist/types/hooks/table/column.d.ts +1 -0
  151. package/dist/types/hooks/table/index.d.ts +1 -0
  152. package/package.json +3 -3
@@ -1,11 +1,11 @@
1
- import { defineComponent as v, reactive as x, ref as h, createVNode as n, h as p, isVNode as w } from "vue";
2
- import { useI18n as S, useJsonSchema as k } from "@duxweb/dvha-core";
3
- import { useExtendOverlay as j } from "@overlastic/vue";
4
- import { NModal as D, NForm as N, NButton as u } from "naive-ui";
5
- function r(t) {
6
- return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !w(t);
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 z = /* @__PURE__ */ v({
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(t) {
18
+ setup(e) {
19
19
  const {
20
- t: o
21
- } = S(), {
22
- visible: f,
23
- resolve: m,
20
+ t: n
21
+ } = w(), {
22
+ visible: u,
23
+ resolve: f,
24
24
  reject: l,
25
- vanish: b
26
- } = j({
25
+ vanish: m
26
+ } = k({
27
27
  duration: 1e3
28
- }), e = x({
29
- title: t == null ? void 0 : t.title,
30
- content: t == null ? void 0 : t.content,
28
+ }), t = y({
29
+ title: e?.title,
30
+ content: e?.content,
31
31
  button: "default"
32
32
  });
33
- t.type === "confirm" && (e.title = e.title || o("components.dialog.confirm.title"), e.content = e.content || o("components.dialog.confirm.content"), e.button = "primary"), t.type === "success" && (e.title = e.title || o("components.dialog.success.title"), e.content = e.content || o("components.dialog.success.content"), e.button = "success"), t.type === "error" && (e.title = e.title || o("components.dialog.error.title"), e.content = e.content || o("components.dialog.error.content"), e.button = "error"), t.type === "prompt" && (e.title = e.title || o("components.dialog.prompt.title"), e.button = "primary");
34
- const s = h({
35
- ...t.defaultValue
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: g
38
- } = k({
39
- data: t.formSchema || [],
37
+ render: b
38
+ } = S({
39
+ data: e.formSchema || [],
40
40
  context: {
41
41
  form: s.value
42
42
  }
43
43
  });
44
- return () => n(D, {
44
+ return () => o(j, {
45
45
  displayDirective: "show",
46
- show: f.value,
46
+ show: u.value,
47
47
  onAfterLeave: () => {
48
- b();
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: y
61
+ draggableClass: g
62
62
  }) => {
63
- var d;
64
63
  let a, c, i;
65
- return n("div", {
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
- }, [t.type !== "node" ? n("div", {
68
- class: ["p-6 pb-2 flex gap-4", y]
69
- }, [n("div", null, [(t.type === "confirm" || t.type === "prompt") && n("div", {
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
- }, [n("div", {
70
+ }, [o("div", {
72
71
  class: "i-tabler:info-circle size-5"
73
- }, null)]), t.type === "success" && n("div", {
72
+ }, null)]), e.type === "success" && o("div", {
74
73
  class: "bg-success bg-opacity-10 text-success rounded-full p-2"
75
- }, [n("div", {
74
+ }, [o("div", {
76
75
  class: "i-tabler:check size-5"
77
- }, null)]), t.type === "error" && n("div", {
76
+ }, null)]), e.type === "error" && o("div", {
78
77
  class: "bg-error bg-opacity-10 text-error rounded-full p-2"
79
- }, [n("div", {
78
+ }, [o("div", {
80
79
  class: "i-tabler:alert-triangle size-5"
81
- }, null)])]), n("div", {
80
+ }, null)])]), o("div", {
82
81
  class: "flex flex-1 flex-col gap-2"
83
- }, [n("div", {
82
+ }, [o("div", {
84
83
  class: "text-base font-bold"
85
- }, [e.title]), t.type === "prompt" ? n(N, {
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 = p(g)) ? a : {
89
+ }, r(a = x(b)) ? a : {
91
90
  default: () => [a]
92
- }) : n("div", {
91
+ }) : o("div", {
93
92
  class: "text-sm text-gray-500"
94
- }, [e.content])])]) : n("div", {
93
+ }, [t.content])])]) : o("div", {
95
94
  class: "p-4 flex flex-col gap-4"
96
- }, [n("div", {
95
+ }, [o("div", {
97
96
  class: "text-base font-bold"
98
- }, [e.title]), (d = t.render) == null ? void 0 : d.call(t)]), n("div", {
97
+ }, [t.title]), e.render?.()]), o("div", {
99
98
  class: "px-4 pb-4 flex justify-end gap-2"
100
- }, [(t.type === "confirm" || t.type === "prompt") && n(u, {
99
+ }, [(e.type === "confirm" || e.type === "prompt") && o(d, {
101
100
  tertiary: !0,
102
- "aria-label": o("components.button.cancel"),
103
- type: e.button,
101
+ "aria-label": n("components.button.cancel"),
102
+ type: t.button,
104
103
  onClick: () => {
105
104
  l();
106
105
  }
107
- }, r(c = o("components.button.cancel")) ? c : {
106
+ }, r(c = n("components.button.cancel")) ? c : {
108
107
  default: () => [c]
109
- }), n(u, {
110
- "aria-label": o("components.button.confirm"),
111
- type: e.button,
108
+ }), o(d, {
109
+ "aria-label": n("components.button.confirm"),
110
+ type: t.button,
112
111
  onClick: () => {
113
- m(s.value);
112
+ f(s.value);
114
113
  }
115
- }, r(i = o("components.button.confirm")) ? 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
- z as default
122
+ _ as default
124
123
  };
@@ -1,7 +1,7 @@
1
- import { defineComponent as c, defineAsyncComponent as m, createVNode as t, Suspense as d } from "vue";
2
- import { useExtendOverlay as f } from "@overlastic/vue";
3
- import { NDrawer as r, NSpin as s } from "naive-ui";
4
- const w = /* @__PURE__ */ c({
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: i,
23
- resolve: l,
24
- reject: a,
25
- vanish: o
26
- } = f({
22
+ visible: a,
23
+ resolve: o,
24
+ reject: l,
25
+ vanish: i
26
+ } = m({
27
27
  duration: 1e3
28
- }), n = (e == null ? void 0 : e.componentProps) || {};
29
- n.title = e.title, n.onConfirm = l, n.onClose = a;
30
- const u = typeof e.component == "function" ? m(e.component) : e.component;
31
- return () => t(r, {
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: (e == null ? void 0 : e.maxWidth) || 800,
36
- defaultWidth: (e == null ? void 0 : e.width) || 400,
35
+ maxWidth: e?.maxWidth || 800,
36
+ defaultWidth: e?.width || 400,
37
37
  resizable: !0,
38
38
  placement: e.placement,
39
- show: i.value,
40
- onUpdateShow: () => l(),
39
+ show: a.value,
40
+ onUpdateShow: () => o(),
41
41
  onAfterLeave: () => {
42
- o();
42
+ i();
43
43
  },
44
44
  onEsc: () => {
45
- a();
45
+ l();
46
46
  },
47
47
  autoFocus: !1
48
48
  }, {
49
49
  default: () => [t("div", {
50
50
  class: "h-full"
51
- }, [t(d, null, {
52
- default: () => t(u, n, null),
53
- fallback: () => t(s, {
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
- w as default
66
+ v as default
67
67
  };
@@ -1,6 +1,6 @@
1
- import { defineComponent as t, ref as u, watch as d, nextTick as o, createVNode as a } from "vue";
2
- import { NButton as m, NScrollbar as x } from "naive-ui";
3
- const h = /* @__PURE__ */ t({
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(n, {
15
- slots: e
14
+ setup(l, {
15
+ slots: t
16
16
  }) {
17
- const c = u();
18
- return d(c, (f) => {
19
- f && o(() => {
20
- var r, i;
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
- var f, r, i;
25
- return a("div", {
26
- class: "h-full flex flex-col"
27
- }, [a("div", {
28
- class: "flex justify-between items-center p-2 border-b border-default"
29
- }, [a("div", {
30
- class: "text-base"
31
- }, [n == null ? void 0 : n.title]), a("div", {
32
- class: "flex items-center gap-2"
33
- }, [(f = e.header) == null ? void 0 : f.call(e), a(m, {
34
- quaternary: !0,
35
- ref: c,
36
- size: "small",
37
- color: "default",
38
- class: "!px-1 h-6",
39
- onClick: () => {
40
- var l;
41
- return (l = n.onClose) == null ? void 0 : l.call(n);
42
- }
43
- }, {
44
- default: () => [a("div", {
45
- class: "i-tabler:x w-5 h-5"
46
- }, null)]
47
- })])]), a("div", {
48
- class: "flex-1 min-h-1"
49
- }, [n.scrollbar ? a(x, null, {
50
- default: () => {
51
- var l;
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
- h as DuxDrawerPage
54
+ m as DuxDrawerPage
65
55
  };
@@ -1,9 +1,9 @@
1
- import { defineComponent as y, ref as S, computed as k, watch as f, onMounted as V, onUnmounted as w, createVNode as x } from "vue";
2
- import { useTheme as A, useManage as M, useGetAuth as C, useI18n as D, useUpload as E } from "@duxweb/dvha-core";
3
- import { useVModel as F } from "@vueuse/core";
4
- import { AiEditor as N } from "aieditor";
5
- import { useMessage as O } from "naive-ui";
6
- const z = /* @__PURE__ */ y({
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(e, {
21
- emit: v
20
+ setup(a, {
21
+ emit: c
22
22
  }) {
23
- const u = S();
24
- let o = null;
25
- const m = A(), {
26
- config: p
27
- } = M(), P = C(), {
28
- t: U
29
- } = D(), H = O(), s = F(e, "value", v, {
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
- }), n = k(() => {
32
- var a;
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
- f(s, (a) => {
39
- var t;
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 h = (a) => new Promise((t, r) => {
45
- i.addFiles([a], "file").then(() => {
46
- i.trigger().then((d) => {
47
- d.forEach((l) => {
48
- var g;
49
- const c = (g = l == null ? void 0 : l.data) == null ? void 0 : g.data;
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: c == null ? void 0 : c.url,
54
- alt: l == null ? void 0 : l.filename
48
+ src: U?.url,
49
+ alt: h?.filename
55
50
  }
56
51
  });
57
52
  });
58
- }).catch((d) => {
59
- H.error(d.message), r(d);
53
+ }).catch((u) => {
54
+ v.error(u.message), P(u);
60
55
  }).finally(() => {
61
- i.clearFiles();
56
+ n.clearFiles();
62
57
  });
63
58
  });
64
59
  });
65
- return V(() => {
66
- var a;
67
- o = new N({
68
- theme: m.isDark.value ? "dark" : "light",
69
- element: u.value,
70
- placeholder: U("components.editor.placeholder"),
71
- content: e.defaultValue || "",
72
- onBlur: (t) => {
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: n.value,
77
- uploadHeaders: e.uploadHeaders || {},
78
- uploader: h
70
+ uploadUrl: r.value,
71
+ uploadHeaders: a.uploadHeaders || {},
72
+ uploader: i
79
73
  },
80
74
  video: {
81
- uploadUrl: n.value,
82
- uploadHeaders: e.uploadHeaders || {},
83
- uploader: h
75
+ uploadUrl: r.value,
76
+ uploadHeaders: a.uploadHeaders || {},
77
+ uploader: i
84
78
  },
85
79
  attachment: {
86
- uploadUrl: n.value,
87
- uploadHeaders: e.uploadHeaders || {},
88
- uploader: h
80
+ uploadUrl: r.value,
81
+ uploadHeaders: a.uploadHeaders || {},
82
+ uploader: i
89
83
  },
90
84
  ai: {
91
85
  models: {
92
86
  custom: {
93
- url: e.aiPath || ((a = p.apiPath) == null ? void 0 : a.ai) || "ai",
87
+ url: a.aiPath || m.apiPath?.ai || "ai",
94
88
  headers: () => ({
95
89
  "Content-Type": "application/json",
96
- Authorization: P.token
90
+ Authorization: g.token
97
91
  }),
98
- wrapPayload: (t) => JSON.stringify({
99
- prompt: t
92
+ wrapPayload: (e) => JSON.stringify({
93
+ prompt: e
100
94
  }),
101
- parseMessage: (t) => {
102
- const r = JSON.parse(t);
95
+ parseMessage: (e) => {
96
+ const o = JSON.parse(e);
103
97
  return {
104
98
  role: "assistant",
105
- content: r.message,
106
- index: r.number,
107
- status: r.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
- }), w(() => {
116
- o == null || o.destroy();
117
- }), f(m.isDark, (a) => {
118
- u.value && (u.value.classList.remove("aie-theme-dark", "aie-theme-light"), u.value.classList.add(a ? "aie-theme-dark" : "aie-theme-light"));
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
- }), () => x("div", {
122
- ref: u,
123
- style: `height: ${e.height}; width:100%`
115
+ }), () => w("div", {
116
+ ref: t,
117
+ style: `height: ${a.height}; width:100%`
124
118
  }, null);
125
119
  }
126
120
  });
127
121
  export {
128
- z as DuxAiEditor
122
+ T as DuxAiEditor
129
123
  };