@duxweb/dvha-pro 1.0.17 → 1.0.19

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 (150) hide show
  1. package/dist/cjs/component.cjs +1 -1
  2. package/dist/cjs/components/card/card.cjs +1 -1
  3. package/dist/cjs/components/chart/echart.cjs +1 -1
  4. package/dist/cjs/components/code/code.cjs +1 -0
  5. package/dist/cjs/components/crop/imageCrop.cjs +1 -1
  6. package/dist/cjs/components/data/dynamicSelect.cjs +1 -1
  7. package/dist/cjs/components/data/selectModal.cjs +1 -1
  8. package/dist/cjs/components/drawer/drawer.cjs +1 -1
  9. package/dist/cjs/components/drawer/drawerPage.cjs +1 -1
  10. package/dist/cjs/components/form/formItem.cjs +1 -1
  11. package/dist/cjs/components/form/formLayout.cjs +1 -1
  12. package/dist/cjs/components/form/modalForm.cjs +1 -1
  13. package/dist/cjs/components/form/pageForm.cjs +1 -1
  14. package/dist/cjs/components/form/settingForm.cjs +1 -1
  15. package/dist/cjs/components/icon/icon.cjs +1 -0
  16. package/dist/cjs/components/icon/iconPicker.cjs +1 -0
  17. package/dist/cjs/components/layout/filter.cjs +1 -1
  18. package/dist/cjs/components/layout/filterLayout.cjs +1 -0
  19. package/dist/cjs/components/layout/list.cjs +1 -1
  20. package/dist/cjs/components/layout/table.cjs +1 -1
  21. package/dist/cjs/components/level/level.cjs +1 -1
  22. package/dist/cjs/components/modal/modal.cjs +1 -1
  23. package/dist/cjs/components/modal/modalPage.cjs +1 -1
  24. package/dist/cjs/components/panel/collapse.cjs +1 -0
  25. package/dist/cjs/components/panel/setting.cjs +1 -1
  26. package/dist/cjs/components/status/listEmpty.cjs +1 -0
  27. package/dist/cjs/components/table/table.cjs +1 -0
  28. package/dist/cjs/components/table/tablePage.cjs +1 -1
  29. package/dist/cjs/components/tree/treeFilter.cjs +1 -0
  30. package/dist/cjs/components/upload/config.cjs +1 -0
  31. package/dist/cjs/components/upload/file.cjs +1 -1
  32. package/dist/cjs/components/upload/image.cjs +1 -1
  33. package/dist/cjs/components/upload/manage/item.cjs +1 -1
  34. package/dist/cjs/components/upload/manager.cjs +1 -1
  35. package/dist/cjs/dvha-pro.css +1 -1
  36. package/dist/cjs/hooks/action.cjs +1 -1
  37. package/dist/cjs/hooks/dialog.cjs +1 -1
  38. package/dist/cjs/hooks/drawer.cjs +1 -1
  39. package/dist/cjs/hooks/modal.cjs +1 -1
  40. package/dist/cjs/hooks/table/image.cjs +1 -1
  41. package/dist/cjs/hooks/table/media.cjs +1 -1
  42. package/dist/cjs/hooks/table.cjs +1 -1
  43. package/dist/cjs/index.cjs +1 -1
  44. package/dist/cjs/langs/en-US.json.cjs +1 -1
  45. package/dist/cjs/langs/zh-CN.json.cjs +1 -1
  46. package/dist/cjs/pages/authLayout.cjs +1 -1
  47. package/dist/cjs/pages/layout/page.cjs +1 -1
  48. package/dist/cjs/pages/login.cjs +1 -1
  49. package/dist/cjs/pages/menu/avatar.cjs +1 -1
  50. package/dist/cjs/pages/menu/button.cjs +1 -1
  51. package/dist/cjs/pages/menu/cmd.cjs +1 -1
  52. package/dist/cjs/pages/menu/main.cjs +1 -1
  53. package/dist/cjs/pages/menu/mobile.cjs +1 -1
  54. package/dist/cjs/pages/page.cjs +1 -1
  55. package/dist/cjs/pages/page404.cjs +1 -1
  56. package/dist/cjs/pages/pageStatus.cjs +1 -1
  57. package/dist/cjs/theme/naiveTheme.cjs +1 -1
  58. package/dist/cjs/theme/uno.css.cjs +27 -7
  59. package/dist/esm/component.js +52 -47
  60. package/dist/esm/components/card/card.js +6 -6
  61. package/dist/esm/components/chart/echart.js +18 -6
  62. package/dist/esm/components/code/code.js +53 -0
  63. package/dist/esm/components/crop/imageCrop.js +38 -26
  64. package/dist/esm/components/data/dynamicSelect.js +31 -19
  65. package/dist/esm/components/data/selectModal.js +50 -38
  66. package/dist/esm/components/drawer/drawer.js +17 -28
  67. package/dist/esm/components/drawer/drawerPage.js +54 -17
  68. package/dist/esm/components/form/formItem.js +13 -13
  69. package/dist/esm/components/form/formLayout.js +8 -8
  70. package/dist/esm/components/form/modalForm.js +46 -36
  71. package/dist/esm/components/form/pageForm.js +82 -43
  72. package/dist/esm/components/form/settingForm.js +39 -27
  73. package/dist/esm/components/icon/icon.js +89 -0
  74. package/dist/esm/components/icon/iconPicker.js +83 -0
  75. package/dist/esm/components/layout/filter.js +15 -11
  76. package/dist/esm/components/layout/filterLayout.js +34 -0
  77. package/dist/esm/components/layout/list.js +207 -160
  78. package/dist/esm/components/layout/table.js +213 -185
  79. package/dist/esm/components/level/level.js +29 -17
  80. package/dist/esm/components/modal/modal.js +9 -9
  81. package/dist/esm/components/modal/modalPage.js +2 -2
  82. package/dist/esm/components/panel/collapse.js +49 -0
  83. package/dist/esm/components/panel/setting.js +3 -3
  84. package/dist/esm/components/status/listEmpty.js +26 -0
  85. package/dist/esm/components/table/table.js +110 -0
  86. package/dist/esm/components/table/tablePage.js +24 -18
  87. package/dist/esm/components/tree/treeFilter.js +212 -0
  88. package/dist/esm/components/upload/config.js +32 -0
  89. package/dist/esm/components/upload/file.js +143 -116
  90. package/dist/esm/components/upload/image.js +96 -66
  91. package/dist/esm/components/upload/manage/item.js +18 -6
  92. package/dist/esm/components/upload/manager.js +203 -164
  93. package/dist/esm/dvha-pro.css +1 -1
  94. package/dist/esm/hooks/action.js +77 -75
  95. package/dist/esm/hooks/dialog.js +14 -2
  96. package/dist/esm/hooks/drawer.js +14 -2
  97. package/dist/esm/hooks/modal.js +14 -2
  98. package/dist/esm/hooks/table/image.js +22 -10
  99. package/dist/esm/hooks/table/media.js +22 -10
  100. package/dist/esm/hooks/table.js +16 -13
  101. package/dist/esm/index.js +200 -184
  102. package/dist/esm/langs/en-US.json.js +1 -1
  103. package/dist/esm/langs/zh-CN.json.js +1 -1
  104. package/dist/esm/pages/authLayout.js +23 -11
  105. package/dist/esm/pages/layout/page.js +29 -17
  106. package/dist/esm/pages/login.js +41 -29
  107. package/dist/esm/pages/menu/avatar.js +46 -34
  108. package/dist/esm/pages/menu/button.js +26 -14
  109. package/dist/esm/pages/menu/cmd.js +46 -34
  110. package/dist/esm/pages/menu/main.js +41 -27
  111. package/dist/esm/pages/menu/mobile.js +14 -2
  112. package/dist/esm/pages/page.js +1 -1
  113. package/dist/esm/pages/page404.js +21 -9
  114. package/dist/esm/pages/pageStatus.js +33 -16
  115. package/dist/esm/theme/naiveTheme.js +6 -6
  116. package/dist/esm/theme/uno.css.js +27 -7
  117. package/dist/types/components/code/code.d.ts +44 -0
  118. package/dist/types/components/code/index.d.ts +1 -0
  119. package/dist/types/components/drawer/drawer.d.ts +2 -0
  120. package/dist/types/components/drawer/drawerPage.d.ts +20 -1
  121. package/dist/types/components/form/formItem.d.ts +2 -2
  122. package/dist/types/components/form/formLayout.d.ts +3 -3
  123. package/dist/types/components/form/modalForm.d.ts +3 -3
  124. package/dist/types/components/form/pageForm.d.ts +12 -0
  125. package/dist/types/components/icon/icon.d.ts +7 -0
  126. package/dist/types/components/icon/iconPicker.d.ts +9 -0
  127. package/dist/types/components/icon/index.d.ts +2 -0
  128. package/dist/types/components/index.d.ts +3 -0
  129. package/dist/types/components/layout/filterLayout.d.ts +32 -0
  130. package/dist/types/components/layout/index.d.ts +1 -0
  131. package/dist/types/components/layout/table.d.ts +3 -0
  132. package/dist/types/components/panel/collapse.d.ts +14 -0
  133. package/dist/types/components/panel/index.d.ts +1 -0
  134. package/dist/types/components/select/cardSelect.d.ts +1 -1
  135. package/dist/types/components/status/index.d.ts +1 -0
  136. package/dist/types/components/status/listEmpty.d.ts +11 -0
  137. package/dist/types/components/table/index.d.ts +1 -0
  138. package/dist/types/components/table/table.d.ts +6552 -0
  139. package/dist/types/components/table/tablePage.d.ts +3 -0
  140. package/dist/types/components/tree/index.d.ts +1 -0
  141. package/dist/types/components/tree/treeFilter.d.ts +24 -0
  142. package/dist/types/components/upload/config.d.ts +13 -0
  143. package/dist/types/components/upload/file.d.ts +4 -0
  144. package/dist/types/components/upload/image.d.ts +30 -2
  145. package/dist/types/components/upload/manager.d.ts +4 -0
  146. package/dist/types/hooks/drawer.d.ts +1 -0
  147. package/dist/types/hooks/table/types.d.ts +1 -0
  148. package/dist/types/main.d.ts +6 -0
  149. package/dist/types/pages/pageStatus.d.ts +11 -1
  150. package/package.json +6 -4
