@duxweb/dvha-pro 1.0.17 → 1.0.18

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 (83) hide show
  1. package/dist/cjs/component.cjs +1 -1
  2. package/dist/cjs/components/chart/echart.cjs +1 -1
  3. package/dist/cjs/components/crop/imageCrop.cjs +1 -1
  4. package/dist/cjs/components/data/dynamicSelect.cjs +1 -1
  5. package/dist/cjs/components/data/selectModal.cjs +1 -1
  6. package/dist/cjs/components/form/formItem.cjs +1 -1
  7. package/dist/cjs/components/form/modalForm.cjs +1 -1
  8. package/dist/cjs/components/form/pageForm.cjs +1 -1
  9. package/dist/cjs/components/form/settingForm.cjs +1 -1
  10. package/dist/cjs/components/icon/icon.cjs +1 -0
  11. package/dist/cjs/components/icon/iconPicker.cjs +1 -0
  12. package/dist/cjs/components/layout/list.cjs +1 -1
  13. package/dist/cjs/components/layout/table.cjs +1 -1
  14. package/dist/cjs/components/level/level.cjs +1 -1
  15. package/dist/cjs/components/tree/treeFilter.cjs +1 -0
  16. package/dist/cjs/components/upload/file.cjs +1 -1
  17. package/dist/cjs/components/upload/image.cjs +1 -1
  18. package/dist/cjs/components/upload/manage/item.cjs +1 -1
  19. package/dist/cjs/components/upload/manager.cjs +1 -1
  20. package/dist/cjs/hooks/dialog.cjs +1 -1
  21. package/dist/cjs/hooks/drawer.cjs +1 -1
  22. package/dist/cjs/hooks/modal.cjs +1 -1
  23. package/dist/cjs/hooks/table/image.cjs +1 -1
  24. package/dist/cjs/hooks/table/media.cjs +1 -1
  25. package/dist/cjs/index.cjs +1 -1
  26. package/dist/cjs/langs/en-US.json.cjs +1 -1
  27. package/dist/cjs/langs/zh-CN.json.cjs +1 -1
  28. package/dist/cjs/pages/authLayout.cjs +1 -1
  29. package/dist/cjs/pages/layout/page.cjs +1 -1
  30. package/dist/cjs/pages/login.cjs +1 -1
  31. package/dist/cjs/pages/menu/avatar.cjs +1 -1
  32. package/dist/cjs/pages/menu/button.cjs +1 -1
  33. package/dist/cjs/pages/menu/cmd.cjs +1 -1
  34. package/dist/cjs/pages/menu/main.cjs +1 -1
  35. package/dist/cjs/pages/menu/mobile.cjs +1 -1
  36. package/dist/cjs/pages/page404.cjs +1 -1
  37. package/dist/cjs/pages/pageStatus.cjs +1 -1
  38. package/dist/cjs/theme/uno.css.cjs +6 -2
  39. package/dist/esm/component.js +44 -41
  40. package/dist/esm/components/chart/echart.js +3 -2
  41. package/dist/esm/components/crop/imageCrop.js +3 -2
  42. package/dist/esm/components/data/dynamicSelect.js +8 -7
  43. package/dist/esm/components/data/selectModal.js +3 -2
  44. package/dist/esm/components/form/formItem.js +10 -10
  45. package/dist/esm/components/form/modalForm.js +5 -4
  46. package/dist/esm/components/form/pageForm.js +3 -2
  47. package/dist/esm/components/form/settingForm.js +18 -17
  48. package/dist/esm/components/icon/icon.js +78 -0
  49. package/dist/esm/components/icon/iconPicker.js +83 -0
  50. package/dist/esm/components/layout/list.js +3 -2
  51. package/dist/esm/components/layout/table.js +3 -2
  52. package/dist/esm/components/level/level.js +3 -2
  53. package/dist/esm/components/tree/treeFilter.js +207 -0
  54. package/dist/esm/components/upload/file.js +3 -2
  55. package/dist/esm/components/upload/image.js +3 -2
  56. package/dist/esm/components/upload/manage/item.js +3 -2
  57. package/dist/esm/components/upload/manager.js +3 -2
  58. package/dist/esm/hooks/dialog.js +3 -2
  59. package/dist/esm/hooks/drawer.js +3 -2
  60. package/dist/esm/hooks/modal.js +3 -2
  61. package/dist/esm/hooks/table/image.js +3 -2
  62. package/dist/esm/hooks/table/media.js +4 -3
  63. package/dist/esm/index.js +201 -195
  64. package/dist/esm/langs/en-US.json.js +1 -1
  65. package/dist/esm/langs/zh-CN.json.js +1 -1
  66. package/dist/esm/pages/authLayout.js +10 -9
  67. package/dist/esm/pages/layout/page.js +16 -15
  68. package/dist/esm/pages/login.js +6 -5
  69. package/dist/esm/pages/menu/avatar.js +3 -2
  70. package/dist/esm/pages/menu/button.js +6 -5
  71. package/dist/esm/pages/menu/cmd.js +3 -2
  72. package/dist/esm/pages/menu/main.js +3 -2
  73. package/dist/esm/pages/menu/mobile.js +3 -2
  74. package/dist/esm/pages/page404.js +1 -0
  75. package/dist/esm/pages/pageStatus.js +5 -4
  76. package/dist/esm/theme/uno.css.js +6 -2
  77. package/dist/types/components/icon/icon.d.ts +7 -0
  78. package/dist/types/components/icon/iconPicker.d.ts +9 -0
  79. package/dist/types/components/icon/index.d.ts +2 -0
  80. package/dist/types/components/index.d.ts +2 -0
  81. package/dist/types/components/tree/index.d.ts +1 -0
  82. package/dist/types/components/tree/treeFilter.d.ts +23 -0
  83. package/package.json +3 -3
