@duxweb/dvha-pro 1.1.4 → 1.1.6

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 (36) hide show
  1. package/dist/cjs/components/editor/aiEditor.cjs +1 -1
  2. package/dist/cjs/components/form/drawerForm.cjs +1 -1
  3. package/dist/cjs/components/form/modalForm.cjs +1 -1
  4. package/dist/cjs/components/form/pageForm.cjs +1 -1
  5. package/dist/cjs/components/form/pageTabForm.cjs +1 -1
  6. package/dist/cjs/components/form/settingForm.cjs +1 -1
  7. package/dist/cjs/components/tree/treeFilter.cjs +1 -1
  8. package/dist/cjs/components/upload/file.cjs +1 -1
  9. package/dist/cjs/components/upload/image.cjs +1 -1
  10. package/dist/cjs/hooks/table/input.cjs +1 -1
  11. package/dist/cjs/hooks/table/switch.cjs +1 -1
  12. package/dist/cjs/langs/en-US.json.cjs +1 -1
  13. package/dist/cjs/langs/zh-CN.json.cjs +1 -1
  14. package/dist/cjs/theme/uno.css.cjs +4 -1
  15. package/dist/esm/components/editor/aiEditor.js +62 -61
  16. package/dist/esm/components/form/drawerForm.js +30 -22
  17. package/dist/esm/components/form/modalForm.js +18 -10
  18. package/dist/esm/components/form/pageForm.js +26 -18
  19. package/dist/esm/components/form/pageTabForm.js +32 -24
  20. package/dist/esm/components/form/settingForm.js +29 -21
  21. package/dist/esm/components/tree/treeFilter.js +50 -49
  22. package/dist/esm/components/upload/file.js +25 -26
  23. package/dist/esm/components/upload/image.js +60 -64
  24. package/dist/esm/hooks/table/input.js +74 -40
  25. package/dist/esm/hooks/table/switch.js +15 -15
  26. package/dist/esm/langs/en-US.json.js +1 -1
  27. package/dist/esm/langs/zh-CN.json.js +1 -1
  28. package/dist/esm/theme/uno.css.js +4 -1
  29. package/dist/types/components/form/drawerForm.d.ts +12 -0
  30. package/dist/types/components/form/modalForm.d.ts +12 -0
  31. package/dist/types/components/form/pageForm.d.ts +12 -0
  32. package/dist/types/components/form/pageTabForm.d.ts +12 -0
  33. package/dist/types/components/form/settingForm.d.ts +12 -0
  34. package/dist/types/hooks/table/input.d.ts +3 -0
  35. package/dist/types/hooks/table/switch.d.ts +1 -0
  36. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as s, ref as c, toRef as d, computed as f, createVNode as i } from "vue";
2
- import { useI18n as g, useInvalidate as x, useExtendForm as y } from "@duxweb/dvha-core";
3
- import { useMessage as v, NTabs as S } from "naive-ui";
2
+ import { useI18n as g, useInvalidate as y, useExtendForm as x } from "@duxweb/dvha-core";
3
+ import { useMessage as b, NTabs as v } from "naive-ui";
4
4
  import "@overlastic/vue";
5
5
  import "vue-router";
6
6
  import "clsx";
@@ -59,9 +59,9 @@ import "unocss/preset-wind4";
59
59
  import "@vee-validate/i18n/dist/locale/en.json";
60
60
  import "@vee-validate/i18n/dist/locale/zh_CN.json";
61
61
  import "vue-command-palette";
62
- import { DuxPage as b } from "../../pages/page.js";
62
+ import { DuxPage as S } from "../../pages/page.js";
63
63
  import "../../pages/page404.js";
