hys-ui 0.1.0 → 0.1.1

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 (99) hide show
  1. package/CHANGELOG.md +26 -1
  2. package/README.md +16 -6
  3. package/dist/components/HysAlert/HysAlert.vue.js +14 -14
  4. package/dist/components/HysAnimatedNumber/HysAnimatedNumber.vue.js +23 -20
  5. package/dist/components/HysBadge/HysBadge.vue.js +1 -1
  6. package/dist/components/HysBadge/HysBadge2.vue.js +20 -19
  7. package/dist/components/HysCalendar/HysCalendar.vue.js +48 -40
  8. package/dist/components/HysCard/HysCard.vue.js +2 -2
  9. package/dist/components/HysCard/HysCard2.vue.js +9 -9
  10. package/dist/components/HysCascader/HysCascader.vue.js +88 -76
  11. package/dist/components/HysCheckbox/HysCheckbox.vue.js +5 -39
  12. package/dist/components/HysCheckbox/HysCheckbox2.vue.js +85 -2
  13. package/dist/components/HysCommandPalette/HysCommandPalette.vue.js +52 -51
  14. package/dist/components/HysCommentEditor/HysCommentEditor.vue.js +17 -17
  15. package/dist/components/HysDataGrid/HysDataGrid2.vue.js +22 -22
  16. package/dist/components/HysDrawer/HysDrawer.vue.js +1 -1
  17. package/dist/components/HysDrawer/HysDrawer2.vue.js +55 -54
  18. package/dist/components/HysFileManager/HysFileManager.vue.js +5 -63
  19. package/dist/components/HysFileManager/HysFileManager2.vue.js +85 -2
  20. package/dist/components/HysForm/HysForm.vue.js +2 -2
  21. package/dist/components/HysForm/HysForm2.vue.js +66 -64
  22. package/dist/components/HysFormItem/HysFormItem.vue.js +53 -37
  23. package/dist/components/HysGantt/HysGantt.vue.js +5 -264
  24. package/dist/components/HysGantt/HysGantt2.vue.js +302 -2
  25. package/dist/components/HysInput/HysInput.vue.js +1 -1
  26. package/dist/components/HysInput/HysInput2.vue.js +42 -41
  27. package/dist/components/HysModal/HysModal.vue.js +2 -2
  28. package/dist/components/HysModal/HysModal2.vue.js +35 -35
  29. package/dist/components/HysNotificationCenter/HysNotificationCenter.vue.js +37 -36
  30. package/dist/components/HysNumberInput/HysNumberInput.vue.js +2 -2
  31. package/dist/components/HysNumberInput/HysNumberInput2.vue.js +49 -40
  32. package/dist/components/HysOrgTree/HysOrgTree.vue.js +34 -32
  33. package/dist/components/HysPagination/HysPagination.vue.js +2 -2
  34. package/dist/components/HysPagination/HysPagination2.vue.js +91 -91
  35. package/dist/components/HysPermissionMatrix/HysPermissionMatrix.vue.js +5 -41
  36. package/dist/components/HysPermissionMatrix/HysPermissionMatrix2.vue.js +100 -2
  37. package/dist/components/HysRadioGroup/HysRadioGroup.vue.js +5 -40
  38. package/dist/components/HysRadioGroup/HysRadioGroup2.vue.js +80 -2
  39. package/dist/components/HysResizablePanel/HysResizablePanel.vue.js +46 -28
  40. package/dist/components/HysRichTextEditor/HysRichTextEditor.vue.js +2 -2
  41. package/dist/components/HysRichTextEditor/HysRichTextEditor2.vue.js +86 -67
  42. package/dist/components/HysSearch/HysSearch.vue.js +49 -38
  43. package/dist/components/HysSegmented/HysSegmented.vue.js +39 -34
  44. package/dist/components/HysSelect/HysSelect.vue.js +2 -2
  45. package/dist/components/HysSelect/HysSelect2.vue.js +130 -109
  46. package/dist/components/HysSlider/HysSlider.vue.js +2 -2
  47. package/dist/components/HysSlider/HysSlider2.vue.js +40 -40
  48. package/dist/components/HysSplitPane/HysSplitPane.vue.js +48 -42
  49. package/dist/components/HysSteps/HysSteps.vue.js +2 -2
  50. package/dist/components/HysSteps/HysSteps2.vue.js +15 -14
  51. package/dist/components/HysSwitch/HysSwitch.vue.js +2 -2
  52. package/dist/components/HysSwitch/HysSwitch2.vue.js +38 -27
  53. package/dist/components/HysTable/HysTable.vue.js +2 -2
  54. package/dist/components/HysTable/HysTable2.vue.js +42 -38
  55. package/dist/components/HysTabs/HysTabs.vue.js +1 -1
  56. package/dist/components/HysTabs/HysTabs2.vue.js +8 -6
  57. package/dist/components/HysTextarea/HysTextarea.vue.js +58 -48
  58. package/dist/components/HysToast/HysToast.vue.js +2 -2
  59. package/dist/components/HysToast/HysToast2.vue.js +121 -38
  60. package/dist/components/HysTour/HysTour.vue.js +47 -42
  61. package/dist/components/HysTransfer/HysTransfer.vue.js +159 -143
  62. package/dist/components/HysTree/HysTree.vue.js +2 -2
  63. package/dist/components/HysTree/HysTree2.vue.js +62 -61
  64. package/dist/components/HysTreeSelect/HysTreeSelect.vue.js +64 -57
  65. package/dist/components/HysUpload/HysUpload.vue.js +2 -2
  66. package/dist/components/HysUpload/HysUpload2.vue.js +95 -77
  67. package/dist/composables/formContext.js +9 -3
  68. package/dist/composables/toastEscape.js +16 -0
  69. package/dist/composables/useDialog.js +16 -16
  70. package/dist/composables/useFloating.js +40 -40
  71. package/dist/composables/useHysToast.js +148 -0
  72. package/dist/config.js +18 -15
  73. package/dist/index.js +10 -7
  74. package/dist/style.css +1 -1
  75. package/dist/types/components/HysCalendar/HysCalendar.vue.d.ts +2 -0
  76. package/dist/types/components/HysCard/HysCard.vue.d.ts +5 -1
  77. package/dist/types/components/HysCheckbox/HysCheckbox.vue.d.ts +21 -4
  78. package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +1 -0
  79. package/dist/types/components/HysFileManager/HysFileManager.vue.d.ts +6 -2
  80. package/dist/types/components/HysGantt/HysGantt.vue.d.ts +6 -0
  81. package/dist/types/components/HysNumberInput/HysNumberInput.vue.d.ts +2 -0
  82. package/dist/types/components/HysOrgTree/HysOrgTree.vue.d.ts +3 -1
  83. package/dist/types/components/HysPermissionMatrix/HysPermissionMatrix.vue.d.ts +8 -1
  84. package/dist/types/components/HysRadioGroup/HysRadioGroup.vue.d.ts +40 -17
  85. package/dist/types/components/HysResizablePanel/HysResizablePanel.vue.d.ts +6 -0
  86. package/dist/types/components/HysSelect/HysSelect.vue.d.ts +7 -1
  87. package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +6 -0
  88. package/dist/types/components/HysSteps/HysSteps.vue.d.ts +1 -0
  89. package/dist/types/components/HysSwitch/HysSwitch.vue.d.ts +1 -1
  90. package/dist/types/components/HysTextarea/HysTextarea.vue.d.ts +1 -1
  91. package/dist/types/components/HysToast/HysToast.vue.d.ts +55 -7
  92. package/dist/types/components/HysTour/HysTour.vue.d.ts +3 -1
  93. package/dist/types/components/HysTransfer/HysTransfer.vue.d.ts +11 -1
  94. package/dist/types/composables/formContext.d.ts +5 -0
  95. package/dist/types/composables/toastEscape.d.ts +1 -0
  96. package/dist/types/composables/useFloating.d.ts +1 -1
  97. package/dist/types/composables/useHysToast.d.ts +50 -0
  98. package/dist/types/index.d.ts +5 -0
  99. package/package.json +46 -11
