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,14 +1,14 @@
1
- import { defineComponent as K, ref as g, watch as V, computed as x, openBlock as n, createElementBlock as u, mergeProps as q, unref as i, createElementVNode as L, toDisplayString as B, createVNode as M, createBlock as S, Teleport as P, withDirectives as W, vModelText as G, createCommentVNode as m, Fragment as D, renderList as E, renderSlot as I, createTextVNode as J } from "vue";
2
- import { ChevronDown as Q, ChevronRight as X, Check as Y } from "lucide-vue-next";
3
- import { useHysRootAttrs as Z } from "../../config.js";
4
- import { useFloating as ee } from "../../composables/useFloating.js";
5
- const le = ["disabled", "aria-expanded"], te = {
1
+ import { defineComponent as P, ref as C, watch as V, computed as S, openBlock as s, createElementBlock as n, mergeProps as T, unref as i, createElementVNode as D, withKeys as I, withModifiers as W, toDisplayString as L, createVNode as G, createBlock as B, Teleport as J, withDirectives as Q, vModelText as X, createCommentVNode as g, Fragment as q, renderList as E, renderSlot as Y, createTextVNode as Z, nextTick as ee } from "vue";
2
+ import { ChevronDown as le, ChevronRight as te, Check as oe } from "lucide-vue-next";
3
+ import { useHysRootAttrs as ae } from "../../config.js";
4
+ import { useFloating as re } from "../../composables/useFloating.js";
5
+ const se = ["disabled", "aria-expanded", "onKeydown"], ne = {
6
6
  key: 1,
7
- class: "hys-ui-v4-scroll"
8
- }, oe = ["onClick"], ae = { key: 0 }, re = {
7
+ class: "hys-ui-v4-scroll hys-ui-cascader-results"
8
+ }, ie = ["onClick"], ue = { key: 0 }, ce = {
9
9
  key: 2,
10
10
  class: "hys-ui-v4-columns"
11
- }, ne = ["aria-label"], se = ["disabled", "aria-current", "onClick"], pe = /* @__PURE__ */ K({
11
+ }, de = ["aria-label"], ye = ["disabled", "aria-current", "onClick"], be = /* @__PURE__ */ P({
12
12
  __name: "HysCascader",
13
13
  props: {
14
14
  modelValue: {},
@@ -22,163 +22,175 @@ const le = ["disabled", "aria-expanded"], te = {
22
22
  placeholder: { default: "选择分类" }
23
23
  },
24
24
  emits: ["update:modelValue", "change", "clear"],
25
- setup(y, { emit: H }) {
26
- const r = y, w = H, $ = Z(), O = g(), C = g(), f = g(""), d = g([...r.modelValue]), { open: k, style: N, show: z, close: p } = ee(O, C, { matchWidth: !0 });
27
- V(() => r.modelValue, (e) => d.value = [...e]), V(k, (e) => {
28
- e && (d.value = [...r.modelValue], f.value = "");
25
+ setup(p, { emit: j }) {
26
+ const r = p, A = j, N = ae(), $ = C(), v = C(), m = C(""), y = C([...r.modelValue]), { open: w, style: H, show: K, close: h } = re($, v, { matchWidth: !0 });
27
+ V(() => r.modelValue, (e) => y.value = [...e]), V(w, (e) => {
28
+ e && (y.value = [...r.modelValue], m.value = "");
29
29
  }), V(() => r.disabled, (e) => {
30
- e && p();
30
+ e && h();
31
31
  });
32
- const T = x(() => {
32
+ const U = S(() => {
33
33
  var t;
34
34
  const e = [r.options];
35
35
  let l = r.options;
36
- for (const o of d.value) {
36
+ for (const o of y.value) {
37
37
  const a = l.find((c) => c.value === o);
38
38
  if (!((t = a == null ? void 0 : a.children) != null && t.length)) break;
39
39
  l = a.children, e.push(l);
40
40
  }
41
41
  return e;
42
42
  });
43
- function A(e) {
44
- w("update:modelValue", e), w("change", e);
43
+ function x(e) {
44
+ A("update:modelValue", e), A("change", e);
45
45
  }
46
- function U(e, l) {
46
+ function z(e, l) {
47
47
  var t, o;
48
- e.disabled || r.disabled || (d.value = [...d.value.slice(0, l), e.value], (r.changeOnSelect || !((t = e.children) != null && t.length)) && A(d.value), (o = e.children) != null && o.length || p(!0));
48
+ e.disabled || r.disabled || (y.value = [...y.value.slice(0, l), e.value], (r.changeOnSelect || !((t = e.children) != null && t.length)) && x(y.value), (o = e.children) != null && o.length || h(!0));
49
49
  }
50
- const _ = x(() => {
50
+ const _ = S(() => {
51
51
  let e = r.options;
52
52
  const l = r.modelValue.map((t) => {
53
53
  const o = e.find((a) => a.value === t);
54
54
  return e = (o == null ? void 0 : o.children) || [], (o == null ? void 0 : o.label) || t;
55
55
  });
56
56
  return r.showAllLevels ? l.join(r.separator) : l.at(-1);
57
- }), R = x(() => {
57
+ }), O = S(() => {
58
58
  const e = [];
59
59
  function l(t, o = [], a = [], c = !1) {
60
- var h;
61
- for (const s of t) {
62
- const v = c || s.disabled, b = [...o, s.label], j = [...a, s.value];
63
- !v && (!((h = s.children) != null && h.length) || r.changeOnSelect) && b.join(r.separator).toLocaleLowerCase().includes(f.value.toLocaleLowerCase()) && e.push({ label: b.join(r.separator), path: j }), s.children && l(s.children, b, j, v);
60
+ var f;
61
+ for (const d of t) {
62
+ const k = c || d.disabled, u = [...o, d.label], b = [...a, d.value];
63
+ !k && (!((f = d.children) != null && f.length) || r.changeOnSelect) && u.join(r.separator).toLocaleLowerCase().includes(m.value.toLocaleLowerCase()) && e.push({ label: u.join(r.separator), path: b }), d.children && l(d.children, u, b, k);
64
64
  }
65
65
  }
66
66
  return l(r.options), e;
67
67
  });
68
+ async function R() {
69
+ var e, l, t;
70
+ r.disabled || (await K(), await ee(), (t = ((e = v.value) == null ? void 0 : e.querySelector("input")) || ((l = v.value) == null ? void 0 : l.querySelector(".hys-ui-v4-level button:not(:disabled)"))) == null || t.focus());
71
+ }
68
72
  function F(e) {
69
- var o, a, c, h;
73
+ var o, a, c, f, d, k;
74
+ if (e.isComposing || e.keyCode === 229) return;
70
75
  if (e.key === "Escape") {
71
- e.preventDefault(), p(!0);
76
+ e.preventDefault(), h(!0);
77
+ return;
78
+ }
79
+ const l = document.activeElement;
80
+ let t = l == null ? void 0 : l.closest(".hys-ui-v4-level,.hys-ui-cascader-results");
81
+ if ((l == null ? void 0 : l.tagName) === "INPUT") {
82
+ if (e.key !== "ArrowDown") return;
83
+ e.preventDefault(), (a = (o = v.value) == null ? void 0 : o.querySelector(".hys-ui-cascader-results button,.hys-ui-v4-level button:not(:disabled)")) == null || a.focus();
72
84
  return;
73
85
  }
74
- const l = document.activeElement, t = l == null ? void 0 : l.closest(".hys-ui-v4-level");
75
86
  if (["ArrowUp", "ArrowDown", "Home", "End"].includes(e.key) && t) {
76
87
  e.preventDefault();
77
- const s = Array.from(t.querySelectorAll("button:not(:disabled)")), v = s.indexOf(l), b = e.key === "Home" ? 0 : e.key === "End" ? s.length - 1 : (v + (e.key === "ArrowUp" ? -1 : 1) + s.length) % s.length;
78
- (o = s[b]) == null || o.focus();
79
- } else if (["ArrowLeft", "ArrowRight"].includes(e.key)) {
88
+ const u = Array.from(t.querySelectorAll("button:not(:disabled)")), b = u.indexOf(l), M = e.key === "Home" ? 0 : e.key === "End" ? u.length - 1 : (b + (e.key === "ArrowUp" ? -1 : 1) + u.length) % u.length;
89
+ (c = u[M]) == null || c.focus();
90
+ } else if (t && ["ArrowLeft", "ArrowRight"].includes(e.key)) {
80
91
  e.preventDefault();
81
- const s = Array.from(((a = C.value) == null ? void 0 : a.querySelectorAll(".hys-ui-v4-level")) || []), v = s.indexOf(t);
82
- (h = (c = s[v + (e.key === "ArrowRight" ? 1 : -1)]) == null ? void 0 : c.querySelector("button:not(:disabled)")) == null || h.focus();
92
+ const u = Array.from(((f = v.value) == null ? void 0 : f.querySelectorAll(".hys-ui-v4-level")) || []), b = u.indexOf(t);
93
+ (k = (d = u[b + (e.key === "ArrowRight" ? 1 : -1)]) == null ? void 0 : d.querySelector("button:not(:disabled)")) == null || k.focus();
83
94
  }
84
95
  }
85
- return (e, l) => (n(), u("div", q(i($), { class: "hys-ui-v4-relative" }), [
86
- L("button", {
96
+ return (e, l) => (s(), n("div", T(i(N), { class: "hys-ui-v4-relative" }), [
97
+ D("button", {
87
98
  ref_key: "trigger",
88
- ref: O,
99
+ ref: $,
89
100
  class: "hys-ui-v4-control hys-ui-pf-select-trigger",
90
101
  type: "button",
91
- disabled: y.disabled,
92
- "aria-expanded": i(k),
102
+ disabled: p.disabled,
103
+ "aria-expanded": i(w),
93
104
  "aria-haspopup": "dialog",
94
- onClick: l[0] || (l[0] = (t) => i(k) ? i(p)() : i(z)())
105
+ onClick: l[0] || (l[0] = (t) => i(w) ? i(h)() : R()),
106
+ onKeydown: I(W(R, ["prevent"]), ["down"])
95
107
  }, [
96
- L("span", null, B(_.value || y.placeholder), 1),
97
- M(i(Q), {
108
+ D("span", null, L(_.value || p.placeholder), 1),
109
+ G(i(le), {
98
110
  size: 16,
99
111
  class: "hys-ui-pf-select-chevron"
100
112
  })
101
- ], 8, le),
102
- (n(), S(P, { to: "body" }, [
103
- i(k) ? (n(), u("div", q({
113
+ ], 40, se),
114
+ (s(), B(J, { to: "body" }, [
115
+ i(w) ? (s(), n("div", T({
104
116
  key: 0,
105
117
  ref_key: "panel",
106
- ref: C
107
- }, i($), {
118
+ ref: v
119
+ }, i(N), {
108
120
  class: "hys-ui-v4-menu hys-ui-pf-select-menu",
109
- style: i(N),
121
+ style: i(H),
110
122
  role: "dialog",
111
123
  "aria-label": "级联选择",
112
124
  onKeydown: F
113
125
  }), [
114
- y.filterable ? W((n(), u("input", {
126
+ p.filterable ? Q((s(), n("input", {
115
127
  key: 0,
116
- "onUpdate:modelValue": l[1] || (l[1] = (t) => f.value = t),
128
+ "onUpdate:modelValue": l[1] || (l[1] = (t) => m.value = t),
117
129
  class: "hys-ui-v4-control",
118
130
  placeholder: "搜索分类",
119
131
  "aria-label": "搜索分类"
120
132
  }, null, 512)), [
121
- [G, f.value]
122
- ]) : m("", !0),
123
- f.value ? (n(), u("div", te, [
124
- (n(!0), u(D, null, E(R.value, (t) => (n(), u("button", {
133
+ [X, m.value]
134
+ ]) : g("", !0),
135
+ m.value ? (s(), n("div", ne, [
136
+ (s(!0), n(q, null, E(O.value, (t) => (s(), n("button", {
125
137
  key: t.path.join("/"),
126
138
  type: "button",
127
139
  class: "hys-ui-v4-option",
128
140
  onClick: (o) => {
129
- A(t.path), i(p)(!0);
141
+ x(t.path), i(h)(!0);
130
142
  }
131
- }, B(t.label), 9, oe))), 128)),
132
- R.value.length ? m("", !0) : (n(), u("p", ae, "无匹配分类"))
133
- ])) : (n(), u("div", re, [
134
- (n(!0), u(D, null, E(T.value, (t, o) => (n(), u("div", {
143
+ }, L(t.label), 9, ie))), 128)),
144
+ O.value.length ? g("", !0) : (s(), n("p", ue, "无匹配分类"))
145
+ ])) : (s(), n("div", ce, [
146
+ (s(!0), n(q, null, E(U.value, (t, o) => (s(), n("div", {
135
147
  key: o,
136
148
  class: "hys-ui-v4-scroll hys-ui-v4-level",
137
149
  role: "group",
138
150
  "aria-label": "第" + (o + 1) + "级"
139
151
  }, [
140
- (n(!0), u(D, null, E(t, (a) => {
152
+ (s(!0), n(q, null, E(t, (a) => {
141
153
  var c;
142
- return n(), u("button", {
154
+ return s(), n("button", {
143
155
  key: a.value,
144
156
  type: "button",
145
157
  class: "hys-ui-v4-option",
146
158
  disabled: a.disabled,
147
- "aria-current": d.value[o] === a.value ? "true" : void 0,
148
- onClick: (h) => U(a, o)
159
+ "aria-current": y.value[o] === a.value ? "true" : void 0,
160
+ onClick: (f) => z(a, o)
149
161
  }, [
150
- I(e.$slots, "option", { node: a }, () => [
151
- J(B(a.label), 1)
162
+ Y(e.$slots, "option", { node: a }, () => [
163
+ Z(L(a.label), 1)
152
164
  ]),
153
- (c = a.children) != null && c.length ? (n(), S(i(X), {
165
+ (c = a.children) != null && c.length ? (s(), B(i(te), {
154
166
  key: 0,
155
167
  size: 15
156
- })) : d.value[o] === a.value ? (n(), S(i(Y), {
168
+ })) : y.value[o] === a.value ? (s(), B(i(oe), {
157
169
  key: 1,
158
170
  size: 15
159
- })) : m("", !0)
160
- ], 8, se);
171
+ })) : g("", !0)
172
+ ], 8, ye);
161
173
  }), 128))
162
- ], 8, ne))), 128))
174
+ ], 8, de))), 128))
163
175
  ])),
164
- y.clearable && y.modelValue.length ? (n(), u("button", {
176
+ p.clearable && p.modelValue.length ? (s(), n("button", {
165
177
  key: 3,
166
178
  type: "button",
167
179
  class: "hys-ui-v4-option",
168
180
  onClick: l[2] || (l[2] = (t) => {
169
- A([]), w("clear"), i(p)(!0);
181
+ x([]), A("clear"), i(h)(!0);
170
182
  })
171
- }, "清空选择")) : m("", !0),
172
- L("button", {
183
+ }, "清空选择")) : g("", !0),
184
+ D("button", {
173
185
  type: "button",
174
186
  class: "hys-ui-v4-option",
175
- onClick: l[3] || (l[3] = (t) => i(p)(!0))
187
+ onClick: l[3] || (l[3] = (t) => i(h)(!0))
176
188
  }, "关闭")
177
- ], 16)) : m("", !0)
189
+ ], 16)) : g("", !0)
178
190
  ]))
179
191
  ], 16));
180
192
  }
181
193
  });
182
194
  export {
183
- pe as default
195
+ be as default
184
196
  };
@@ -1,41 +1,7 @@
1
- import { defineComponent as m, openBlock as n, createElementBlock as d, mergeProps as c, unref as u, createElementVNode as s, toDisplayString as b, createCommentVNode as h, renderSlot as y } from "vue";
2
- import { useHysRootAttrs as k } from "../../config.js";
3
- const f = ["name", "value", "required", "aria-label", "indeterminate", "aria-checked", "checked", "disabled"], g = { key: 0 }, q = /* @__PURE__ */ m({
4
- __name: "HysCheckbox",
5
- props: {
6
- modelValue: { type: Boolean },
7
- label: {},
8
- disabled: { type: Boolean },
9
- ariaLabel: {},
10
- readonly: { type: Boolean },
11
- name: {},
12
- value: {},
13
- required: { type: Boolean },
14
- indeterminate: { type: Boolean }
15
- },
16
- emits: ["update:modelValue", "change"],
17
- setup(e, { emit: i }) {
18
- const o = k(), a = i;
19
- return (r, t) => (n(), d("label", c(u(o), { class: "hys-ui-check-label" }), [
20
- s("input", {
21
- type: "checkbox",
22
- name: e.name,
23
- value: e.value,
24
- required: e.required,
25
- "aria-label": e.ariaLabel,
26
- indeterminate: e.indeterminate,
27
- "aria-checked": e.indeterminate ? "mixed" : e.modelValue,
28
- checked: e.modelValue,
29
- disabled: e.disabled || e.readonly,
30
- onChange: t[0] || (t[0] = (l) => {
31
- a("update:modelValue", l.target.checked), a("change", l.target.checked);
32
- })
33
- }, null, 40, f),
34
- e.label ? (n(), d("span", g, b(e.label), 1)) : h("", !0),
35
- y(r.$slots, "default")
36
- ], 16));
37
- }
38
- });
1
+ import o from "./HysCheckbox2.vue.js";
2
+ /* empty css */
3
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const s = /* @__PURE__ */ t(o, [["__scopeId", "data-v-d81911d0"]]);
39
5
  export {
40
- q as default
6
+ s as default
41
7
  };
@@ -1,4 +1,87 @@
1
- import f from "./HysCheckbox.vue.js";
1
+ import { defineComponent as g, ref as C, useAttrs as z, openBlock as o, createElementBlock as s, mergeProps as m, unref as r, createElementVNode as b, normalizeClass as A, renderSlot as h, createBlock as j, resolveDynamicComponent as q, createCommentVNode as y, toDisplayString as E } from "vue";
2
+ import { Minus as O, Check as D } from "lucide-vue-next";
3
+ import { useHysRootAttrs as H } from "../../config.js";
4
+ const L = ["name", "value", "required", "aria-label", "aria-readonly", "indeterminate", "aria-checked", "checked", "disabled", "tabindex"], N = {
5
+ key: 0,
6
+ class: "hys-ui-checkbox-label"
7
+ }, w = /* @__PURE__ */ g({
8
+ inheritAttrs: !1,
9
+ __name: "HysCheckbox",
10
+ props: {
11
+ modelValue: { type: Boolean },
12
+ label: {},
13
+ disabled: { type: Boolean },
14
+ ariaLabel: {},
15
+ readonly: { type: Boolean },
16
+ name: {},
17
+ value: {},
18
+ required: { type: Boolean },
19
+ indeterminate: { type: Boolean },
20
+ tabindex: {},
21
+ size: { default: "md" }
22
+ },
23
+ emits: ["update:modelValue", "change", "focus", "blur"],
24
+ setup(e, { expose: f, emit: k }) {
25
+ const n = e, l = k, x = H(), d = C(), c = z(), u = (t) => t === "id" || t === "form" || t === "autofocus" || t.startsWith("aria-"), v = () => Object.fromEntries(Object.entries(c).filter(([t]) => !u(t))), V = () => Object.fromEntries(Object.entries(c).filter(([t]) => u(t)));
26
+ function B(t) {
27
+ const a = t.target;
28
+ if (n.disabled || n.readonly) {
29
+ a.checked = n.modelValue, a.indeterminate = !!n.indeterminate;
30
+ return;
31
+ }
32
+ const i = a.checked;
33
+ l("update:modelValue", i), l("change", i);
34
+ }
35
+ return f({ input: d, focus: () => {
36
+ var t;
37
+ return (t = d.value) == null ? void 0 : t.focus();
38
+ }, blur: () => {
39
+ var t;
40
+ return (t = d.value) == null ? void 0 : t.blur();
41
+ } }), (t, a) => (o(), s("label", m({ ...r(x), ...v() }, {
42
+ class: ["hys-ui-check-label", ["hys-ui-checkbox-" + e.size, { "hys-ui-checkbox-disabled": e.disabled, "hys-ui-checkbox-readonly": e.readonly }]]
43
+ }), [
44
+ b("input", m({
45
+ ref_key: "input",
46
+ ref: d
47
+ }, V(), {
48
+ class: "hys-ui-checkbox-native",
49
+ type: "checkbox",
50
+ name: e.name,
51
+ value: e.value,
52
+ required: e.required,
53
+ "aria-label": e.ariaLabel,
54
+ "aria-readonly": e.readonly || void 0,
55
+ indeterminate: e.indeterminate,
56
+ "aria-checked": e.indeterminate ? "mixed" : e.modelValue,
57
+ checked: e.modelValue,
58
+ disabled: e.disabled,
59
+ tabindex: e.tabindex,
60
+ onClick: a[0] || (a[0] = (i) => e.readonly && i.preventDefault()),
61
+ onChange: B,
62
+ onFocus: a[1] || (a[1] = (i) => l("focus", i)),
63
+ onBlur: a[2] || (a[2] = (i) => l("blur", i))
64
+ }), null, 16, L),
65
+ b("span", {
66
+ class: A(["hys-ui-checkbox-box", { "hys-ui-checkbox-checked": e.modelValue || e.indeterminate }]),
67
+ "aria-hidden": "true"
68
+ }, [
69
+ h(t.$slots, "icon", {
70
+ checked: e.modelValue,
71
+ indeterminate: e.indeterminate
72
+ }, () => [
73
+ e.modelValue || e.indeterminate ? (o(), j(q(e.indeterminate ? r(O) : r(D)), {
74
+ key: 0,
75
+ size: e.size === "sm" ? 11 : e.size === "lg" ? 15 : 13,
76
+ "stroke-width": 2.4
77
+ }, null, 8, ["size"])) : y("", !0)
78
+ ], !0)
79
+ ], 2),
80
+ e.label ? (o(), s("span", N, E(e.label), 1)) : y("", !0),
81
+ h(t.$slots, "default", {}, void 0, !0)
82
+ ], 16));
83
+ }
84
+ });
2
85
  export {
3
- f as default
86
+ w as default
4
87
  };
@@ -1,104 +1,105 @@
1
- import { defineComponent as N, ref as l, computed as T, onMounted as B, onActivated as U, onDeactivated as z, onUnmounted as H, openBlock as r, createElementBlock as u, Fragment as g, createElementVNode as a, mergeProps as b, unref as m, createVNode as R, createTextVNode as C, createBlock as $, Teleport as q, withModifiers as F, withDirectives as S, vModelText as j, renderList as G, normalizeClass as I, toDisplayString as _, createCommentVNode as x, nextTick as J } from "vue";
2
- import { useHysRootAttrs as O } from "../../config.js";
3
- import { Command as Q } from "lucide-vue-next";
4
- import { useDialog as W } from "../../composables/useDialog.js";
5
- const X = {
6
- id: "v4-command-results",
7
- role: "listbox",
8
- class: "hys-ui-v4-scroll"
9
- }, Y = ["aria-selected", "onPointerenter", "onClick"], Z = { key: 0 }, le = /* @__PURE__ */ N({
1
+ import { defineComponent as T, useId as B, ref as l, computed as U, watch as z, onMounted as H, onActivated as I, onDeactivated as R, onUnmounted as $, openBlock as r, createElementBlock as c, Fragment as b, createElementVNode as a, mergeProps as C, unref as i, createVNode as q, createTextVNode as _, createBlock as F, Teleport as S, withModifiers as j, withDirectives as G, vModelText as J, renderList as O, normalizeClass as Q, toDisplayString as x, createCommentVNode as D, nextTick as W } from "vue";
2
+ import { useHysRootAttrs as X } from "../../config.js";
3
+ import { Command as Y } from "lucide-vue-next";
4
+ import { useDialog as Z } from "../../composables/useDialog.js";
5
+ const ee = ["aria-controls"], te = ["id"], oe = ["aria-selected", "onPointerenter", "onClick"], ne = { key: 0 }, se = /* @__PURE__ */ T({
10
6
  __name: "HysCommandPalette",
11
7
  props: {
12
8
  actions: {}
13
9
  },
14
10
  emits: ["select"],
15
- setup(D, { emit: E }) {
16
- const f = O(), L = D, M = E, i = l(!1), d = l(""), t = l(0), y = l(null), P = l(null), k = l(), { active: A } = W(i, k, s), o = T(() => L.actions.filter((e) => (e.label + " " + (e.description || "")).toLowerCase().includes(d.value.toLowerCase())));
11
+ setup(E, { emit: L }) {
12
+ const f = X(), M = E, P = L, y = B(), s = l(!1), u = l(""), t = l(0), k = l(null), A = l(null), h = l(), { active: K } = Z(s, h, d), o = U(() => M.actions.filter((e) => (e.label + " " + (e.description || "")).toLowerCase().includes(u.value.toLowerCase())));
13
+ z(u, () => t.value = 0);
17
14
  function w() {
18
- i.value = !0, d.value = "", t.value = 0, J(() => {
15
+ s.value = !0, u.value = "", t.value = 0, W(() => {
19
16
  var e;
20
- return (e = y.value) == null ? void 0 : e.focus();
17
+ return (e = k.value) == null ? void 0 : e.focus();
21
18
  });
22
19
  }
23
- function s() {
24
- i.value = !1;
20
+ function d() {
21
+ s.value = !1;
25
22
  }
26
- function h(e) {
27
- M("select", e), s();
23
+ function g(e) {
24
+ P("select", e), d();
28
25
  }
29
- function c(e) {
30
- e.defaultPrevented || (e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "k" && (e.preventDefault(), i.value ? s() : w());
26
+ function v(e) {
27
+ e.defaultPrevented || (e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "k" && (e.preventDefault(), s.value ? d() : w());
31
28
  }
32
- function K(e) {
33
- e.key === "ArrowDown" && (e.preventDefault(), t.value = (t.value + 1) % Math.max(1, o.value.length)), e.key === "ArrowUp" && (e.preventDefault(), t.value = (t.value - 1 + Math.max(1, o.value.length)) % Math.max(1, o.value.length)), e.key === "Enter" && o.value[t.value] && h(o.value[t.value].id);
29
+ function V(e) {
30
+ e.isComposing || e.keyCode === 229 || (e.key === "ArrowDown" && (e.preventDefault(), t.value = (t.value + 1) % Math.max(1, o.value.length)), e.key === "ArrowUp" && (e.preventDefault(), t.value = (t.value - 1 + Math.max(1, o.value.length)) % Math.max(1, o.value.length)), e.key === "Enter" && o.value[t.value] && g(o.value[t.value].id));
34
31
  }
35
- return B(() => window.addEventListener("keydown", c)), U(() => window.addEventListener("keydown", c)), z(() => window.removeEventListener("keydown", c)), H(() => window.removeEventListener("keydown", c)), (e, v) => (r(), u(g, null, [
36
- a("button", b(m(f), {
32
+ return H(() => window.addEventListener("keydown", v)), I(() => window.addEventListener("keydown", v)), R(() => window.removeEventListener("keydown", v)), $(() => window.removeEventListener("keydown", v)), (e, p) => (r(), c(b, null, [
33
+ a("button", C(i(f), {
37
34
  ref_key: "trigger",
38
- ref: P,
35
+ ref: A,
39
36
  type: "button",
40
37
  class: "hys-ui-v4-control",
41
38
  onClick: w
42
39
  }), [
43
- R(m(Q), {
40
+ q(i(Y), {
44
41
  size: 14,
45
42
  "aria-hidden": "true"
46
43
  }),
47
- v[1] || (v[1] = C(" / Ctrl + K · 快捷命令", -1))
44
+ p[1] || (p[1] = _(" / Ctrl + K · 快捷命令", -1))
48
45
  ], 16),
49
- (r(), $(q, { to: "body" }, [
50
- i.value && m(A) ? (r(), u("div", b({ key: 0 }, m(f), {
46
+ (r(), F(S, { to: "body" }, [
47
+ s.value && i(K) ? (r(), c("div", C({ key: 0 }, i(f), {
51
48
  class: "hys-ui-v4-backdrop",
52
- onPointerdown: F(s, ["self"])
49
+ onPointerdown: j(d, ["self"])
53
50
  }), [
54
51
  a("section", {
55
52
  ref_key: "dialog",
56
- ref: k,
53
+ ref: h,
57
54
  tabindex: "-1",
58
55
  class: "hys-ui-v4-dialog",
59
56
  role: "dialog",
60
57
  "aria-modal": "true",
61
58
  "aria-label": "快捷命令"
62
59
  }, [
63
- S(a("input", {
60
+ G(a("input", {
64
61
  ref_key: "input",
65
- ref: y,
66
- "onUpdate:modelValue": v[0] || (v[0] = (n) => d.value = n),
62
+ ref: k,
63
+ "onUpdate:modelValue": p[0] || (p[0] = (n) => u.value = n),
67
64
  class: "hys-ui-v4-control",
68
65
  placeholder: "搜索操作…",
69
66
  role: "combobox",
70
- "aria-controls": "v4-command-results",
67
+ "aria-controls": i(y),
71
68
  "aria-expanded": !0,
72
- onKeydown: K
73
- }, null, 544), [
74
- [j, d.value]
69
+ onKeydown: V
70
+ }, null, 40, ee), [
71
+ [J, u.value]
75
72
  ]),
76
- a("div", X, [
77
- (r(!0), u(g, null, G(o.value, (n, p) => (r(), u("button", {
73
+ a("div", {
74
+ id: i(y),
75
+ role: "listbox",
76
+ class: "hys-ui-v4-scroll"
77
+ }, [
78
+ (r(!0), c(b, null, O(o.value, (n, m) => (r(), c("button", {
78
79
  type: "button",
79
80
  key: n.id,
80
- class: I(["hys-ui-v4-option", { "hys-ui-v4-active": p === t.value }]),
81
+ class: Q(["hys-ui-v4-option", { "hys-ui-v4-active": m === t.value }]),
81
82
  role: "option",
82
- "aria-selected": p === t.value,
83
- onPointerenter: (V) => t.value = p,
84
- onClick: (V) => h(n.id)
83
+ "aria-selected": m === t.value,
84
+ onPointerenter: (N) => t.value = m,
85
+ onClick: (N) => g(n.id)
85
86
  }, [
86
- C(_(n.label) + " ", 1),
87
- a("small", null, _(n.description), 1)
88
- ], 42, Y))), 128)),
89
- o.value.length ? x("", !0) : (r(), u("p", Z, "没有匹配的命令"))
90
- ]),
87
+ _(x(n.label) + " ", 1),
88
+ a("small", null, x(n.description), 1)
89
+ ], 42, oe))), 128)),
90
+ o.value.length ? D("", !0) : (r(), c("p", ne, "没有匹配的命令"))
91
+ ], 8, te),
91
92
  a("button", {
92
93
  type: "button",
93
94
  class: "hys-ui-v4-option",
94
- onClick: s
95
+ onClick: d
95
96
  }, "关闭 Esc")
96
97
  ], 512)
97
- ], 16)) : x("", !0)
98
+ ], 16)) : D("", !0)
98
99
  ]))
99
100
  ], 64));
100
101
  }
101
102
  });
102
103
  export {
103
- le as default
104
+ se as default
104
105
  };
@@ -1,41 +1,41 @@
1
- import { defineComponent as c, ref as p, openBlock as o, createElementBlock as r, mergeProps as v, unref as y, Fragment as f, renderList as h, createElementVNode as n, toDisplayString as s, withDirectives as _, withKeys as b, withModifiers as k, vModelText as C } from "vue";
2
- import { useHysRootAttrs as w } from "../../config.js";
3
- const x = ["onClick"], g = ["onKeydown"], E = ["disabled"], H = /* @__PURE__ */ c({
1
+ import { defineComponent as p, ref as c, openBlock as r, createElementBlock as s, mergeProps as v, unref as f, Fragment as y, renderList as h, createElementVNode as n, toDisplayString as i, withDirectives as C, withKeys as b, withModifiers as k, vModelText as _ } from "vue";
2
+ import { useHysRootAttrs as g } from "../../config.js";
3
+ const x = ["onClick"], w = ["disabled"], H = /* @__PURE__ */ p({
4
4
  __name: "HysCommentEditor",
5
5
  props: {
6
6
  comments: {}
7
7
  },
8
8
  emits: ["send", "remove"],
9
9
  setup(u, { emit: a }) {
10
- const d = w(), l = a, t = p("");
11
- function i() {
10
+ const d = g(), l = a, t = c("");
11
+ function m() {
12
12
  t.value.trim() && (l("send", t.value.trim()), t.value = "");
13
13
  }
14
- return (K, m) => (o(), r("section", v(y(d), { class: "hys-ui-ent-panel" }), [
15
- (o(!0), r(f, null, h(u.comments, (e) => (o(), r("div", {
14
+ return (E, o) => (r(), s("section", v(f(d), { class: "hys-ui-ent-panel" }), [
15
+ (r(!0), s(y, null, h(u.comments, (e) => (r(), s("div", {
16
16
  key: e.id,
17
17
  class: "hys-ui-ent-comment"
18
18
  }, [
19
- n("strong", null, s(e.author), 1),
20
- n("small", null, s(e.time), 1),
21
- n("p", null, s(e.text), 1),
19
+ n("strong", null, i(e.author), 1),
20
+ n("small", null, i(e.time), 1),
21
+ n("p", null, i(e.text), 1),
22
22
  n("button", {
23
23
  type: "button",
24
24
  onClick: (A) => l("remove", e.id)
25
25
  }, "删除", 8, x)
26
26
  ]))), 128)),
27
- _(n("textarea", {
28
- "onUpdate:modelValue": m[0] || (m[0] = (e) => t.value = e),
27
+ C(n("textarea", {
28
+ "onUpdate:modelValue": o[0] || (o[0] = (e) => t.value = e),
29
29
  placeholder: "输入评论,Ctrl+Enter 发送",
30
- onKeydown: b(k(i, ["ctrl"]), ["enter"])
31
- }, null, 40, g), [
32
- [C, t.value]
30
+ onKeydown: o[1] || (o[1] = b(k((e) => !e.isComposing && m(), ["ctrl"]), ["enter"]))
31
+ }, null, 544), [
32
+ [_, t.value]
33
33
  ]),
34
34
  n("button", {
35
35
  type: "button",
36
36
  disabled: !t.value.trim(),
37
- onClick: i
38
- }, "发送评论", 8, E)
37
+ onClick: m
38
+ }, "发送评论", 8, w)
39
39
  ], 16));
40
40
  }
41
41
  });