64
- const Ct = /* @__PURE__ */ s({
64
+ const Ot = /* @__PURE__ */ s({
65
65
  name: "DuxSettingForm",
66
66
  props: {
67
67
  id: {
@@ -76,6 +76,12 @@ const Ct = /* @__PURE__ */ s({
76
76
  data: {
77
77
  type: Object
78
78
  },
79
+ meta: {
80
+ type: Object
81
+ },
82
+ params: {
83
+ type: Object
84
+ },
79
85
  onSuccess: {
80
86
  type: Function
81
87
  },
@@ -99,22 +105,24 @@ const Ct = /* @__PURE__ */ s({
99
105
  }
100
106
  },
101
107
  setup(t, {
102
- slots: r
108
+ slots: o
103
109
  }) {
104
- const e = c(t.defaultTab), n = d(t, "data", {}), {
105
- t: m
106
- } = g(), a = v(), {
110
+ const m = c(t.defaultTab), n = d(t, "data", {}), {
111
+ t: r
112
+ } = g(), a = b(), {
107
113
  invalidate: u
108
- } = x(), p = y({
114
+ } = y(), p = x({
109
115
  id: t.id,
110
116
  path: t.path,
111
117
  form: n,
118
+ meta: t.meta,
119
+ params: t.params,
112
120
  action: t.action,
113
- onError: (o) => {
114
- a.error(o.message || m("components.form.error")), t.onError?.(o);
121
+ onError: (e) => {
122
+ a.error(e.message || r("components.form.error")), t.onError?.(e);
115
123
  },
116
- onSuccess: (o) => {
117
- a.success(m("components.form.success")), t.onSuccess?.(o), t.invalidate && u(t.invalidate);
124
+ onSuccess: (e) => {
125
+ a.success(r("components.form.success")), t.onSuccess?.(e), t.invalidate && u(t.invalidate);
118
126
  }
119
127
  }), l = f(() => {
120
128
  switch (t.size) {
@@ -127,22 +135,22 @@ const Ct = /* @__PURE__ */ s({
127
135
  return "lg:max-w-2xl";
128
136
  }
129
137
  });
130
- return () => i(b, null, {
138
+ return () => i(S, null, {
131
139
  default: () => [i("div", {
132
140
  class: `flex flex-col gap-6 w-full ${l.value} mx-auto py-4`
133
- }, [t.tabs ? i(S, {
141
+ }, [t.tabs ? i(v, {
134
142
  defaultValue: t.defaultTab,
135
- value: e.value,
136
- onUpdateValue: (o) => {
137
- e.value = o;
143
+ value: m.value,
144
+ onUpdateValue: (e) => {
145
+ m.value = e;
138
146
  },
139
147
  type: "segment"
140
148
  }, {
141
- default: () => [r?.default?.(p)]
142
- }) : r?.default?.(p)])]
149
+ default: () => [o?.default?.(p)]
150
+ }) : o?.default?.(p)])]
143
151
  });
144
152
  }
145
153
  });
146
154
  export {
147
- Ct as DuxSettingForm
155
+ Ot as DuxSettingForm
148
156
  };
@@ -1,10 +1,10 @@
1
- import { defineComponent as q, toRef as S, ref as u, watch as V, computed as C, createVNode as n, mergeProps as G, Fragment as H } from "vue";
2
- import { useI18n as J, useTree as Q, useCustomMutation as W } from "@duxweb/dvha-core";
1
+ import { defineComponent as Y, toRef as w, ref as u, watch as C, computed as K, createVNode as n, mergeProps as q, Fragment as G } from "vue";
2
+ import { useI18n as H, useTree as Q, useCustomMutation as W } from "@duxweb/dvha-core";
3
3
  import { useVModel as Z } from "@vueuse/core";
4
4
  import $ from "clsx";
5
- import { NTree as K, NInput as ee, NButton as le, NScrollbar as te, NSpin as ne, NDropdown as ae } from "naive-ui";
5
+ import { NTree as N, NInput as ee, NButton as le, NScrollbar as te, NSpin as ne, NDropdown as ae } from "naive-ui";
6
6
  import { DuxCard as ie } from "../card/card.js";
7
- const fe = /* @__PURE__ */ q({
7
+ const fe = /* @__PURE__ */ Y({
8
8
  name: "DuxTreeFilter",
9
9
  props: {
10
10
  title: String,
@@ -24,32 +24,32 @@ const fe = /* @__PURE__ */ q({
24
24
  default: !1
25
25
  }
26
26
  },
27
- extends: K,
27
+ extends: N,
28
28
  setup(t, {
29
29
  emit: T,
30
30
  slots: b
31
31
  }) {
32
- const w = Z(t, "value", T, {
32
+ const F = Z(t, "value", T, {
33
33
  passive: !1,
34
34
  defaultValue: t.defaultValue
35
- }), U = S(t, "params", {}), A = S(t, "path", ""), I = S(t, "sortPath", ""), F = u(), P = u(0), k = u(0), r = u([]), y = u(), {
36
- t: N
37
- } = J(), {
38
- options: E,
39
- loading: B,
40
- expanded: j
35
+ }), U = w(t, "params", {}), A = w(t, "path", ""), I = w(t, "sortPath", ""), k = u(), P = u(0), O = u(0), o = u([]), y = u(), {
36
+ t: E
37
+ } = H(), {
38
+ options: B,
39
+ loading: j,
40
+ expanded: L
41
41
  } = Q({
42
42
  path: A.value,
43
43
  params: U.value,
44
44
  ...t.treeOptions
45
45
  });
46
- V(E, (e) => {
47
- r.value = e;
46
+ C(B, (e) => {
47
+ o.value = e;
48
48
  }, {
49
49
  immediate: !0,
50
50
  deep: !0
51
51
  });
52
- const p = u(!1), L = C(() => t.menus?.map((e) => ({
52
+ const p = u(!1), g = K(() => t.menus?.map((e) => ({
53
53
  label: e.label,
54
54
  key: e.value,
55
55
  icon: e?.icon ? () => n("div", {
@@ -58,34 +58,34 @@ const fe = /* @__PURE__ */ q({
58
58
  onSelect: e.onSelect
59
59
  })) || []), M = (e) => {
60
60
  const l = t.menus?.find((a) => a.value === e);
61
- l && l.onSelect(F.value), p.value = !1;
61
+ l && l.onSelect(k.value), p.value = !1;
62
62
  }, _ = W({
63
63
  path: I.value,
64
64
  method: "POST"
65
- }), g = (e, l) => {
65
+ }), S = (e, l) => {
66
66
  for (const a of e)
67
67
  if (a.children) {
68
68
  for (const i of a.children)
69
69
  if (i.id === l)
70
70
  return a;
71
- const o = g(a.children, l);
72
- if (o)
73
- return o;
71
+ const r = S(a.children, l);
72
+ if (r)
73
+ return r;
74
74
  }
75
75
  }, z = ({
76
76
  node: e,
77
77
  dragNode: l,
78
78
  dropPosition: a
79
79
  }) => {
80
- const o = g(r.value, l.id), i = !o, m = [...r.value];
80
+ const r = S(o.value, l.id), i = !r, m = [...o.value];
81
81
  if (i) {
82
- const d = r.value.findIndex((O) => O.id === l.id);
82
+ const d = o.value.findIndex((V) => V.id === l.id);
83
83
  d >= 0 && m.splice(d, 1);
84
84
  } else {
85
- const d = o?.children?.indexOf(l) || 0;
86
- o?.children?.splice(d, 1);
85
+ const d = r?.children?.indexOf(l) || 0;
86
+ r?.children?.splice(d, 1);
87
87
  }
88
- let h = g(m, e.id), x, s = h?.children || m, c = 0;
88
+ let h = S(m, e.id), x, s = h?.children || m, c = 0;
89
89
  switch (a) {
90
90
  case "before":
91
91
  c = s.findIndex((d) => d.id === e.id), c > 0 && (x = s[c - 1].id);
@@ -97,7 +97,7 @@ const fe = /* @__PURE__ */ q({
97
97
  c = s.findIndex((d) => d.id === e.id) + 1, x = e.id;
98
98
  break;
99
99
  }
100
- s.splice(c, 0, l), r.value = m, _.mutate({
100
+ s.splice(c, 0, l), o.value = m, _.mutate({
101
101
  payload: {
102
102
  parent_id: h?.id,
103
103
  before_id: x,
@@ -105,26 +105,26 @@ const fe = /* @__PURE__ */ q({
105
105
  }
106
106
  });
107
107
  }, f = u([]), v = u(!1);
108
- V(j, (e) => {
108
+ C(L, (e) => {
109
109
  f?.value?.length > 0 || (v.value = e.length > 0, f.value = e);
110
110
  }, {
111
111
  immediate: !0
112
112
  });
113
113
  const D = (e) => {
114
- const l = [], a = (o) => {
115
- o.forEach((i) => {
114
+ const l = [], a = (r) => {
115
+ r.forEach((i) => {
116
116
  i.children && i.children.length > 0 && (l.push(i.key || i.id), a(i.children));
117
117
  });
118
118
  };
119
119
  return a(e), l;
120
- }, R = () => {
121
- v.value ? (f.value = [], v.value = !1) : (f.value = D(r.value), v.value = !0);
122
- }, X = C(() => {
120
+ }, J = () => {
121
+ v.value ? (f.value = [], v.value = !1) : (f.value = D(o.value), v.value = !0);
122
+ }, R = K(() => {
123
123
  const {
124
124
  title: e,
125
125
  path: l,
126
126
  sortPath: a,
127
- params: o,
127
+ params: r,
128
128
  menus: i,
129
129
  numField: m,
130
130
  iconField: h,
@@ -132,10 +132,10 @@ const fe = /* @__PURE__ */ q({
132
132
  value: s,
133
133
  defaultValue: c,
134
134
  onUpdateValue: d,
135
- bordered: O,
136
- ...Y
135
+ bordered: V,
136
+ ...X
137
137
  } = t;
138
- return Y;
138
+ return X;
139
139
  });
140
140
  return () => n(ie, {
141
141
  class: "h-full",
@@ -151,11 +151,11 @@ const fe = /* @__PURE__ */ q({
151
151
  }, [b.header ? b.header() : n(ee, {
152
152
  value: y.value,
153
153
  "onUpdate:value": (e) => y.value = e,
154
- placeholder: N("common.keyword")
154
+ placeholder: E("common.keyword")
155
155
  }, {
156
156
  prefix: () => n(le, {
157
157
  text: !0,
158
- onClick: R,
158
+ onClick: J,
159
159
  class: "mr-1!"
160
160
  }, {
161
161
  icon: () => n("div", {
@@ -169,27 +169,28 @@ const fe = /* @__PURE__ */ q({
169
169
  default: () => [n("div", {
170
170
  class: "p-2"
171
171
  }, [n(ne, {
172
- show: B.value,
172
+ show: j.value,
173
173
  class: "h-full"
174
174
  }, {
175
- default: () => [n(K, G(X.value, {
176
- data: r.value || [],
175
+ default: () => [n(N, q(R.value, {
176
+ key: JSON.stringify(o.value),
177
+ data: o.value || [],
177
178
  expandedKeys: f.value,
178
179
  onUpdateExpandedKeys: (e) => {
179
180
  f.value = e;
180
- const l = D(r.value);
181
+ const l = D(o.value);
181
182
  v.value = l.length > 0 && l.every((a) => e.includes(a));
182
183
  },
183
184
  blockLine: !0,
184
- selectedKeys: w.value,
185
+ selectedKeys: F.value,
185
186
  onUpdateSelectedKeys: (e) => {
186
- w.value = e, t?.onUpdateValue?.(e);
187
+ F.value = e, t?.onUpdateValue?.(e);
187
188
  },
188
189
  onDrop: z,
189
190
  pattern: y.value,
190
191
  renderPrefix: t?.numField || t?.iconField ? ({
191
192
  option: e
192
- }) => n(H, null, [t.iconField && e[t.iconField] && n("div", {
193
+ }) => n(G, null, [t.iconField && e[t.iconField] && n("div", {
193
194
  class: $(e[t.iconField] || "", "size-4")
194
195
  }, null), t.numField && n("div", {
195
196
  class: "rounded-full bg-primary px-2 text-xs text-white"
@@ -198,18 +199,18 @@ const fe = /* @__PURE__ */ q({
198
199
  option: e
199
200
  }) => ({
200
201
  onContextmenu: (l) => {
201
- F.value = e, p.value = !0, P.value = l.clientX, k.value = l.clientY, l.preventDefault();
202
+ g.value?.length && (k.value = e, p.value = !0, P.value = l.clientX, O.value = l.clientY, l.preventDefault());
202
203
  }
203
204
  })
204
205
  }), null)]
205
206
  })])]
206
- }), n(ae, {
207
+ }), g.value?.length > 0 && n(ae, {
207
208
  trigger: "manual",
208
209
  placement: "bottom-start",
209
210
  show: p.value,
210
- options: L.value,
211
+ options: g.value,
211
212
  x: P.value,
212
- y: k.value,
213
+ y: O.value,
213
214
  width: 100,
214
215
  onSelect: M,
215
216
  onClickoutside: () => {
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as U, ref as c, computed as s, watch as b, nextTick as w, createVNode as o, Fragment as Z, createTextVNode as j, isVNode as O } from "vue";
2
2
  import { useI18n as B, useUpload as T } from "@duxweb/dvha-core";
3
- import { useVModel as X, useDropZone as E } from "@vueuse/core";
4
- import L from "mime";
3
+ import { useVModel as X, useDropZone as L } from "@vueuse/core";
4
+ import E from "mime";
5
5
  import { useMessage as I, NDataTable as W, NProgress as G, NButton as F } from "naive-ui";
6
6
  import "vue-router";
7
7
  import "@overlastic/vue";
@@ -130,6 +130,7 @@ const d = {
130
130
  setup(t, {
131
131
  emit: S
132
132
  }) {
133
+ console.log("props", t);
133
134
  const u = X(t, "value", S, {
134
135
  passive: !0,
135
136
  deep: !0,
@@ -148,7 +149,7 @@ const d = {
148
149
  uploadPath: t?.path,
149
150
  managePath: t?.managePath,
150
151
  method: t?.method
151
- }), n = T({
152
+ }), l = T({
152
153
  path: g.value,
153
154
  multiple: t.multiple,
154
155
  maxFileCount: t.maxNum,
@@ -159,29 +160,27 @@ const d = {
159
160
  driver: k.value,
160
161
  method: v.value
161
162
  }), {
162
- isOverDropZone: x
163
- } = E(f, {
163
+ isOverDropZone: h
164
+ } = L(f, {
164
165
  onDrop: (e) => {
165
- e && e.length > 0 && n.addFiles(Array.from(e), "file");
166
+ e && e.length > 0 && l.addFiles(Array.from(e), "file");
166
167
  }
167
168
  }), p = c(!1);
168
- b(n.dataFiles, (e) => {
169
+ b(l.dataFiles, (e) => {
169
170
  const i = t.multiple ? e : e[0];
170
171
  p.value = !0, u.value = i, t.onUpdateValue?.(i), w(() => {
171
172
  p.value = !1;
172
173
  });
173
174
  });
174
- const h = s(() => t.accept ? t.accept.split(",").map((e) => {
175
+ const x = s(() => t.accept ? t.accept.split(",").map((e) => {
175
176
  const i = e.trim();
176
177
  if (d[i]) return d[i];
177
178
  if (i.includes("*")) {
178
179
  const A = i.split("/")[0];
179
- return d[i] || a("common.fileExtension", {
180
- ext: A.toUpperCase()
181
- });
180
+ return d[i] || A.toUpperCase();
182
181
  }
183
- const l = L.getExtension(i);
184
- return l ? l.toUpperCase() : i;
182
+ const n = E.getExtension(i);
183
+ return n ? n.toUpperCase() : i;
185
184
  }).filter(Boolean).join(", ") : ""), z = s(() => ({
186
185
  pending: o("div", {
187
186
  class: "text-info"
@@ -195,13 +194,13 @@ const d = {
195
194
  error: o("div", {
196
195
  class: "text-error"
197
196
  }, [a("components.upload.status.error")])
198
- })), D = s(() => [r.dropZone.base, x.value ? r.dropZone.active : r.dropZone.hover]), M = s(() => [n.uploadFiles.value.length === 0 && "border-b border-muted"]), y = c(!1);
197
+ })), D = s(() => [r.dropZone.base, h.value ? r.dropZone.active : r.dropZone.hover]), M = s(() => [l.uploadFiles.value.length === 0 && "border-b border-muted"]), y = c(!1);
199
198
  return b(u, (e) => {
200
199
  if (p.value || !e || !e?.length || y.value)
201
200
  return;
202
201
  y.value = !0;
203
202
  const i = Array.isArray(e) ? e : [e];
204
- n.addDataFiles(i);
203
+ l.addDataFiles(i);
205
204
  }, {
206
205
  immediate: !0
207
206
  }), () => o("div", {
@@ -209,7 +208,7 @@ const d = {
209
208
  }, [o("div", {
210
209
  ref: f,
211
210
  class: D.value,
212
- onClick: () => n.open()
211
+ onClick: () => l.open()
213
212
  }, [o("div", {
214
213
  class: r.content
215
214
  }, [o("div", {
@@ -231,7 +230,7 @@ const d = {
231
230
  }
232
231
  }
233
232
  }).then((i) => {
234
- n.addDataFiles(i);
233
+ l.addDataFiles(i);
235
234
  }));
236
235
  }
237
236
  }, [o("div", {
@@ -240,10 +239,10 @@ const d = {
240
239
  class: r.text.title
241
240
  }, [a("components.upload.desc")]), o("div", {
242
241
  class: r.text.desc
243
- }, [x.value ? o("span", {
242
+ }, [h.value ? o("span", {
244
243
  class: r.text.highlight
245
- }, [a("components.upload.dropHere")]) : o(Z, null, [h.value ? a("components.upload.supportFormats", {
246
- formats: h.value
244
+ }, [a("components.upload.dropHere")]) : o(Z, null, [x.value ? a("components.upload.supportFormats", {
245
+ formats: x.value
247
246
  }) : a("components.upload.allFormats"), j(","), " ", a("components.upload.maxSize", {
248
247
  size: m.value
249
248
  })])])])]), o(W, {
@@ -284,7 +283,7 @@ const d = {
284
283
  title: a("components.upload.actions"),
285
284
  width: 120,
286
285
  render: (e) => {
287
- let i, l;
286
+ let i, n;
288
287
  return o("div", {
289
288
  class: r.table.actions
290
289
  }, [o(F, {
@@ -292,20 +291,20 @@ const d = {
292
291
  size: "small",
293
292
  text: !0,
294
293
  disabled: ["success", "error", "cancelled"].includes(e.status),
295
- onClick: () => n.cancelFiles([e.id])
294
+ onClick: () => l.cancelFiles([e.id])
296
295
  }, P(i = a("components.upload.cancel")) ? i : {
297
296
  default: () => [i]
298
297
  }), o(F, {
299
298
  type: "error",
300
299
  size: "small",
301
300
  text: !0,
302
- onClick: () => n.removeFiles([e.id])
303
- }, P(l = a("components.upload.delete")) ? l : {
304
- default: () => [l]
301
+ onClick: () => l.removeFiles([e.id])
302
+ }, P(n = a("components.upload.delete")) ? n : {
303
+ default: () => [n]
305
304
  })]);
306
305
  }
307
306
  }],
308
- data: n.uploadFiles.value
307
+ data: l.uploadFiles.value
309
308
  }, {
310
309
  empty: () => o("div", {
311
310
  class: r.table.empty