@@ -1,4 +1,4 @@
1
- import { defineComponent as c, defineAsyncComponent as s, createVNode as t, mergeProps as n, Suspense as m } from "vue";
1
+ import { defineComponent as c, defineAsyncComponent as m, createVNode as t, mergeProps as n, Suspense as s } from "vue";
2
2
  import { useExtendOverlay as f } from "@overlastic/vue";
3
3
  import { NModal as g, NSpin as b } from "naive-ui";
4
4
  const v = /* @__PURE__ */ c({
@@ -27,13 +27,13 @@ const v = /* @__PURE__ */ c({
27
27
  const {
28
28
  visible: l,
29
29
  resolve: d,
30
- reject: o,
30
+ reject: a,
31
31
  vanish: i
32
32
  } = f({
33
33
  duration: 1e3
34
- }), a = (e == null ? void 0 : e.componentProps) || {};
35
- a.onConfirm = d, a.onClose = o;
36
- const r = typeof e.component == "function" ? s(e.component) : e.component;
34
+ }), o = (e == null ? void 0 : e.componentProps) || {};
35
+ o.title = e.title, o.onConfirm = d, o.onClose = a;
36
+ const r = typeof e.component == "function" ? m(e.component) : e.component;
37
37
  return () => t(g, n({
38
38
  displayDirective: "show",
39
39
  show: l.value,
@@ -41,10 +41,10 @@ const v = /* @__PURE__ */ c({
41
41
  i();
42
42
  },
43
43
  onClose: () => {
44
- o();
44
+ a();
45
45
  },
46
46
  onEsc: () => {
47
- o();
47
+ a();
48
48
  },
49
49
  draggable: e.draggable,
50
50
  class: "bg-white rounded dark:shadow-gray-950/80 dark:bg-gray-800/60 backdrop-blur",
@@ -60,8 +60,8 @@ const v = /* @__PURE__ */ c({
60
60
  style: {
61
61
  width: typeof e.width == "number" ? `${e.width}px` : e.width
62
62
  }
63
- }, [t(m, null, {
64
- default: () => t(r, n(a, {
63
+ }, [t(s, null, {
64
+ default: () => t(r, n(o, {
65
65
  title: e.title,
66
66
  handle: u
67
67
  }), null),
@@ -32,7 +32,7 @@ const x = /* @__PURE__ */ f({
32
32
  }), () => {
33
33
  var t, d, r;
34
34
  return a("div", {
35
- class: "flex flex-col gap-2"
35
+ class: "flex flex-col"
36
36
  }, [a("div", {
37
37
  class: ["px-4 py-3 border-b border-muted rounded-t flex justify-between items-center bg-white dark:bg-gray-800/50", n.draggable && "cursor-move", n.handle]
38
38
  }, [a("div", {
@@ -49,7 +49,7 @@ const x = /* @__PURE__ */ f({
49
49
  class: "i-tabler:x"
50
50
  }, null)
51
51
  })])]), a("div", {
52
- class: "px-4 py-2"
52
+ class: "p-4"
53
53
  }, [(t = e.default) == null ? void 0 : t.call(e)]), ((d = e.footer) == null ? void 0 : d.call(e)) && a("div", {
54
54
  class: "flex justify-end gap-2 p-3 rounded-b border-t border-muted bg-muted dark:bg-gray-800/50"
55
55
  }, [(r = e.footer) == null ? void 0 : r.call(e)])]);
@@ -0,0 +1,49 @@
1
+ import { defineComponent as n, ref as c, createVNode as a } from "vue";
2
+ import t from "clsx";
3
+ const h = /* @__PURE__ */ n({
4
+ name: "DuxCollapsePanel",
5
+ props: {
6
+ title: String,
7
+ desc: String,
8
+ defaultShow: Boolean,
9
+ highlight: Boolean
10
+ },
11
+ setup(e, {
12
+ slots: i
13
+ }) {
14
+ const l = c(!!e.defaultShow);
15
+ return () => {
16
+ var d, r;
17
+ return a("div", {
18
+ class: t(["border rounded-sm", e.highlight ? "border-primary" : "border-muted"])
19
+ }, [a("div", {
20
+ class: t(["px-4 py-3 flex justify-between items-center", e.highlight ? "bg-primary/10" : "bg-gray/5"])
21
+ }, [a("div", {
22
+ class: "flex gap-2 items-start"
23
+ }, [a("div", {
24
+ class: "pt-0.5"
25
+ }, [(d = i.suffix) == null ? void 0 : d.call(i)]), a("div", {
26
+ class: "flex flex-col"
27
+ }, [a("div", {
28
+ class: "font-medium text-base"
29
+ }, [e == null ? void 0 : e.title]), (e == null ? void 0 : e.desc) && a("div", {
30
+ class: "text-muted"
31
+ }, [e.desc])])]), a("div", {
32
+ class: t(["p-2 rounded-full text-primary cursor-pointer", e.highlight ? "bg-primary/10" : "bg-gray/5"]),
33
+ onClick: () => l.value = !l.value
34
+ }, [a("div", {
35
+ class: t(["i-tabler:arrow-down size-4 transition-all", l.value ? "" : "rotate-180"])
36
+ }, null)])]), a("div", {
37
+ class: t("transition-all overflow-hidden", {
38
+ "max-h-0": !l.value,
39
+ "max-h-500": l.value
40
+ })
41
+ }, [a("div", {
42
+ class: "p-4"
43
+ }, [(r = i.default) == null ? void 0 : r.call(i)])])]);
44
+ };
45
+ }
46
+ });
47
+ export {
48
+ h as DuxCollapsePanel
49
+ };
@@ -2,7 +2,7 @@ import { defineComponent as r, createVNode as e } from "vue";
2
2
  import { DuxCard as n } from "../card/card.js";
3
3
  import "clsx";
4
4
  import "naive-ui";
5
- const p = /* @__PURE__ */ r({
5
+ const m = /* @__PURE__ */ r({
6
6
  name: "DuxPanelCard",
7
7
  props: {
8
8
  title: {
@@ -27,7 +27,7 @@ const p = /* @__PURE__ */ r({
27
27
  }, [e("div", {
28
28
  class: "flex items-center"
29
29
  }, [e("div", {
30
- class: "flex-1 flex flex-col gap-1"
30
+ class: "flex-1 flex flex-col"
31
31
  }, [e("div", {
32
32
  class: "text-base"
33
33
  }, [i.title]), i.description && e("div", {
@@ -48,5 +48,5 @@ const p = /* @__PURE__ */ r({
48
48
  }
49
49
  });
50
50
  export {
51
- p as DuxPanelCard
51
+ m as DuxPanelCard
52
52
  };
@@ -0,0 +1,26 @@
1
+ import { defineComponent as i, createVNode as e } from "vue";
2
+ import { useI18n as m } from "@duxweb/dvha-core";
3
+ import { DuxDrawEmptyForm as n } from "../draw/drawEmptyForm.js";
4
+ const a = /* @__PURE__ */ i({
5
+ name: "DuxListEmpty",
6
+ props: {
7
+ title: String,
8
+ desc: String,
9
+ bordered: Boolean
10
+ },
11
+ setup(t) {
12
+ const {
13
+ t: l
14
+ } = m();
15
+ return () => e("div", {
16
+ class: "flex flex-col items-center justify-center gap-2 h-full"
17
+ }, [e(n, null, null), e("div", {
18
+ class: "text-lg text-default font-bold"
19
+ }, [(t == null ? void 0 : t.title) || l("pages.empty.title")]), e("div", {
20
+ class: "text-muted"
21
+ }, [(t == null ? void 0 : t.desc) || l("pages.empty.desc")])]);
22
+ }
23
+ });
24
+ export {
25
+ a as DuxListEmpty
26
+ };
@@ -0,0 +1,110 @@
1
+ import { defineComponent as u, computed as f, toRef as c, createVNode as o, mergeProps as e } from "vue";
2
+ import { NDataTable as m, NPagination as d } from "naive-ui";
3
+ import { useI18n as b } from "@duxweb/dvha-core";
4
+ import "clsx";
5
+ import { DuxListEmpty as x } from "../status/listEmpty.js";
6
+ import "vue-router";
7
+ import "@overlastic/vue";
8
+ import "vue-echarts";
9
+ import { useWindowSize as g } from "@vueuse/core";
10
+ import "vue-cropper";
11
+ import "jinrishici";
12
+ import "lodash-es";
13
+ import "vue-draggable-plus";
14
+ import "aieditor";
15
+ import "vee-validate";
16
+ import "@vee-validate/i18n";
17
+ import "colorizr";
18
+ import "echarts";
19
+ import "@ant-design/colors";
20
+ import "@unocss/preset-icons/browser";
21
+ import "@unocss/preset-typography";
22
+ import "unocss/preset-wind4";
23
+ import "@vee-validate/i18n/dist/locale/en.json";
24
+ import "@vee-validate/i18n/dist/locale/zh_CN.json";
25
+ import "vue-command-palette";
26
+ import "@duxweb/dvha-naiveui";
27
+ import "../../pages/page404.js";
28
+ import "@iconify-json/tabler/icons.json";
29
+ import "mime";
30
+ import "vue3-ace-editor";
31
+ import "ace-builds/src-noconflict/mode-vue";
32
+ import "ace-builds/src-noconflict/mode-javascript";
33
+ import "ace-builds/src-noconflict/mode-html";
34
+ import "ace-builds/src-noconflict/mode-json";
35
+ import "ace-builds/src-noconflict/mode-json5";
36
+ import "ace-builds/src-noconflict/theme-tomorrow_night";
37
+ import "ace-builds/src-noconflict/theme-tomorrow";
38
+ import "ace-builds/src-noconflict/ext-searchbox";
39
+ import "ace-builds/src-noconflict/ext-language_tools";
40
+ import "ace-builds/src-noconflict/mode-snippets";
41
+ import "dayjs";
42
+ import "@tanstack/vue-query";
43
+ import { useTable as y } from "../../hooks/table.js";
44
+ import "pinia";
45
+ const ft = /* @__PURE__ */ u({
46
+ name: "DuxTable",
47
+ props: {
48
+ path: {
49
+ type: String,
50
+ required: !0
51
+ },
52
+ filter: {
53
+ type: Object
54
+ },
55
+ columns: {
56
+ type: Array
57
+ },
58
+ pagination: {
59
+ type: [Boolean, Object],
60
+ default: !0
61
+ }
62
+ },
63
+ extends: m,
64
+ setup(t) {
65
+ const p = f(() => {
66
+ const {
67
+ path: r,
68
+ filter: v,
69
+ columns: h,
70
+ pagination: D,
71
+ ...s
72
+ } = t;
73
+ return s;
74
+ }), a = c(t.filter || {}), i = y({
75
+ path: t.path,
76
+ filters: a.value,
77
+ columns: t.columns || [],
78
+ pagination: t.pagination
79
+ }), {
80
+ width: l
81
+ } = g(), {
82
+ t: n
83
+ } = b();
84
+ return () => o("div", {
85
+ class: "flex flex-col"
86
+ }, [o(m, e(p.value, i.table.value, {
87
+ class: "flex-1 min-h-0",
88
+ minHeight: 200,
89
+ tableLayout: "fixed",
90
+ flexHeight: !0,
91
+ rowKey: (r) => r.id,
92
+ bordered: !1
93
+ }), {
94
+ empty: () => o(x, {
95
+ bordered: !1
96
+ }, null)
97
+ }), t.pagination && o("div", {
98
+ class: "flex justify-end"
99
+ }, [o(d, e(i.tablePagination.value, {
100
+ simple: l.value < 768
101
+ }), {
102
+ prefix: () => o("div", null, [n("components.list.total", {
103
+ total: i.total.value || 0
104
+ })])
105
+ })])]);
106
+ }
107
+ });
108
+ export {
109
+ ft as DuxTable
110
+ };
@@ -1,36 +1,42 @@
1
- import { defineComponent as d, computed as m, createVNode as i, mergeProps as n } from "vue";
2
- import { NDataTable as p } from "naive-ui";
3
- import { DuxTableLayout as b } from "../layout/table.js";
4
- const g = /* @__PURE__ */ d({
1
+ import { defineComponent as b, computed as d, createVNode as t, mergeProps as o } from "vue";
2
+ import { NDataTable as u } from "naive-ui";
3
+ import { DuxTableLayout as m } from "../layout/table.js";
4
+ import "@duxweb/dvha-core";
5
+ import "clsx";
6
+ import { DuxListEmpty as n } from "../status/listEmpty.js";
7
+ const y = /* @__PURE__ */ b({
5
8
  name: "DuxTablePage",
6
9
  props: {
7
10
  tableProps: {
8
11
  type: Object
9
12
  }
10
13
  },
11
- extends: b,
14
+ extends: m,
12
15
  slots: Object,
13
- setup(t, {
16
+ setup(i, {
14
17
  slots: e
15
18
  }) {
16
- const u = m(() => {
19
+ const p = d(() => {
17
20
  const {
18
- tableProps: a,
19
- ...r
20
- } = t;
21
- return r;
21
+ tableProps: r,
22
+ ...a
23
+ } = i;
24
+ return a;
22
25
  });
23
- return () => i(b, u.value, {
24
- default: (a) => i(p, n({
25
- remote: !0,
26
+ return () => t(m, p.value, {
27
+ default: (r) => t(u, o(r.table.value, i.tableProps, {
26
28
  class: "h-full",
27
29
  minHeight: 200,
28
30
  tableLayout: "fixed",
29
31
  flexHeight: !0,
30
- rowKey: (r) => r.id,
32
+ rowKey: (a) => a.id,
31
33
  bordered: !1,
32
- scrollX: a.width
33
- }, a.table.value, t.tableProps), null),
34
+ scrollX: r.width
35
+ }), {
36
+ empty: () => t(n, {
37
+ bordered: !1
38
+ }, null)
39
+ }),
34
40
  bottom: e == null ? void 0 : e.bottom,
35
41
  tools: e == null ? void 0 : e.tools,
36
42
  actions: e == null ? void 0 : e.actions,
@@ -40,5 +46,5 @@ const g = /* @__PURE__ */ d({
40
46
  }
41
47
  });
42
48
  export {
43
- g as DuxTablePage
49
+ y as DuxTablePage
44
50
  };
@@ -0,0 +1,212 @@
1
+ import { defineComponent as Y, toRef as g, ref as r, watch as P, computed as C, createVNode as n, mergeProps as q, Fragment as G } from "vue";
2
+ import { useI18n as H, useTree as J, useCustomMutation as Q } from "@duxweb/dvha-core";
3
+ import { useVModel as W } from "@vueuse/core";
4
+ import Z from "clsx";
5
+ import { NTree as T, NInput as $, NScrollbar as p, NSpin as ee, NDropdown as te } from "naive-ui";
6
+ import { DuxCard as le } from "../card/card.js";
7
+ const oe = /* @__PURE__ */ Y({
8
+ name: "DuxTreeFilter",
9
+ props: {
10
+ title: String,
11
+ path: String,
12
+ sortPath: String,
13
+ params: Object,
14
+ menus: Array,
15
+ numField: String,
16
+ iconField: String,
17
+ treeOptions: Object,
18
+ value: Array,
19
+ defaultValue: Array,
20
+ onUpdateValue: Function,
21
+ draggable: Boolean,
22
+ bordered: {
23
+ type: Boolean,
24
+ default: !0
25
+ }
26
+ },
27
+ extends: T,
28
+ setup(t, {
29
+ emit: U,
30
+ slots: v
31
+ }) {
32
+ const D = W(t, "value", U, {
33
+ passive: !1,
34
+ defaultValue: t.defaultValue
35
+ }), I = g(t, "params", {}), N = g(t, "path", ""), A = g(t, "sortPath", ""), O = r(), V = r(0), k = r(0), s = r([]), S = r(), {
36
+ t: K
37
+ } = H(), {
38
+ options: j,
39
+ loading: B,
40
+ expanded: L
41
+ } = J({
42
+ path: N.value,
43
+ params: I.value,
44
+ ...t.treeOptions
45
+ });
46
+ P(j, (l) => {
47
+ s.value = l;
48
+ }, {
49
+ immediate: !0,
50
+ deep: !0
51
+ });
52
+ const h = r(!1), M = C(() => {
53
+ var l;
54
+ return ((l = t.menus) == null ? void 0 : l.map((e) => ({
55
+ label: e.label,
56
+ key: e.value,
57
+ icon: e != null && e.icon ? () => n("div", {
58
+ class: e == null ? void 0 : e.icon
59
+ }, null) : void 0,
60
+ onSelect: e.onSelect
61
+ }))) || [];
62
+ }), _ = (l) => {
63
+ var a;
64
+ const e = (a = t.menus) == null ? void 0 : a.find((i) => i.value === l);
65
+ e && e.onSelect(O.value), h.value = !1;
66
+ }, z = Q({
67
+ path: A.value,
68
+ method: "POST"
69
+ }), y = (l, e) => {
70
+ for (const a of l)
71
+ if (a.children) {
72
+ for (const x of a.children)
73
+ if (x.id === e)
74
+ return a;
75
+ const i = y(a.children, e);
76
+ if (i)
77
+ return i;
78
+ }
79
+ }, E = ({
80
+ node: l,
81
+ dragNode: e,
82
+ dropPosition: a
83
+ }) => {
84
+ var F, w;
85
+ const i = y(s.value, e.id), x = !i, m = [...s.value];
86
+ if (x) {
87
+ const u = s.value.findIndex((X) => X.id === e.id);
88
+ u >= 0 && m.splice(u, 1);
89
+ } else {
90
+ const u = ((F = i == null ? void 0 : i.children) == null ? void 0 : F.indexOf(e)) || 0;
91
+ (w = i == null ? void 0 : i.children) == null || w.splice(u, 1);
92
+ }
93
+ let d = y(m, l.id), b, c = (d == null ? void 0 : d.children) || m, o = 0;
94
+ switch (a) {
95
+ case "before":
96
+ o = c.findIndex((u) => u.id === l.id), o > 0 && (b = c[o - 1].id);
97
+ break;
98
+ case "inside":
99
+ d = l, c = d.children = d.children || [], o = c.length;
100
+ break;
101
+ case "after":
102
+ o = c.findIndex((u) => u.id === l.id) + 1, b = l.id;
103
+ break;
104
+ }
105
+ c.splice(o, 0, e), s.value = m, z.mutate({
106
+ payload: {
107
+ parent_id: d == null ? void 0 : d.id,
108
+ before_id: b,
109
+ id: e.id
110
+ }
111
+ });
112
+ }, f = r([]);
113
+ P(L, (l) => {
114
+ var e;
115
+ ((e = f == null ? void 0 : f.value) == null ? void 0 : e.length) > 0 || (f.value = l);
116
+ }, {
117
+ immediate: !0
118
+ });
119
+ const R = C(() => {
120
+ const {
121
+ title: l,
122
+ path: e,
123
+ sortPath: a,
124
+ params: i,
125
+ menus: x,
126
+ numField: m,
127
+ iconField: d,
128
+ treeOptions: b,
129
+ value: c,
130
+ defaultValue: o,
131
+ onUpdateValue: F,
132
+ bordered: w,
133
+ ...u
134
+ } = t;
135
+ return u;
136
+ });
137
+ return () => n(le, {
138
+ class: "h-full",
139
+ bordered: t.bordered
140
+ }, {
141
+ default: () => {
142
+ var l;
143
+ return [(t == null ? void 0 : t.title) && n("div", {
144
+ class: "px-2 py-3 pb-1 text-base font-bold"
145
+ }, [t.title]), n("div", {
146
+ class: "p-2 flex gap-2 items-center"
147
+ }, [n("div", {
148
+ class: "flex-1"
149
+ }, [v.header ? v.header() : n($, {
150
+ value: S.value,
151
+ "onUpdate:value": (e) => S.value = e,
152
+ placeholder: K("common.keyword")
153
+ }, null)]), (l = v.tools) == null ? void 0 : l.call(v)]), n(p, {
154
+ class: "flex-1 min-h-0",
155
+ xScrollable: !0
156
+ }, {
157
+ default: () => [n("div", {
158
+ class: "p-2"
159
+ }, [n(ee, {
160
+ show: B.value,
161
+ class: "h-full"
162
+ }, {
163
+ default: () => [n(T, q(R.value, {
164
+ data: s.value || [],
165
+ expandedKeys: f.value,
166
+ onUpdateExpandedKeys: (e) => {
167
+ f.value = e;
168
+ },
169
+ blockLine: !0,
170
+ selectedKeys: D.value,
171
+ onUpdateSelectedKeys: (e) => {
172
+ var a;
173
+ D.value = e, (a = t == null ? void 0 : t.onUpdateValue) == null || a.call(t, e);
174
+ },
175
+ onDrop: E,
176
+ pattern: S.value,
177
+ renderPrefix: t != null && t.numField || t != null && t.iconField ? ({
178
+ option: e
179
+ }) => n(G, null, [t.iconField && e[t.iconField] && n("div", {
180
+ class: Z(e[t.iconField] || "", "size-4")
181
+ }, null), t.numField && n("div", {
182
+ class: "rounded-full bg-primary px-2 text-xs text-white"
183
+ }, [e[t.numField] || 0])]) : void 0,
184
+ nodeProps: ({
185
+ option: e
186
+ }) => ({
187
+ onContextmenu: (a) => {
188
+ O.value = e, h.value = !0, V.value = a.clientX, k.value = a.clientY, a.preventDefault();
189
+ }
190
+ })
191
+ }), null)]
192
+ })])]
193
+ }), n(te, {
194
+ trigger: "manual",
195
+ placement: "bottom-start",
196
+ show: h.value,
197
+ options: M.value,
198
+ x: V.value,
199
+ y: k.value,
200
+ width: 100,
201
+ onSelect: _,
202
+ onClickoutside: () => {
203
+ h.value = !1;
204
+ }
205
+ }, null)];
206
+ }
207
+ });
208
+ }
209
+ });
210
+ export {
211
+ oe as DuxTreeFilter
212
+ };
@@ -0,0 +1,32 @@
1
+ import { useManage as r, createS3UploadDriver as v, createLocalUploadDriver as U } from "@duxweb/dvha-core";
2
+ import { computed as u } from "vue";
3
+ const b = (a) => {
4
+ const n = r(), d = u(() => {
5
+ var t, l;
6
+ return (a == null ? void 0 : a.uploadPath) || ((l = (t = n.config) == null ? void 0 : t.apiPath) == null ? void 0 : l.upload) || "upload";
7
+ }), P = u(() => {
8
+ var t, l;
9
+ return (a == null ? void 0 : a.managePath) || ((l = (t = n.config) == null ? void 0 : t.apiPath) == null ? void 0 : l.uploadManager) || "uploadManager";
10
+ }), f = u(() => {
11
+ var t, l, e, c;
12
+ return (a == null ? void 0 : a.driver) === "s3" ? v({
13
+ signPath: (a == null ? void 0 : a.signPath) || ((l = (t = n.config) == null ? void 0 : t.apiPath) == null ? void 0 : l.upload) || d.value || "",
14
+ signCallback: (a == null ? void 0 : a.signCallback) || ((c = (e = n.config) == null ? void 0 : e.upload) == null ? void 0 : c.signCallback) || ((i) => {
15
+ var g, m, h;
16
+ return {
17
+ uploadUrl: (g = i.data) == null ? void 0 : g.uploadUrl,
18
+ url: (m = i.data) == null ? void 0 : m.url,
19
+ params: (h = i.data) == null ? void 0 : h.params
20
+ };
21
+ })
22
+ }) : U();
23
+ });
24
+ return {
25
+ uploadPath: d,
26
+ managePath: P,
27
+ driver: f
28
+ };
29
+ };
30
+ export {
31
+ b as useUploadConfig
32
+ };