@@ -1,11 +1,12 @@
1
- import { defineComponent as he, ref as p, computed as s, watch as j, onDeactivated as fe, openBlock as r, createElementBlock as c, mergeProps as W, unref as I, withDirectives as pe, vModelText as ye, createCommentVNode as w, createElementVNode as E, normalizeStyle as F, Fragment as me, renderList as be, normalizeClass as ge, withModifiers as G, createBlock as J, resolveDynamicComponent as ke, toDisplayString as O, renderSlot as we, Teleport as Ce, withKeys as De, nextTick as Ke } from "vue";
2
- import { useHysRootAttrs as Ae } from "../../config.js";
3
- import { LoaderCircle as Me, ChevronDown as Se, ChevronRight as Te } from "lucide-vue-next";
4
- const Ie = ["disabled"], Be = ["aria-multiselectable"], Ve = ["aria-level", "aria-expanded", "aria-selected", "aria-disabled", "aria-checked", "tabindex", "draggable", "data-tree-id", "onFocus", "onKeydown", "onClick", "onDragstart", "onDragover", "onDrop", "onContextmenu", "data-drop-position"], $e = ["aria-label", "disabled", "onClick"], He = {
1
+ import { defineComponent as he, ref as p, computed as s, watch as W, onDeactivated as fe, openBlock as r, createElementBlock as v, mergeProps as G, unref as I, withDirectives as pe, vModelText as ye, createCommentVNode as w, createElementVNode as E, normalizeStyle as F, Fragment as me, renderList as be, normalizeClass as ge, withModifiers as J, createBlock as O, resolveDynamicComponent as ke, toDisplayString as P, renderSlot as we, Teleport as Ce, withKeys as De, nextTick as Ke } from "vue";
2
+ import Ae from "../HysCheckbox/HysCheckbox.vue.js";
3
+ import { useHysRootAttrs as Me } from "../../config.js";
4
+ import { LoaderCircle as Se, ChevronDown as Te, ChevronRight as Ie } from "lucide-vue-next";
5
+ const Be = ["disabled"], Ve = ["aria-multiselectable"], He = ["aria-level", "aria-expanded", "aria-selected", "aria-disabled", "aria-checked", "tabindex", "draggable", "data-tree-id", "onFocus", "onKeydown", "onClick", "onDragstart", "onDragover", "onDrop", "onContextmenu", "data-drop-position"], $e = ["aria-label", "disabled", "onClick"], Ee = {
5
6
  key: 1,
6
7
  class: "hys-ui-pf-tree-spacer",
7
8
  "aria-hidden": "true"
8
- }, Ee = ["checked", "disabled", "aria-label", "indeterminate", "onChange"], Le = {
9
+ }, Le = {
9
10
  key: 3,
10
11
  "aria-hidden": "true"
11
12
  }, Ne = { class: "hys-ui-pf-tree-label" }, Re = {
@@ -15,7 +16,7 @@ const Ie = ["disabled"], Be = ["aria-multiselectable"], Ve = ["aria-level", "ari
15
16
  }, qe = {
16
17
  key: 2,
17
18
  class: "hys-ui-pf-tree-empty"
18
- }, Pe = /* @__PURE__ */ he({
19
+ }, Ye = /* @__PURE__ */ he({
19
20
  __name: "HysTree",
20
21
  props: {
21
22
  nodes: {},
@@ -39,20 +40,20 @@ const Ie = ["disabled"], Be = ["aria-multiselectable"], Ve = ["aria-level", "ari
39
40
  },
40
41
  emits: ["update:modelValue", "update:checkedKeys", "update:expandedKeys", "select", "check", "node-drop", "node-contextmenu", "load-error", "children-loaded"],
41
42
  setup(i, { expose: ee, emit: le }) {
42
- const P = Ae(), d = i, v = le, b = p(""), C = p({}), K = p([]), M = p({}), S = p(0), A = p(""), B = p(""), Y = p("inside"), h = p(null), V = p(""), m = p(null), u = s(() => {
43
+ const Y = Me(), d = i, c = le, b = p(""), C = p({}), K = p([]), M = p({}), S = p(0), A = p(""), B = p(""), U = p("inside"), h = p(null), V = p(""), m = p(null), u = s(() => {
43
44
  const e = /* @__PURE__ */ new Map(), t = (l, n = 0, a, o = /* @__PURE__ */ new Set()) => {
44
- var H, k;
45
+ var $, k;
45
46
  for (const y of l)
46
- e.has(y.id) || o.has(y.id) || (e.set(y.id, { node: y, depth: n, parentId: a, hasChildren: !!((H = y.children) != null && H.length || (k = C.value[y.id]) != null && k.length || y.hasChildren) }), t(C.value[y.id] ?? y.children ?? [], n + 1, y.id, /* @__PURE__ */ new Set([...o, y.id])));
47
+ e.has(y.id) || o.has(y.id) || (e.set(y.id, { node: y, depth: n, parentId: a, hasChildren: !!(($ = y.children) != null && $.length || (k = C.value[y.id]) != null && k.length || y.hasChildren) }), t(C.value[y.id] ?? y.children ?? [], n + 1, y.id, /* @__PURE__ */ new Set([...o, y.id])));
47
48
  };
48
49
  return t(d.nodes), e;
49
- }), $ = p([]);
50
- j(() => [d.nodes, d.defaultExpandAll], () => {
51
- d.defaultExpandAll && d.expandedKeys === void 0 && ($.value = [...u.value.values()].filter((e) => e.hasChildren).map((e) => e.node.id));
52
- }, { immediate: !0, deep: !0 }), j(() => d.nodes, () => {
50
+ }), H = p([]);
51
+ W(() => [d.nodes, d.defaultExpandAll], () => {
52
+ d.defaultExpandAll && d.expandedKeys === void 0 && (H.value = [...u.value.values()].filter((e) => e.hasChildren).map((e) => e.node.id));
53
+ }, { immediate: !0, deep: !0 }), W(() => d.nodes, () => {
53
54
  C.value = {}, M.value = {}, S.value = 0;
54
55
  }, { deep: !1 });
55
- const f = s(() => d.expandedKeys ?? $.value), te = s(() => {
56
+ const f = s(() => d.expandedKeys ?? H.value), te = s(() => {
56
57
  const e = /* @__PURE__ */ new Set(), t = b.value.trim().toLocaleLowerCase();
57
58
  if (!t) return e;
58
59
  for (const l of u.value.values()) {
@@ -93,20 +94,20 @@ const Ie = ["disabled"], Be = ["aria-multiselectable"], Ve = ["aria-level", "ari
93
94
  K.value = [...K.value, e], delete M.value[e];
94
95
  try {
95
96
  const a = await d.loadChildren(t.node);
96
- C.value = { ...C.value, [e]: a }, v("children-loaded", { node: t.node, children: a });
97
+ C.value = { ...C.value, [e]: a }, c("children-loaded", { node: t.node, children: a });
97
98
  } catch (a) {
98
- M.value = { ...M.value, [e]: "加载失败,点击重试" }, v("load-error", { node: t.node, error: a });
99
+ M.value = { ...M.value, [e]: "加载失败,点击重试" }, c("load-error", { node: t.node, error: a });
99
100
  return;
100
101
  } finally {
101
102
  K.value = K.value.filter((a) => a !== e);
102
103
  }
103
104
  }
104
105
  const l = f.value.includes(e) ? f.value.filter((a) => a !== e) : [...f.value, e];
105
- d.expandedKeys === void 0 && ($.value = l), v("update:expandedKeys", l);
106
+ d.expandedKeys === void 0 && (H.value = l), c("update:expandedKeys", l);
106
107
  }
107
108
  const R = s(() => new Set((Array.isArray(d.modelValue) ? d.modelValue : [d.modelValue]).filter((e) => typeof e == "string")));
108
109
  function q(e) {
109
- d.disabled || e.node.disabled || e.node.selectable === !1 || (v("update:modelValue", d.multiple || Array.isArray(d.modelValue) ? R.value.has(e.node.id) ? [...R.value].filter((t) => t !== e.node.id) : [...R.value, e.node.id] : e.node.id), v("select", e.node), V.value = e.node.id);
110
+ d.disabled || e.node.disabled || e.node.selectable === !1 || (c("update:modelValue", d.multiple || Array.isArray(d.modelValue) ? R.value.has(e.node.id) ? [...R.value].filter((t) => t !== e.node.id) : [...R.value, e.node.id] : e.node.id), c("select", e.node), V.value = e.node.id);
110
111
  }
111
112
  function ne(e) {
112
113
  const t = [], l = (n) => {
@@ -125,11 +126,11 @@ const Ie = ["disabled"], Be = ["aria-multiselectable"], Ve = ["aria-level", "ari
125
126
  n ? l.add(o) : l.delete(o);
126
127
  for (const o of d.checkStrictly ? [] : [...u.value.values()].reverse()) {
127
128
  if (!o.hasChildren || o.node.disabled || o.node.checkable === !1) continue;
128
- const H = (C.value[o.node.id] ?? o.node.children ?? []).filter((k) => !k.disabled && k.checkable !== !1).map((k) => k.id);
129
- H.length && H.every((k) => l.has(k)) ? l.add(o.node.id) : l.delete(o.node.id);
129
+ const $ = (C.value[o.node.id] ?? o.node.children ?? []).filter((k) => !k.disabled && k.checkable !== !1).map((k) => k.id);
130
+ $.length && $.every((k) => l.has(k)) ? l.add(o.node.id) : l.delete(o.node.id);
130
131
  }
131
132
  const a = [...l];
132
- v("update:checkedKeys", a), v("check", a);
133
+ c("update:checkedKeys", a), c("check", a);
133
134
  }
134
135
  function T(e) {
135
136
  const t = g.value;
@@ -165,8 +166,8 @@ const Ie = ["disabled"], Be = ["aria-multiselectable"], Ve = ["aria-level", "ari
165
166
  }
166
167
  } else e.key === "Enter" ? (e.preventDefault(), q(t)) : e.key === " " && (e.preventDefault(), d.checkable ? Z(t) : q(t));
167
168
  }
168
- const D = s(() => Math.max(24, d.rowHeight)), z = s(() => Math.max(120, d.viewportHeight)), U = s(() => d.virtual ? Math.max(0, Math.floor(S.value / D.value) - 5) : 0), x = s(() => d.virtual ? Math.min(g.value.length, Math.ceil((S.value + z.value) / D.value) + 5) : g.value.length), de = s(() => g.value.slice(U.value, x.value)), oe = s(() => U.value * D.value), ie = s(() => Math.max(0, (g.value.length - x.value) * D.value));
169
- j([b, f], () => {
169
+ const D = s(() => Math.max(24, d.rowHeight)), z = s(() => Math.max(120, d.viewportHeight)), X = s(() => d.virtual ? Math.max(0, Math.floor(S.value / D.value) - 5) : 0), x = s(() => d.virtual ? Math.min(g.value.length, Math.ceil((S.value + z.value) / D.value) + 5) : g.value.length), de = s(() => g.value.slice(X.value, x.value)), oe = s(() => X.value * D.value), ie = s(() => Math.max(0, (g.value.length - x.value) * D.value));
170
+ W([b, f], () => {
170
171
  S.value = 0, m.value && (m.value.scrollTop = 0);
171
172
  });
172
173
  function re(e) {
@@ -190,16 +191,16 @@ const Ie = ["disabled"], Be = ["aria-multiselectable"], Ve = ["aria-level", "ari
190
191
  }
191
192
  e.preventDefault();
192
193
  const a = e.currentTarget.getBoundingClientRect(), o = (e.clientY - a.top) / a.height;
193
- Y.value = o < 0.25 ? "before" : o > 0.75 ? "after" : "inside", B.value = t.node.id;
194
+ U.value = o < 0.25 ? "before" : o > 0.75 ? "after" : "inside", B.value = t.node.id;
194
195
  }
195
196
  function ce(e, t) {
196
- B.value !== t.node.id || !A.value || (e.preventDefault(), v("node-drop", { dragId: A.value, targetId: t.node.id, position: Y.value }), X());
197
+ B.value !== t.node.id || !A.value || (e.preventDefault(), c("node-drop", { dragId: A.value, targetId: t.node.id, position: U.value }), j());
197
198
  }
198
- function X() {
199
+ function j() {
199
200
  A.value = "", B.value = "";
200
201
  }
201
202
  function ve(e, t) {
202
- d.contextMenu && (e.preventDefault(), h.value = { node: t.node, x: Math.max(0, Math.min(e.clientX, window.innerWidth - 190)), y: Math.max(0, Math.min(e.clientY, window.innerHeight - 130)) }, v("node-contextmenu", { node: t.node, x: e.clientX, y: e.clientY }));
203
+ d.contextMenu && (e.preventDefault(), h.value = { node: t.node, x: Math.max(0, Math.min(e.clientX, window.innerWidth - 190)), y: Math.max(0, Math.min(e.clientY, window.innerHeight - 130)) }, c("node-contextmenu", { node: t.node, x: e.clientX, y: e.clientY }));
203
204
  }
204
205
  function _(e) {
205
206
  const t = h.value;
@@ -212,21 +213,21 @@ const Ie = ["disabled"], Be = ["aria-multiselectable"], Ve = ["aria-level", "ari
212
213
  }
213
214
  }
214
215
  return fe(() => {
215
- h.value = null, X();
216
+ h.value = null, j();
216
217
  }), ee({ getNode: (e) => {
217
218
  var t;
218
219
  return (t = u.value.get(e)) == null ? void 0 : t.node;
219
220
  }, getCheckedKeys: () => [...d.checkedKeys], setCheckedKeys: (e) => {
220
- v("update:checkedKeys", e), v("check", e);
221
+ c("update:checkedKeys", e), c("check", e);
221
222
  }, filter: (e) => b.value = e, expandAll: () => {
222
223
  const e = [...u.value.values()].filter((t) => t.hasChildren).map((t) => t.node.id);
223
- $.value = e, v("update:expandedKeys", e);
224
+ H.value = e, c("update:expandedKeys", e);
224
225
  }, collapseAll: () => {
225
- $.value = [], v("update:expandedKeys", []);
226
- } }), (e, t) => (r(), c("div", W(I(P), {
226
+ H.value = [], c("update:expandedKeys", []);
227
+ } }), (e, t) => (r(), v("div", G(I(Y), {
227
228
  class: ["hys-ui-pf-tree", { "hys-ui-pf-tree-disabled": i.disabled }]
228
229
  }), [
229
- i.searchable ? pe((r(), c("input", {
230
+ i.searchable ? pe((r(), v("input", {
230
231
  key: 0,
231
232
  "onUpdate:modelValue": t[0] || (t[0] = (l) => b.value = l),
232
233
  class: "hys-ui-pf-tree-search",
@@ -234,7 +235,7 @@ const Ie = ["disabled"], Be = ["aria-multiselectable"], Ve = ["aria-level", "ari
234
235
  placeholder: "搜索节点…",
235
236
  "aria-label": "搜索树节点",
236
237
  disabled: i.disabled
237
- }, null, 8, Ie)), [
238
+ }, null, 8, Be)), [
238
239
  [ye, b.value]
239
240
  ]) : w("", !0),
240
241
  E("div", {
@@ -247,12 +248,12 @@ const Ie = ["disabled"], Be = ["aria-multiselectable"], Ve = ["aria-level", "ari
247
248
  style: F({ maxHeight: z.value + "px" }),
248
249
  onScroll: re
249
250
  }, [
250
- i.virtual ? (r(), c("div", {
251
+ i.virtual ? (r(), v("div", {
251
252
  key: 0,
252
253
  style: F({ height: oe.value + "px" }),
253
254
  "aria-hidden": "true"
254
255
  }, null, 4)) : w("", !0),
255
- (r(!0), c(me, null, be(de.value, (l, n) => (r(), c("div", {
256
+ (r(!0), v(me, null, be(de.value, (l, n) => (r(), v("div", {
256
257
  key: l.node.id,
257
258
  class: ge(["hys-ui-pf-tree-row", { "hys-ui-pf-tree-selected": R.value.has(l.node.id), "hys-ui-pf-tree-line": i.showLine, "hys-ui-pf-tree-drop": B.value === l.node.id }]),
258
259
  role: "treeitem",
@@ -261,7 +262,7 @@ const Ie = ["disabled"], Be = ["aria-multiselectable"], Ve = ["aria-level", "ari
261
262
  "aria-selected": i.modelValue === l.node.id,
262
263
  "aria-disabled": i.disabled || l.node.disabled,
263
264
  "aria-checked": i.checkable ? L.value.has(l.node.id) ? "true" : Q.value.has(l.node.id) ? "mixed" : "false" : void 0,
264
- tabindex: V.value === l.node.id || !V.value && n === 0 && U.value === 0 ? 0 : -1,
265
+ tabindex: V.value === l.node.id || !V.value && n === 0 && X.value === 0 ? 0 : -1,
265
266
  draggable: i.draggable && !i.disabled && !l.node.disabled,
266
267
  "data-tree-id": l.node.id,
267
268
  onFocus: (a) => V.value = l.node.id,
@@ -270,61 +271,61 @@ const Ie = ["disabled"], Be = ["aria-multiselectable"], Ve = ["aria-level", "ari
270
271
  onDragstart: (a) => ue(a, l),
271
272
  onDragover: (a) => se(a, l),
272
273
  onDrop: (a) => ce(a, l),
273
- onDragend: X,
274
+ onDragend: j,
274
275
  onContextmenu: (a) => ve(a, l),
275
- "data-drop-position": B.value === l.node.id ? Y.value : void 0,
276
+ "data-drop-position": B.value === l.node.id ? U.value : void 0,
276
277
  style: F({ "--hys-ui-tree-depth": l.depth, minHeight: i.virtual ? D.value + "px" : void 0, height: i.virtual ? D.value + "px" : void 0 })
277
278
  }, [
278
- l.hasChildren ? (r(), c("button", {
279
+ l.hasChildren ? (r(), v("button", {
279
280
  key: 0,
280
281
  class: "hys-ui-pf-tree-expander",
281
282
  type: "button",
282
283
  "aria-label": f.value.includes(l.node.id) ? "折叠" : "展开",
283
284
  disabled: i.disabled || l.node.disabled || K.value.includes(l.node.id),
284
- onClick: G((a) => N(l.node.id), ["stop"])
285
+ onClick: J((a) => N(l.node.id), ["stop"])
285
286
  }, [
286
- K.value.includes(l.node.id) ? (r(), J(I(Me), {
287
+ K.value.includes(l.node.id) ? (r(), O(I(Se), {
287
288
  key: 0,
288
289
  size: 15,
289
290
  "aria-hidden": "true",
290
291
  class: "hys-ui-icon-spin"
291
- })) : (r(), J(ke(b.value.trim() || f.value.includes(l.node.id) ? I(Se) : I(Te)), {
292
+ })) : (r(), O(ke(b.value.trim() || f.value.includes(l.node.id) ? I(Te) : I(Ie)), {
292
293
  key: 1,
293
294
  size: 15,
294
295
  "aria-hidden": "true"
295
296
  }))
296
- ], 8, $e)) : (r(), c("span", He)),
297
- i.checkable ? (r(), c("input", {
297
+ ], 8, $e)) : (r(), v("span", Ee)),
298
+ i.checkable ? (r(), O(Ae, {
298
299
  key: 2,
299
- type: "checkbox",
300
- checked: L.value.has(l.node.id),
300
+ tabindex: -1,
301
+ "model-value": L.value.has(l.node.id),
301
302
  disabled: i.disabled || l.node.disabled || l.node.checkable === !1,
302
303
  "aria-label": `勾选${l.node.label}`,
303
304
  indeterminate: Q.value.has(l.node.id),
304
- onClick: t[1] || (t[1] = G(() => {
305
+ onClick: t[1] || (t[1] = J(() => {
305
306
  }, ["stop"])),
306
307
  onChange: (a) => Z(l)
307
- }, null, 40, Ee)) : w("", !0),
308
- l.node.icon ? (r(), c("span", Le, O(l.node.icon), 1)) : w("", !0),
308
+ }, null, 8, ["model-value", "disabled", "aria-label", "indeterminate", "onChange"])) : w("", !0),
309
+ l.node.icon ? (r(), v("span", Le, P(l.node.icon), 1)) : w("", !0),
309
310
  we(e.$slots, "node", {
310
311
  node: l.node,
311
312
  depth: l.depth,
312
313
  expanded: f.value.includes(l.node.id),
313
314
  selected: i.modelValue === l.node.id
314
315
  }, () => [
315
- E("span", Ne, O(l.node.label), 1)
316
+ E("span", Ne, P(l.node.label), 1)
316
317
  ], !0),
317
- M.value[l.node.id] ? (r(), c("span", Re, O(M.value[l.node.id]), 1)) : w("", !0)
318
- ], 46, Ve))), 128)),
319
- i.virtual ? (r(), c("div", {
318
+ M.value[l.node.id] ? (r(), v("span", Re, P(M.value[l.node.id]), 1)) : w("", !0)
319
+ ], 46, He))), 128)),
320
+ i.virtual ? (r(), v("div", {
320
321
  key: 1,
321
322
  style: F({ height: ie.value + "px" }),
322
323
  "aria-hidden": "true"
323
324
  }, null, 4)) : w("", !0),
324
- g.value.length ? w("", !0) : (r(), c("div", qe, O(b.value ? "无匹配节点" : "暂无数据"), 1))
325
- ], 44, Be),
326
- (r(), J(Ce, { to: "body" }, [
327
- h.value ? (r(), c("div", W({ key: 0 }, I(P), {
325
+ g.value.length ? w("", !0) : (r(), v("div", qe, P(b.value ? "无匹配节点" : "暂无数据"), 1))
326
+ ], 44, Ve),
327
+ (r(), O(Ce, { to: "body" }, [
328
+ h.value ? (r(), v("div", G({ key: 0 }, I(Y), {
328
329
  class: "hys-ui-pf-tree-context",
329
330
  style: { left: h.value.x + "px", top: h.value.y + "px" },
330
331
  role: "menu",
@@ -346,15 +347,15 @@ const Ie = ["disabled"], Be = ["aria-multiselectable"], Ve = ["aria-level", "ari
346
347
  onClick: t[4] || (t[4] = (l) => h.value = null)
347
348
  }, "关闭")
348
349
  ], 16)) : w("", !0),
349
- h.value ? (r(), c("div", W({ key: 1 }, I(P), {
350
+ h.value ? (r(), v("div", G({ key: 1 }, I(Y), {
350
351
  class: "hys-ui-pf-tree-context-backdrop",
351
352
  onClick: t[6] || (t[6] = (l) => h.value = null),
352
- onContextmenu: t[7] || (t[7] = G((l) => h.value = null, ["prevent"]))
353
+ onContextmenu: t[7] || (t[7] = J((l) => h.value = null, ["prevent"]))
353
354
  }), null, 16)) : w("", !0)
354
355
  ]))
355
356
  ], 16));
356
357
  }
357
358
  });
358
359
  export {
359
- Pe as default
360
+ Ye as default
360
361
  };
@@ -1,8 +1,8 @@
1
- import { defineComponent as U, ref as f, computed as c, watch as T, openBlock as o, createElementBlock as i, mergeProps as z, unref as n, createElementVNode as V, withKeys as j, withModifiers as q, toDisplayString as H, createVNode as P, createBlock as K, Teleport as W, withDirectives as G, vModelText as J, createCommentVNode as h, Fragment as Q, renderList as X, normalizeStyle as Y, normalizeClass as Z, renderSlot as _, createTextVNode as ee, nextTick as le } from "vue";
2
- import { ChevronDown as ae, Check as te } from "lucide-vue-next";
3
- import { useFloating as ne } from "../../composables/useFloating.js";
4
- import { useHysRootAttrs as oe } from "../../config.js";
5
- const ue = ["disabled", "aria-expanded", "onKeydown"], re = ["aria-multiselectable"], se = ["aria-selected", "disabled", "data-enabled", "onClick"], de = { key: 0 }, fe = /* @__PURE__ */ U({
1
+ import { defineComponent as j, ref as p, computed as v, watch as z, openBlock as u, createElementBlock as d, mergeProps as H, unref as n, createElementVNode as V, withKeys as P, withModifiers as W, toDisplayString as N, createVNode as G, createBlock as $, Teleport as J, withDirectives as Q, vModelText as X, createCommentVNode as h, Fragment as Y, renderList as Z, normalizeStyle as _, normalizeClass as ee, renderSlot as le, createTextVNode as ae, nextTick as te } from "vue";
2
+ import { ChevronDown as ne, Check as oe } from "lucide-vue-next";
3
+ import { useFloating as ue } from "../../composables/useFloating.js";
4
+ import { useHysRootAttrs as re } from "../../config.js";
5
+ const se = ["disabled", "aria-expanded"], ie = ["aria-multiselectable"], de = ["aria-selected", "disabled", "data-enabled", "onClick"], ce = { key: 0 }, be = /* @__PURE__ */ j({
6
6
  __name: "HysTreeSelect",
7
7
  props: {
8
8
  modelValue: {},
@@ -15,110 +15,117 @@ const ue = ["disabled", "aria-expanded", "onKeydown"], re = ["aria-multiselectab
15
15
  leafOnly: { type: Boolean }
16
16
  },
17
17
  emits: ["update:modelValue", "change", "clear"],
18
- setup(u, { emit: N }) {
19
- const t = u, m = N, C = oe(), x = f(), k = f(), A = f(), v = f(""), r = f(0), { open: g, style: $, show: I, close: y } = ne(x, k, { matchWidth: !0 });
18
+ setup(s, { emit: K }) {
19
+ const t = s, w = K, x = re(), A = p(), b = p(), m = p(), y = p(""), o = p(0), { open: k, style: q, show: F, close: f } = ue(A, b, { matchWidth: !0 });
20
20
  function B(e, a = 0, l = !1) {
21
- return e.flatMap((d) => [{ node: { ...d, disabled: l || d.disabled }, depth: a }, ...B(d.children || [], a + 1, l || d.disabled)]);
21
+ return e.flatMap((i) => [{ node: { ...i, disabled: l || i.disabled }, depth: a }, ...B(i.children || [], a + 1, l || i.disabled)]);
22
22
  }
23
- const D = c(() => B(t.nodes)), w = c(() => D.value.filter((e) => e.node.label.toLocaleLowerCase().includes(v.value.toLocaleLowerCase()))), p = c(() => w.value.filter((e) => {
23
+ const D = v(() => B(t.nodes)), C = v(() => D.value.filter((e) => e.node.label.toLocaleLowerCase().includes(y.value.toLocaleLowerCase()))), c = v(() => C.value.filter((e) => {
24
24
  var a;
25
25
  return !e.node.disabled && (!t.leafOnly || !((a = e.node.children) != null && a.length));
26
- })), s = c(() => Array.isArray(t.modelValue) ? t.modelValue : [t.modelValue].filter(Boolean)), b = c(() => t.multiple || Array.isArray(t.modelValue)), F = c(() => D.value.filter((e) => s.value.includes(e.node.value)).map((e) => e.node.label).join("、"));
27
- T(v, () => r.value = 0), T(() => t.disabled, (e) => {
28
- e && y();
26
+ })), r = v(() => Array.isArray(t.modelValue) ? t.modelValue : [t.modelValue].filter(Boolean)), g = v(() => t.multiple || Array.isArray(t.modelValue)), R = v(() => D.value.filter((e) => r.value.includes(e.node.value)).map((e) => e.node.label).join("、"));
27
+ z(y, () => o.value = 0), z(() => t.disabled, (e) => {
28
+ e && f();
29
29
  });
30
30
  async function E() {
31
31
  var e;
32
- t.disabled || (v.value = "", await I(), await le(), (e = A.value) == null || e.focus());
32
+ t.disabled || (y.value = "", await F(), await te(), o.value = Math.max(0, c.value.findIndex((a) => r.value.includes(a.node.value))), U() ? (e = m.value) == null || e.focus() : L());
33
33
  }
34
- function L(e) {
35
- m("update:modelValue", e), m("change", e);
34
+ function U() {
35
+ return t.searchable && m.value;
36
+ }
37
+ function L() {
38
+ var e, a;
39
+ (a = (e = b.value) == null ? void 0 : e.querySelectorAll("[data-enabled]")[o.value]) == null || a.focus();
36
40
  }
37
41
  function M(e) {
42
+ w("update:modelValue", e), w("change", e);
43
+ }
44
+ function S(e) {
38
45
  var a;
39
- t.disabled || e.disabled || t.leafOnly && ((a = e.children) != null && a.length) || (L(b.value ? s.value.includes(e.value) ? s.value.filter((l) => l !== e.value) : [...s.value, e.value] : e.value), b.value || y(!0));
46
+ t.disabled || e.disabled || t.leafOnly && ((a = e.children) != null && a.length) || (M(g.value ? r.value.includes(e.value) ? r.value.filter((l) => l !== e.value) : [...r.value, e.value] : e.value), g.value || f(!0));
40
47
  }
41
- function R(e) {
48
+ function I(e) {
42
49
  var a, l;
43
- ["ArrowDown", "ArrowUp", "Home", "End"].includes(e.key) ? (e.preventDefault(), r.value = e.key === "Home" ? 0 : e.key === "End" ? p.value.length - 1 : Math.max(0, Math.min(p.value.length - 1, r.value + (e.key === "ArrowDown" ? 1 : -1))), (l = (a = k.value) == null ? void 0 : a.querySelectorAll("[data-enabled]")[r.value]) == null || l.scrollIntoView({ block: "nearest" })) : e.key === "Enter" && p.value[r.value] ? (e.preventDefault(), M(p.value[r.value].node)) : e.key === "Escape" && (e.preventDefault(), y(!0));
50
+ e.isComposing || e.keyCode === 229 || (["ArrowDown", "ArrowUp", "Home", "End"].includes(e.key) ? (e.preventDefault(), o.value = e.key === "Home" ? 0 : e.key === "End" ? c.value.length - 1 : Math.max(0, Math.min(c.value.length - 1, o.value + (e.key === "ArrowDown" ? 1 : -1))), (l = (a = b.value) == null ? void 0 : a.querySelectorAll("[data-enabled]")[o.value]) == null || l.scrollIntoView({ block: "nearest" }), document.activeElement !== m.value && L()) : e.key === "Enter" && c.value[o.value] ? (e.preventDefault(), S(c.value[o.value].node)) : e.key === "Escape" && (e.preventDefault(), f(!0)));
44
51
  }
45
- return (e, a) => (o(), i("div", z(n(C), { class: "hys-ui-v4-relative" }), [
52
+ return (e, a) => (u(), d("div", H(n(x), { class: "hys-ui-v4-relative" }), [
46
53
  V("button", {
47
54
  ref_key: "trigger",
48
- ref: x,
55
+ ref: A,
49
56
  type: "button",
50
57
  class: "hys-ui-v4-control hys-ui-pf-select-trigger",
51
- disabled: u.disabled,
58
+ disabled: s.disabled,
52
59
  "aria-haspopup": "listbox",
53
- "aria-expanded": n(g),
54
- onClick: a[0] || (a[0] = (l) => n(g) ? n(y)() : E()),
55
- onKeydown: j(q(E, ["prevent"]), ["down"])
60
+ "aria-expanded": n(k),
61
+ onClick: a[0] || (a[0] = (l) => n(k) ? n(f)() : E()),
62
+ onKeydown: a[1] || (a[1] = P(W((l) => n(k) ? I(l) : E(), ["prevent"]), ["down"]))
56
63
  }, [
57
- V("span", null, H(F.value || u.placeholder || "选择节点"), 1),
58
- P(n(ae), {
64
+ V("span", null, N(R.value || s.placeholder || "选择节点"), 1),
65
+ G(n(ne), {
59
66
  size: 16,
60
67
  class: "hys-ui-pf-select-chevron"
61
68
  })
62
- ], 40, ue),
63
- (o(), K(W, { to: "body" }, [
64
- n(g) ? (o(), i("div", z({
69
+ ], 40, se),
70
+ (u(), $(J, { to: "body" }, [
71
+ n(k) ? (u(), d("div", H({
65
72
  key: 0,
66
73
  ref_key: "panel",
67
- ref: k
68
- }, n(C), {
74
+ ref: b
75
+ }, n(x), {
69
76
  class: "hys-ui-v4-menu hys-ui-pf-select-menu hys-ui-pf-tree-select-menu",
70
- style: n($),
71
- onKeydown: R
77
+ style: n(q),
78
+ onKeydown: I
72
79
  }), [
73
- u.searchable ? G((o(), i("input", {
80
+ s.searchable ? Q((u(), d("input", {
74
81
  key: 0,
75
82
  ref_key: "searchInput",
76
- ref: A,
77
- "onUpdate:modelValue": a[1] || (a[1] = (l) => v.value = l),
83
+ ref: m,
84
+ "onUpdate:modelValue": a[2] || (a[2] = (l) => y.value = l),
78
85
  class: "hys-ui-v4-control",
79
86
  placeholder: "搜索节点",
80
87
  "aria-label": "搜索节点"
81
88
  }, null, 512)), [
82
- [J, v.value]
89
+ [X, y.value]
83
90
  ]) : h("", !0),
84
91
  V("div", {
85
92
  class: "hys-ui-v4-scroll",
86
93
  role: "listbox",
87
- "aria-multiselectable": b.value || void 0,
94
+ "aria-multiselectable": g.value || void 0,
88
95
  "aria-label": "节点选择"
89
96
  }, [
90
- (o(!0), i(Q, null, X(w.value, (l) => {
91
- var d, O, S;
92
- return o(), i("button", {
97
+ (u(!0), d(Y, null, Z(C.value, (l) => {
98
+ var i, O, T;
99
+ return u(), d("button", {
93
100
  key: l.node.value,
94
101
  type: "button",
95
102
  role: "option",
96
- "aria-selected": s.value.includes(l.node.value),
97
- disabled: l.node.disabled || u.leafOnly && !!((d = l.node.children) != null && d.length),
98
- "data-enabled": l.node.disabled || u.leafOnly && ((O = l.node.children) != null && O.length) ? void 0 : "",
99
- class: Z(["hys-ui-v4-option", { "hys-ui-v4-active": ((S = p.value[r.value]) == null ? void 0 : S.node.value) === l.node.value }]),
100
- style: Y({ paddingLeft: 12 + l.depth * 16 + "px" }),
101
- onClick: (ie) => M(l.node)
103
+ "aria-selected": r.value.includes(l.node.value),
104
+ disabled: l.node.disabled || s.leafOnly && !!((i = l.node.children) != null && i.length),
105
+ "data-enabled": l.node.disabled || s.leafOnly && ((O = l.node.children) != null && O.length) ? void 0 : "",
106
+ class: ee(["hys-ui-v4-option", { "hys-ui-v4-active": ((T = c.value[o.value]) == null ? void 0 : T.node.value) === l.node.value }]),
107
+ style: _({ paddingLeft: 12 + l.depth * 16 + "px" }),
108
+ onClick: (ve) => S(l.node)
102
109
  }, [
103
- _(e.$slots, "option", {
110
+ le(e.$slots, "option", {
104
111
  node: l.node
105
112
  }, () => [
106
- ee(H(l.node.label), 1)
113
+ ae(N(l.node.label), 1)
107
114
  ]),
108
- s.value.includes(l.node.value) ? (o(), K(n(te), {
115
+ r.value.includes(l.node.value) ? (u(), $(n(oe), {
109
116
  key: 0,
110
117
  size: 15
111
118
  })) : h("", !0)
112
- ], 14, se);
119
+ ], 14, de);
113
120
  }), 128)),
114
- w.value.length ? h("", !0) : (o(), i("p", de, "无匹配节点"))
115
- ], 8, re),
116
- u.clearable && s.value.length ? (o(), i("button", {
121
+ C.value.length ? h("", !0) : (u(), d("p", ce, "无匹配节点"))
122
+ ], 8, ie),
123
+ s.clearable && r.value.length ? (u(), d("button", {
117
124
  key: 1,
118
125
  type: "button",
119
126
  class: "hys-ui-v4-option",
120
- onClick: a[2] || (a[2] = (l) => {
121
- L(b.value ? [] : ""), m("clear"), n(y)(!0);
127
+ onClick: a[3] || (a[3] = (l) => {
128
+ M(g.value ? [] : ""), w("clear"), n(f)(!0);
122
129
  })
123
130
  }, "清空选择")) : h("", !0)
124
131
  ], 16)) : h("", !0)
@@ -127,5 +134,5 @@ const ue = ["disabled", "aria-expanded", "onKeydown"], re = ["aria-multiselectab
127
134
  }
128
135
  });
129
136
  export {
130
- fe as default
137
+ be as default
131
138
  };
@@ -1,7 +1,7 @@
1
1
  import o from "./HysUpload2.vue.js";
2
2
  /* empty css */
3
3
  import t from "../../_virtual/_plugin-vue_export-helper.js";
4
- const e = /* @__PURE__ */ t(o, [["__scopeId", "data-v-023eb5ec"]]);
4
+ const d = /* @__PURE__ */ t(o, [["__scopeId", "data-v-d2ca10d8"]]);
5
5
  export {
6
- e as default
6
+ d as default
7
7
  };