@@ -1,4 +1,4 @@
1
- import { defineComponent as x, toRef as b, computed as r, watch as g, inject as h, createVNode as l, createTextVNode as y } from "vue";
1
+ import { defineComponent as x, toRef as g, computed as r, watch as b, inject as h, createVNode as l, createTextVNode as y } from "vue";
2
2
  import { watchThrottled as j } from "@vueuse/core";
3
3
  import { useField as S } from "vee-validate";
4
4
  const p = /* @__PURE__ */ x({
@@ -17,9 +17,9 @@ const p = /* @__PURE__ */ x({
17
17
  message: [String, Object]
18
18
  },
19
19
  setup(e, {
20
- slots: i
20
+ slots: a
21
21
  }) {
22
- const c = b(e.message), {
22
+ const c = g(e.message), {
23
23
  errorMessage: d,
24
24
  value: m,
25
25
  setErrors: f,
@@ -27,7 +27,7 @@ const p = /* @__PURE__ */ x({
27
27
  } = S(e.path || "", e.rule || {}, {
28
28
  label: e.label
29
29
  }), o = r(() => e.rule ? typeof e.rule == "string" ? e.rule.includes("required") : typeof e.rule == "object" ? "required" in e.rule : !1 : !1), n = r(() => d.value && (c.value || d.value));
30
- g(n, (t) => {
30
+ b(n, (t) => {
31
31
  t && f(t);
32
32
  }, {
33
33
  immediate: !0
@@ -41,16 +41,16 @@ const p = /* @__PURE__ */ x({
41
41
  labelPlacement: "left",
42
42
  labelWidth: 70,
43
43
  divider: !1
44
- }), a = r(() => e.labelPlacement || u.labelPlacement), v = r(() => {
44
+ }), i = r(() => e.labelPlacement || u.labelPlacement), v = r(() => {
45
45
  let t = e.labelWidth || u.labelWidth || 70;
46
- return typeof t == "number" && (t = `${t}px`), a.value === "top" || a.value === "setting" ? "auto" : t;
46
+ return typeof t == "number" && (t = `${t}px`), i.value === "top" || i.value === "setting" ? "auto" : t;
47
47
  });
48
48
  return () => {
49
49
  var t;
50
50
  return l("div", {
51
- class: ["flex flex-col ", a.value !== "top" ? "md:flex-row gap-2" : "gap-1", u.divider && "pb-4", a.value === "setting" ? "md:justify-between md:items-start md:gap-4" : ""]
51
+ class: ["flex flex-col lg:items-center", i.value !== "top" ? "md:flex-row gap-2" : "gap-1", u.divider && "pb-4", i.value === "setting" ? "md:justify-between md:items-start md:gap-4" : ""]
52
52
  }, [l("div", {
53
- class: [a.value !== "top" && a.value !== "setting" ? "mt-1.5" : ""],
53
+ class: [i.value !== "top" && i.value !== "setting" ? "flex lg:items-center" : ""],
54
54
  style: {
55
55
  width: v.value
56
56
  }
@@ -63,8 +63,8 @@ const p = /* @__PURE__ */ x({
63
63
  }, [y("*")])])]), e.description && typeof e.description == "string" && l("div", {
64
64
  class: "text-sm text-muted"
65
65
  }, [e.description])])]), l("div", {
66
- class: ["flex flex-col gap-1", a.value !== "left" ? "md:mt-1" : "", a.value === "setting" ? "flex-none" : "flex-1"]
67
- }, [l("div", null, [(t = i == null ? void 0 : i.default) == null ? void 0 : t.call(i)]), e.description && typeof e.description != "string" && l("div", {
66
+ class: ["flex flex-col gap-1", i.value !== "left" ? "md:mt-1" : "", i.value === "setting" ? "flex-none" : "flex-1"]
67
+ }, [l("div", null, [(t = a == null ? void 0 : a.default) == null ? void 0 : t.call(a)]), e.description && typeof e.description != "string" && l("div", {
68
68
  class: "text-sm text-muted"
69
69
  }, [e.description]), n.value && l("div", {
70
70
  class: "text-error"
@@ -1,4 +1,4 @@
1
- import { defineComponent as C, computed as p, toRef as x, createVNode as m, Fragment as F, resolveComponent as a, mergeProps as E, isVNode as v } from "vue";
1
+ import { defineComponent as p, computed as C, toRef as x, createVNode as m, Fragment as F, resolveComponent as a, mergeProps as E, isVNode as v } from "vue";
2
2
  import { useI18n as h, useExtendForm as j } from "@duxweb/dvha-core";
3
3
  import { useMessage as D } from "naive-ui";
4
4
  import "clsx";
@@ -30,10 +30,11 @@ import "@vee-validate/i18n/dist/locale/en.json";
30
30
  import "@vee-validate/i18n/dist/locale/zh_CN.json";
31
31
  import "vue-command-palette";
32
32
  import "../../pages/page404.js";
33
+ import "@iconify-json/tabler/icons.json";
33
34
  function d(t) {
34
35
  return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !v(t);
35
36
  }
36
- const dt = /* @__PURE__ */ C({
37
+ const ft = /* @__PURE__ */ p({
37
38
  name: "DuxModalForm",
38
39
  props: {
39
40
  id: {
@@ -67,7 +68,7 @@ const dt = /* @__PURE__ */ C({
67
68
  }) {
68
69
  const {
69
70
  t: n
70
- } = h(), f = p(() => {
71
+ } = h(), f = C(() => {
71
72
  const {
72
73
  onClose: o,
73
74
  onSuccess: e,
@@ -130,5 +131,5 @@ const dt = /* @__PURE__ */ C({
130
131
  }
131
132
  });
132
133
  export {
133
- dt as DuxModalForm
134
+ ft as DuxModalForm
134
135
  };
@@ -12,6 +12,7 @@ import "lodash-es";
12
12
  import "vue-draggable-plus";
13
13
  import "aieditor";
14
14
  import "vee-validate";
15
+ import "@iconify-json/tabler/icons.json";
15
16
  import "mime";
16
17
  import "dayjs";
17
18
  import "@tanstack/vue-query";
@@ -29,7 +30,7 @@ import "@vee-validate/i18n/dist/locale/zh_CN.json";
29
30
  import "vue-command-palette";
30
31
  import { DuxPage as b } from "../../pages/page.js";
31
32
  import "../../pages/page404.js";
32
- const U = /* @__PURE__ */ p({
33
+ const W = /* @__PURE__ */ p({
33
34
  name: "DuxPageForm",
34
35
  props: {
35
36
  id: {
@@ -105,5 +106,5 @@ const U = /* @__PURE__ */ p({
105
106
  }
106
107
  });
107
108
  export {
108
- U as DuxPageForm
109
+ W as DuxPageForm
109
110
  };
@@ -12,6 +12,7 @@ import "lodash-es";
12
12
  import "vue-draggable-plus";
13
13
  import "aieditor";
14
14
  import "vee-validate";
15
+ import "@iconify-json/tabler/icons.json";
15
16
  import "mime";
16
17
  import "dayjs";
17
18
  import "@tanstack/vue-query";
@@ -29,7 +30,7 @@ import "@vee-validate/i18n/dist/locale/zh_CN.json";
29
30
  import "vue-command-palette";
30
31
  import { DuxPage as v } from "../../pages/page.js";
31
32
  import "../../pages/page404.js";
32
- const Z = /* @__PURE__ */ d({
33
+ const _ = /* @__PURE__ */ d({
33
34
  name: "DuxSettingForm",
34
35
  props: {
35
36
  id: {
@@ -63,26 +64,26 @@ const Z = /* @__PURE__ */ d({
63
64
  default: "medium"
64
65
  }
65
66
  },
66
- setup(e, {
67
- slots: t
67
+ setup(t, {
68
+ slots: e
68
69
  }) {
69
- const i = l(e.defaultTab), c = p(e, "data", {}), {
70
- t: n
71
- } = x(), o = S(), u = y({
72
- id: e.id,
73
- path: e.path,
70
+ const i = l(t.defaultTab), c = p(t, "data", {}), {
71
+ t: o
72
+ } = x(), n = S(), u = y({
73
+ id: t.id,
74
+ path: t.path,
74
75
  form: c,
75
- action: e.action,
76
+ action: t.action,
76
77
  onError: (a) => {
77
78
  var m;
78
- o.error(a.message || n("components.form.error")), (m = e.onError) == null || m.call(e, a);
79
+ n.error(a.message || o("components.form.error")), (m = t.onError) == null || m.call(t, a);
79
80
  },
80
81
  onSuccess: (a) => {
81
82
  var m;
82
- o.success(n("components.form.success")), (m = e.onSuccess) == null || m.call(e, a);
83
+ n.success(o("components.form.success")), (m = t.onSuccess) == null || m.call(t, a);
83
84
  }
84
85
  }), f = g(() => {
85
- switch (e.size) {
86
+ switch (t.size) {
86
87
  case "small":
87
88
  return "lg:max-w-lg";
88
89
  case "large":
@@ -97,8 +98,8 @@ const Z = /* @__PURE__ */ d({
97
98
  var a;
98
99
  return [r("div", {
99
100
  class: `flex flex-col gap-6 w-full ${f.value} mx-auto py-4`
100
- }, [e.tabs ? r(b, {
101
- defaultValue: e.defaultTab,
101
+ }, [t.tabs ? r(b, {
102
+ defaultValue: t.defaultTab,
102
103
  value: i.value,
103
104
  onUpdateValue: (m) => {
104
105
  i.value = m;
@@ -107,13 +108,13 @@ const Z = /* @__PURE__ */ d({
107
108
  }, {
108
109
  default: () => {
109
110
  var m;
110
- return [(m = t == null ? void 0 : t.default) == null ? void 0 : m.call(t, u)];
111
+ return [(m = e == null ? void 0 : e.default) == null ? void 0 : m.call(e, u)];
111
112
  }
112
- }) : (a = t == null ? void 0 : t.default) == null ? void 0 : a.call(t, u)])];
113
+ }) : (a = e == null ? void 0 : e.default) == null ? void 0 : a.call(e, u)])];
113
114
  }
114
115
  });
115
116
  }
116
117
  });
117
118
  export {
118
- Z as DuxSettingForm
119
+ _ as DuxSettingForm
119
120
  };
@@ -0,0 +1,78 @@
1
+ import { defineComponent as n, createVNode as t } from "vue";
2
+ import { useI18n as l } from "@duxweb/dvha-core";
3
+ import { useVModel as a } from "@vueuse/core";
4
+ import { NButton as u } from "naive-ui";
5
+ import "vue-router";
6
+ import "@overlastic/vue";
7
+ import "clsx";
8
+ import "vue-echarts";
9
+ import "vue-cropper";
10
+ import "jinrishici";
11
+ import "lodash-es";
12
+ import "vue-draggable-plus";
13
+ import "aieditor";
14
+ import "vee-validate";
15
+ import "@vee-validate/i18n";
16
+ import "colorizr";
17
+ import "echarts";
18
+ import "@ant-design/colors";
19
+ import "@unocss/preset-icons/browser";
20
+ import "@unocss/preset-typography";
21
+ import "unocss/preset-wind4";
22
+ import "@vee-validate/i18n/dist/locale/en.json";
23
+ import "@vee-validate/i18n/dist/locale/zh_CN.json";
24
+ import "vue-command-palette";
25
+ import "@duxweb/dvha-naiveui";
26
+ import "../../pages/page404.js";
27
+ import "@iconify-json/tabler/icons.json";
28
+ import "mime";
29
+ import { useModal as c } from "../../hooks/modal.js";
30
+ import "dayjs";
31
+ import "@tanstack/vue-query";
32
+ import "pinia";
33
+ const O = /* @__PURE__ */ n({
34
+ name: "DuxIconPicker",
35
+ props: {
36
+ defaultValue: String,
37
+ value: String
38
+ },
39
+ setup(i, {
40
+ emit: m
41
+ }) {
42
+ const o = a(i, "value", m, {
43
+ defaultValue: i.defaultValue,
44
+ passive: !0
45
+ }), p = c(), {
46
+ t: r
47
+ } = l();
48
+ return () => t(u, {
49
+ dashed: !o.value,
50
+ onClick: () => {
51
+ p.show({
52
+ title: r("components.iconPicker.title"),
53
+ component: () => import("./iconPicker.js")
54
+ }).then((e) => {
55
+ o.value = e;
56
+ });
57
+ },
58
+ iconPlacement: "right"
59
+ }, {
60
+ default: () => t("div", {
61
+ class: "flex gap-2 items-center"
62
+ }, [o.value ? t("div", {
63
+ class: `size-4 ${o.value || ""}`
64
+ }, null) : void 0, r("components.iconPicker.title")]),
65
+ icon: () => o.value ? t("div", {
66
+ class: "rounded-full p-1 hover:bg-gray-2 hover:text-gray-7",
67
+ onClick: (e) => {
68
+ e.stopPropagation(), o.value = void 0;
69
+ }
70
+ }, [t("div", {
71
+ class: "size-4 i-tabler:x"
72
+ }, null)]) : void 0
73
+ });
74
+ }
75
+ });
76
+ export {
77
+ O as DuxIconPicker
78
+ };
@@ -0,0 +1,83 @@
1
+ import { defineComponent as h, ref as r, onMounted as C, watch as y, createVNode as a } from "vue";
2
+ import { useI18n as b } from "@duxweb/dvha-core";
3
+ import { icons as f } from "@iconify-json/tabler/icons.json";
4
+ import { useOffsetPagination as k } from "@vueuse/core";
5
+ import { NInput as x, NPagination as z } from "naive-ui";
6
+ const N = /* @__PURE__ */ h({
7
+ name: "DuxIconPicker",
8
+ props: {
9
+ onConfirm: Function,
10
+ onClose: Function
11
+ },
12
+ setup(u) {
13
+ const c = Object.keys(f), i = r(c), l = r(""), s = r([]), v = r(c.length);
14
+ function t({
15
+ currentPage: n,
16
+ currentPageSize: e
17
+ }) {
18
+ s.value = i.value.slice((n - 1) * e, n * e);
19
+ }
20
+ const {
21
+ currentPage: o,
22
+ currentPageSize: d,
23
+ pageCount: m
24
+ } = k({
25
+ total: () => v.value,
26
+ page: 1,
27
+ pageSize: 42,
28
+ onPageChange: t,
29
+ onPageSizeChange: t,
30
+ onPageCountChange: t
31
+ });
32
+ C(() => {
33
+ t({
34
+ currentPage: o.value,
35
+ currentPageSize: 42
36
+ });
37
+ }), y(l, () => {
38
+ i.value = Object.keys(f).filter((n) => n.includes(l.value)), v.value = i.value.length, o.value = 1, t({
39
+ currentPage: o.value,
40
+ currentPageSize: d.value
41
+ });
42
+ }, {
43
+ immediate: !0
44
+ });
45
+ const {
46
+ t: p
47
+ } = b();
48
+ return () => {
49
+ var n;
50
+ return a("div", {
51
+ class: "p-4 flex flex-col gap-4"
52
+ }, [a(x, {
53
+ placeholder: p("common.keyword"),
54
+ value: l.value,
55
+ "onUpdate:value": (e) => l.value = e,
56
+ clearable: !0
57
+ }, null), a("div", {
58
+ class: "grid grid-cols-6"
59
+ }, [(n = s.value) == null ? void 0 : n.map((e, P) => a("div", {
60
+ key: P,
61
+ class: "flex justify-center items-center",
62
+ onClick: () => {
63
+ var g;
64
+ (g = u.onConfirm) == null || g.call(u, `i-tabler:${e}`);
65
+ }
66
+ }, [a("div", {
67
+ class: "py-2 px-3 hover:bg-primary/10 border border-transparent hover:border-primary-hover rounded cursor-pointer transition-all"
68
+ }, [a("div", {
69
+ class: `i-tabler:${e} size-6`
70
+ }, null)])]))]), a("div", {
71
+ class: "flex justify-center"
72
+ }, [a(z, {
73
+ page: o.value,
74
+ pageSize: d.value,
75
+ pageCount: m.value,
76
+ onUpdatePage: (e) => o.value = e
77
+ }, null)])]);
78
+ };
79
+ }
80
+ });
81
+ export {
82
+ N as default
83
+ };
@@ -27,6 +27,7 @@ import "@duxweb/dvha-naiveui";
27
27
  import { DuxPage as ge } from "../../pages/page.js";
28
28
  import "../../pages/page404.js";
29
29
  import { DuxPageEmpty as ve } from "../../pages/pageEmpty.js";
30
+ import "@iconify-json/tabler/icons.json";
30
31
  import { DuxTableFilter as he } from "./filter.js";
31
32
  import { DuxTableTools as be } from "./tools.js";
32
33
  import "mime";
@@ -34,7 +35,7 @@ import "dayjs";
34
35
  import { useDrawer as xe } from "../../hooks/drawer.js";
35
36
  import "@tanstack/vue-query";
36
37
  import "pinia";
37
- const tt = /* @__PURE__ */ $({
38
+ const it = /* @__PURE__ */ $({
38
39
  name: "DuxListLayout",
39
40
  props: {
40
41
  rowKey: {
@@ -401,5 +402,5 @@ const tt = /* @__PURE__ */ $({
401
402
  }
402
403
  });
403
404
  export {
404
- tt as DuxListLayout
405
+ it as DuxListLayout
405
406
  };
@@ -26,6 +26,7 @@ import "vue-command-palette";
26
26
  import "@duxweb/dvha-naiveui";
27
27
  import { DuxPage as ve } from "../../pages/page.js";
28
28
  import "../../pages/page404.js";
29
+ import "@iconify-json/tabler/icons.json";
29
30
  import { DuxTableFilter as be } from "./filter.js";
30
31
  import { DuxTableTools as he } from "./tools.js";
31
32
  import "mime";
@@ -34,7 +35,7 @@ import { useDrawer as xe } from "../../hooks/drawer.js";
34
35
  import "@tanstack/vue-query";
35
36
  import { useTable as ye } from "../../hooks/table.js";
36
37
  import "pinia";
37
- const it = /* @__PURE__ */ $({
38
+ const at = /* @__PURE__ */ $({
38
39
  name: "DuxTableLayout",
39
40
  props: {
40
41
  path: {
@@ -364,5 +365,5 @@ const it = /* @__PURE__ */ $({
364
365
  }
365
366
  });
366
367
  export {
367
- it as DuxTableLayout
368
+ at as DuxTableLayout
368
369
  };
@@ -24,11 +24,12 @@ import "@vee-validate/i18n/dist/locale/zh_CN.json";
24
24
  import "vue-command-palette";
25
25
  import "@duxweb/dvha-naiveui";
26
26
  import "../../pages/page404.js";
27
+ import "@iconify-json/tabler/icons.json";
27
28
  import "mime";
28
29
  import "dayjs";
29
30
  import { useLevel as c } from "../../hooks/level.js";
30
31
  import "pinia";
31
- const R = /* @__PURE__ */ v({
32
+ const T = /* @__PURE__ */ v({
32
33
  name: "DuxLevel",
33
34
  props: {
34
35
  value: {
@@ -99,5 +100,5 @@ const R = /* @__PURE__ */ v({
99
100
  }
100
101
  });
101
102
  export {
102
- R as DuxLevel
103
+ T as DuxLevel
103
104
  };
@@ -0,0 +1,207 @@
1
+ import { defineComponent as Y, toRef as y, 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, NCard as $, NInput as p, NScrollbar as ee, NSpin as te, NDropdown as le } from "naive-ui";
6
+ const ce = /* @__PURE__ */ Y({
7
+ name: "DuxTreeFilter",
8
+ props: {
9
+ title: String,
10
+ path: String,
11
+ sortPath: String,
12
+ params: Object,
13
+ menus: Array,
14
+ numField: String,
15
+ iconField: String,
16
+ treeOptions: Object,
17
+ value: Array,
18
+ defaultValue: Array,
19
+ onUpdateValue: Function,
20
+ draggable: Boolean
21
+ },
22
+ extends: T,
23
+ setup(t, {
24
+ emit: U,
25
+ slots: v
26
+ }) {
27
+ const O = W(t, "value", U, {
28
+ passive: !1,
29
+ defaultValue: t.defaultValue
30
+ }), I = y(t, "params", {}), N = y(t, "path", ""), A = y(t, "sortPath", ""), V = r(), k = r(0), D = r(0), s = r([]), S = r(), {
31
+ t: K
32
+ } = H(), {
33
+ options: j,
34
+ loading: L,
35
+ expanded: M
36
+ } = J({
37
+ path: N.value,
38
+ params: I.value,
39
+ ...t.treeOptions
40
+ });
41
+ P(j, (l) => {
42
+ s.value = l;
43
+ }, {
44
+ immediate: !0,
45
+ deep: !0
46
+ });
47
+ const m = r(!1), _ = C(() => {
48
+ var l;
49
+ return ((l = t.menus) == null ? void 0 : l.map((e) => ({
50
+ label: e.label,
51
+ key: e.value,
52
+ icon: e != null && e.icon ? () => n("div", {
53
+ class: e == null ? void 0 : e.icon
54
+ }, null) : void 0,
55
+ onSelect: e.onSelect
56
+ }))) || [];
57
+ }), z = (l) => {
58
+ var a;
59
+ const e = (a = t.menus) == null ? void 0 : a.find((i) => i.value === l);
60
+ e && e.onSelect(V.value), m.value = !1;
61
+ }, B = Q({
62
+ path: A.value,
63
+ method: "POST"
64
+ }), g = (l, e) => {
65
+ for (const a of l)
66
+ if (a.children) {
67
+ for (const x of a.children)
68
+ if (x.id === e)
69
+ return a;
70
+ const i = g(a.children, e);
71
+ if (i)
72
+ return i;
73
+ }
74
+ }, E = ({
75
+ node: l,
76
+ dragNode: e,
77
+ dropPosition: a
78
+ }) => {
79
+ var F, w;
80
+ const i = g(s.value, e.id), x = !i, h = [...s.value];
81
+ if (x) {
82
+ const u = s.value.findIndex((X) => X.id === e.id);
83
+ u >= 0 && h.splice(u, 1);
84
+ } else {
85
+ const u = ((F = i == null ? void 0 : i.children) == null ? void 0 : F.indexOf(e)) || 0;
86
+ (w = i == null ? void 0 : i.children) == null || w.splice(u, 1);
87
+ }
88
+ let d = g(h, l.id), b, c = (d == null ? void 0 : d.children) || h, o = 0;
89
+ switch (a) {
90
+ case "before":
91
+ o = c.findIndex((u) => u.id === l.id), o > 0 && (b = c[o - 1].id);
92
+ break;
93
+ case "inside":
94
+ d = l, c = d.children = d.children || [], o = c.length;
95
+ break;
96
+ case "after":
97
+ o = c.findIndex((u) => u.id === l.id) + 1, b = l.id;
98
+ break;
99
+ }
100
+ c.splice(o, 0, e), s.value = h, B.mutate({
101
+ payload: {
102
+ parent_id: d == null ? void 0 : d.id,
103
+ before_id: b,
104
+ id: e.id
105
+ }
106
+ });
107
+ }, f = r([]);
108
+ P(M, (l) => {
109
+ var e;
110
+ ((e = f == null ? void 0 : f.value) == null ? void 0 : e.length) > 0 || (f.value = l);
111
+ }, {
112
+ immediate: !0
113
+ });
114
+ const R = C(() => {
115
+ const {
116
+ title: l,
117
+ path: e,
118
+ sortPath: a,
119
+ params: i,
120
+ menus: x,
121
+ numField: h,
122
+ iconField: d,
123
+ treeOptions: b,
124
+ value: c,
125
+ defaultValue: o,
126
+ draggable: F,
127
+ onUpdateValue: w,
128
+ ...u
129
+ } = t;
130
+ return u;
131
+ });
132
+ return () => n($, {
133
+ class: "h-full",
134
+ contentClass: "p-0! h-full flex flex-col"
135
+ }, {
136
+ default: () => {
137
+ var l;
138
+ return [(t == null ? void 0 : t.title) && n("div", {
139
+ class: "px-2 py-3 pb-1 text-base font-bold"
140
+ }, [t.title]), n("div", {
141
+ class: "p-2 flex gap-2 items-center"
142
+ }, [n("div", {
143
+ class: "flex-1"
144
+ }, [v.header ? v.header() : n(p, {
145
+ value: S.value,
146
+ "onUpdate:value": (e) => S.value = e,
147
+ placeholder: K("common.keyword")
148
+ }, null)]), (l = v.tools) == null ? void 0 : l.call(v)]), n(ee, {
149
+ class: "flex-1 min-h-0",
150
+ xScrollable: !0
151
+ }, {
152
+ default: () => [n("div", {
153
+ class: "p-2"
154
+ }, [n(te, {
155
+ show: L.value,
156
+ class: "h-full"
157
+ }, {
158
+ default: () => [n(T, q(R.value, {
159
+ data: s.value || [],
160
+ expandedKeys: f.value,
161
+ onUpdateExpandedKeys: (e) => {
162
+ f.value = e;
163
+ },
164
+ blockLine: !0,
165
+ selectedKeys: O.value,
166
+ onUpdateSelectedKeys: (e) => {
167
+ var a;
168
+ O.value = e, (a = t == null ? void 0 : t.onUpdateValue) == null || a.call(t, e);
169
+ },
170
+ onDrop: E,
171
+ pattern: S.value,
172
+ renderPrefix: t != null && t.numField || t != null && t.iconField ? ({
173
+ option: e
174
+ }) => n(G, null, [t.iconField && e[t.iconField] && n("div", {
175
+ class: Z(e[t.iconField] || "", "size-4")
176
+ }, null), t.numField && n("div", {
177
+ class: "rounded-full bg-primary px-2 text-xs text-white"
178
+ }, [e[t.numField] || 0])]) : void 0,
179
+ nodeProps: ({
180
+ option: e
181
+ }) => ({
182
+ onContextmenu: (a) => {
183
+ V.value = e, m.value = !0, k.value = a.clientX, D.value = a.clientY, a.preventDefault();
184
+ }
185
+ })
186
+ }), null)]
187
+ })])]
188
+ }), n(le, {
189
+ trigger: "manual",
190
+ placement: "bottom-start",
191
+ show: m.value,
192
+ options: _.value,
193
+ x: k.value,
194
+ y: D.value,
195
+ width: 100,
196
+ onSelect: z,
197
+ onClickoutside: () => {
198
+ m.value = !1;
199
+ }
200
+ }, null)];
201
+ }
202
+ });
203
+ }
204
+ });
205
+ export {
206
+ ce as DuxTreeFilter
207
+ };
@@ -26,6 +26,7 @@ import "@vee-validate/i18n/dist/locale/zh_CN.json";
26
26
  import "vue-command-palette";
27
27
  import "@duxweb/dvha-naiveui";
28
28
  import "../../pages/page404.js";
29
+ import "@iconify-json/tabler/icons.json";
29
30
  import { useModal as G } from "../../hooks/modal.js";
30
31
  import "dayjs";
31
32
  import "@tanstack/vue-query";
@@ -64,7 +65,7 @@ const m = {
64
65
  empty: "flex items-center justify-center h-full text-muted",
65
66
  actions: "flex gap-2"
66
67
  }
67
- }, Se = /* @__PURE__ */ M({
68
+ }, Ce = /* @__PURE__ */ M({
68
69
  name: "DuxFileUpload",
69
70
  props: {
70
71
  path: {
@@ -254,5 +255,5 @@ const m = {
254
255
  }
255
256
  });
256
257
  export {
257
- Se as DuxFileUpload
258
+ Ce as DuxFileUpload
258
259
  };
@@ -24,13 +24,14 @@ import "@vee-validate/i18n/dist/locale/zh_CN.json";
24
24
  import "vue-command-palette";
25
25
  import "@duxweb/dvha-naiveui";
26
26
  import "../../pages/page404.js";
27
+ import "@iconify-json/tabler/icons.json";
27
28
  import "mime";
28
29
  import { useModal as L } from "../../hooks/modal.js";
29
30
  import "dayjs";
30
31
  import { useImagePreview as O } from "../../hooks/image.js";
31
32
  import "@tanstack/vue-query";
32
33
  import "pinia";
33
- const fe = /* @__PURE__ */ U({
34
+ const be = /* @__PURE__ */ U({
34
35
  name: "DuxImageUpload",
35
36
  props: {
36
37
  path: {
@@ -185,5 +186,5 @@ const fe = /* @__PURE__ */ U({
185
186
  }
186
187
  });
187
188
  export {
188
- fe as DuxImageUpload
189
+ be as DuxImageUpload
189
190
  };