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 G, ref as p, useId as J, computed as x, watch as I, openBlock as s, createElementBlock as o, mergeProps as q, unref as i, createElementVNode as H, renderSlot as k, Fragment as A, renderList as F, toDisplayString as L, createTextVNode as z, createBlock as E, withModifiers as O, createVNode as Q, createCommentVNode as g, Teleport as Y, withDirectives as Z, vModelText as _, normalizeClass as ee, nextTick as ae } from "vue";
2
- import { LoaderCircle as le, ChevronDown as te, X as ie, Check as se } from "lucide-vue-next";
3
- import { useHysRootAttrs as oe } from "../../config.js";
4
- import { useFloating as ue } from "../../composables/useFloating.js";
5
- const re = ["aria-label", "disabled", "aria-expanded", "aria-controls", "aria-activedescendant"], ne = { class: "hys-ui-select-label" }, de = ["aria-controls", "aria-activedescendant"], ce = ["id", "aria-multiselectable"], ve = {
1
+ import { defineComponent as Q, ref as p, useId as Y, computed as I, watch as m, nextTick as q, openBlock as s, createElementBlock as n, mergeProps as F, unref as i, createElementVNode as L, renderSlot as C, Fragment as D, renderList as K, toDisplayString as z, createBlock as E, withModifiers as Z, createVNode as _, createCommentVNode as V, Teleport as ee, withDirectives as le, vModelText as ae, createTextVNode as H, normalizeClass as te } from "vue";
2
+ import { LoaderCircle as ie, ChevronDown as se, X as oe, Check as ue } from "lucide-vue-next";
3
+ import { useHysRootAttrs as re } from "../../config.js";
4
+ import { useFloating as ne } from "../../composables/useFloating.js";
5
+ const de = ["aria-label", "disabled", "aria-expanded", "aria-controls", "aria-activedescendant"], ce = { class: "hys-ui-select-label" }, ve = ["title"], ye = ["aria-controls", "aria-activedescendant"], fe = ["id", "aria-multiselectable"], he = {
6
6
  key: 0,
7
7
  class: "hys-ui-floating-empty"
8
- }, ye = ["id", "data-active", "aria-selected", "disabled", "onPointerenter", "onClick"], fe = {
8
+ }, be = ["id", "data-active", "aria-selected", "disabled", "onPointerenter", "onClick"], pe = ["title"], me = {
9
9
  key: 0,
10
10
  class: "hys-ui-floating-empty"
11
- }, ke = /* @__PURE__ */ G({
11
+ }, Ve = /* @__PURE__ */ Q({
12
12
  __name: "HysSelect",
13
13
  props: {
14
14
  modelValue: {},
@@ -21,181 +21,202 @@ const re = ["aria-label", "disabled", "aria-expanded", "aria-controls", "aria-ac
21
21
  clearable: { type: Boolean },
22
22
  loading: { type: Boolean },
23
23
  remote: { type: Boolean },
24
+ popupMatchWidth: { type: Boolean },
25
+ filterMethod: {},
24
26
  emptyText: { default: "暂无选项" },
25
27
  size: { default: "md" }
26
28
  },
27
29
  emits: ["update:modelValue", "change", "clear", "search", "visibleChange"],
28
- setup(u, { expose: K, emit: R }) {
29
- const t = u, b = R, M = oe(), h = p(), w = p(), N = p(), y = p(""), n = p(0), f = J(), { open: v, style: W, show: X, close: m } = ue(h, w, { placement: "bottom-start", matchWidth: !0 }), C = x(() => t.multiple || Array.isArray(t.modelValue)), d = x(() => Array.isArray(t.modelValue) ? t.modelValue : [t.modelValue].filter(Boolean)), V = x(() => t.options.filter((e) => d.value.includes(e.value))), c = x(() => t.remote ? t.options : t.options.filter((e) => !y.value || e.label.toLocaleLowerCase().includes(y.value.toLocaleLowerCase())));
30
- function T(e) {
31
- b("update:modelValue", e), b("change", e);
30
+ setup(d, { expose: R, emit: X }) {
31
+ const t = d, k = X, N = re(), g = p(), B = p(), P = p(), y = p(""), o = p(0), f = Y(), { open: v, style: j, show: G, close: h, update: J } = ne(g, B, { placement: "bottom-start", matchWidth: () => t.popupMatchWidth ? !0 : "min" }), x = I(() => t.multiple || Array.isArray(t.modelValue)), u = I(() => Array.isArray(t.modelValue) ? t.modelValue : [t.modelValue].filter(Boolean)), T = p(/* @__PURE__ */ new Map());
32
+ m(() => [t.options, u.value], () => {
33
+ const e = T.value, a = /* @__PURE__ */ new Map();
34
+ for (const l of t.options) a.set(l.value, l);
35
+ for (const l of u.value) !a.has(l) && e.has(l) && a.set(l, e.get(l));
36
+ T.value = a;
37
+ }, { immediate: !0, deep: !0 });
38
+ const w = I(() => u.value.map((e) => T.value.get(e) ?? { value: e, label: e })), r = I(() => t.remote ? t.options : t.options.filter((e) => !y.value || (t.filterMethod ? t.filterMethod(y.value, e) : e.label.toLocaleLowerCase().includes(y.value.toLocaleLowerCase()))));
39
+ function $(e) {
40
+ k("update:modelValue", e), k("change", e);
32
41
  }
33
42
  function S(e) {
34
- const l = c.value[e];
35
- !l || l.disabled || t.disabled || t.loading || (C.value ? T(d.value.includes(l.value) ? d.value.filter((a) => a !== l.value) : [...d.value, l.value]) : (T(l.value), m(!0)));
43
+ const a = r.value[e];
44
+ !a || a.disabled || t.disabled || t.loading || (x.value ? $(u.value.includes(a.value) ? u.value.filter((l) => l !== a.value) : [...u.value, a.value]) : ($(a.value), h(!0)));
36
45
  }
37
- function j() {
46
+ function O() {
38
47
  var e;
39
- t.disabled || (T(C.value ? [] : ""), b("clear"), (e = h.value) == null || e.focus());
48
+ t.disabled || ($(x.value ? [] : ""), k("clear"), (e = g.value) == null || e.focus());
40
49
  }
41
- async function $() {
42
- var e;
43
- if (!t.disabled) {
44
- if (v.value) {
45
- m();
46
- return;
47
- }
48
- y.value = "", n.value = Math.max(0, c.value.findIndex((l) => d.value.includes(l.value) && !l.disabled)), await X(), t.filterable && ((e = N.value) == null || e.focus());
50
+ async function M() {
51
+ var a;
52
+ if (t.disabled) return;
53
+ if (v.value) {
54
+ h();
55
+ return;
49
56
  }
57
+ y.value = "";
58
+ const e = r.value.findIndex((l) => u.value.includes(l.value) && !l.disabled);
59
+ o.value = e >= 0 ? e : r.value.findIndex((l) => !l.disabled), await G(), t.filterable && ((a = P.value) == null || a.focus());
50
60
  }
51
- async function P(e) {
52
- var l, a, r;
53
- if (!t.disabled)
61
+ async function W(e) {
62
+ var a, l, c;
63
+ if (!(t.disabled || e.isComposing || e.keyCode === 229))
54
64
  if (["ArrowDown", "ArrowUp", "Home", "End"].includes(e.key)) {
55
- if (e.preventDefault(), !v.value) await $();
65
+ if (e.preventDefault(), !v.value) await M();
56
66
  else {
57
- const D = e.key === "ArrowUp" ? -1 : 1;
58
- let B = e.key === "Home" ? -1 : e.key === "End" ? c.value.length : n.value;
59
- for (let U = 0; U < c.value.length; U++)
60
- if (B = (B + (e.key === "End" ? -1 : D) + c.value.length) % c.value.length, !c.value[B].disabled) {
61
- n.value = B;
67
+ const b = e.key === "ArrowUp" ? -1 : 1;
68
+ let A = e.key === "Home" ? -1 : e.key === "End" ? r.value.length : o.value;
69
+ for (let U = 0; U < r.value.length; U++)
70
+ if (A = (A + (e.key === "End" ? -1 : b) + r.value.length) % r.value.length, !r.value[A].disabled) {
71
+ o.value = A;
62
72
  break;
63
73
  }
64
74
  }
65
- await ae(), (a = (l = w.value) == null ? void 0 : l.querySelector('[data-active="true"]')) == null || a.scrollIntoView({ block: "nearest" });
66
- } else e.key === "Enter" || e.key === " " && !t.filterable ? (e.preventDefault(), v.value ? S(n.value) : await $()) : e.key === "Tab" && m(!!((r = w.value) != null && r.contains(document.activeElement)));
75
+ await q(), (l = (a = B.value) == null ? void 0 : a.querySelector('[data-active="true"]')) == null || l.scrollIntoView({ block: "nearest" });
76
+ } else e.key === "Enter" || e.key === " " && !t.filterable ? (e.preventDefault(), v.value ? S(o.value) : await M()) : e.key === "Tab" && h(!!((c = B.value) != null && c.contains(document.activeElement)));
67
77
  }
68
- return I(y, (e) => {
69
- n.value = Math.max(0, c.value.findIndex((l) => !l.disabled)), b("search", e);
70
- }), I(v, (e) => b("visibleChange", e)), I(() => t.disabled, (e) => {
71
- e && m();
72
- }), K({ focus: () => {
78
+ return m(y, (e) => {
79
+ o.value = r.value.findIndex((a) => !a.disabled), k("search", e);
80
+ }), m(r, (e) => {
81
+ (!e[o.value] || e[o.value].disabled) && (o.value = e.findIndex((a) => !a.disabled)), v.value && q(J);
82
+ }, { deep: !0 }), m(() => t.popupMatchWidth, () => {
83
+ v.value && (h(), M());
84
+ }), m(v, (e) => k("visibleChange", e)), m(() => t.disabled, (e) => {
85
+ e && h();
86
+ }), R({ focus: () => {
73
87
  var e;
74
- return (e = h.value) == null ? void 0 : e.focus();
88
+ return (e = g.value) == null ? void 0 : e.focus();
75
89
  }, blur: () => {
76
90
  var e;
77
- return (e = h.value) == null ? void 0 : e.blur();
78
- }, close: () => m() }), (e, l) => (s(), o("div", q(i(M), {
79
- class: ["hys-ui-select-wrap", "hys-ui-select-" + u.size]
91
+ return (e = g.value) == null ? void 0 : e.blur();
92
+ }, close: () => h() }), (e, a) => (s(), n("div", F(i(N), {
93
+ class: ["hys-ui-select-wrap", "hys-ui-select-" + d.size]
80
94
  }), [
81
- H("button", {
95
+ L("button", {
82
96
  ref_key: "trigger",
83
- ref: h,
97
+ ref: g,
84
98
  type: "button",
85
99
  class: "hys-ui-select",
86
- "aria-label": u.ariaLabel,
87
- disabled: u.disabled,
100
+ "aria-label": d.ariaLabel,
101
+ disabled: d.disabled,
88
102
  role: "combobox",
89
103
  "aria-haspopup": "listbox",
90
104
  "aria-expanded": i(v),
91
105
  "aria-controls": i(v) ? i(f) : void 0,
92
- "aria-activedescendant": i(v) ? i(f) + "-" + n.value : void 0,
93
- onClick: $,
94
- onKeydown: P
106
+ "aria-activedescendant": i(v) ? i(f) + "-" + o.value : void 0,
107
+ onClick: M,
108
+ onKeydown: W
95
109
  }, [
96
- H("span", ne, [
97
- k(e.$slots, "label", { selected: V.value }, () => {
98
- var a;
110
+ L("span", ce, [
111
+ C(e.$slots, "label", { selected: w.value }, () => {
112
+ var l, c;
99
113
  return [
100
- C.value && V.value.length ? (s(!0), o(A, { key: 0 }, F(V.value, (r) => (s(), o("span", {
101
- key: r.value,
114
+ x.value && w.value.length ? (s(!0), n(D, { key: 0 }, K(w.value, (b) => (s(), n("span", {
115
+ key: b.value,
102
116
  class: "hys-ui-select-tag"
103
- }, L(r.label), 1))), 128)) : (s(), o(A, { key: 1 }, [
104
- z(L(((a = V.value[0]) == null ? void 0 : a.label) || u.placeholder), 1)
105
- ], 64))
117
+ }, z(b.label), 1))), 128)) : (s(), n("span", {
118
+ key: 1,
119
+ class: "hys-ui-select-single-label",
120
+ title: (l = w.value[0]) == null ? void 0 : l.label
121
+ }, z(((c = w.value[0]) == null ? void 0 : c.label) || d.placeholder), 9, ve))
106
122
  ];
107
123
  }, !0)
108
124
  ]),
109
- u.loading ? (s(), E(i(le), {
125
+ d.loading ? (s(), E(i(ie), {
110
126
  key: 0,
111
127
  class: "hys-ui-icon-spin",
112
128
  size: 16
113
- })) : (s(), E(i(te), {
129
+ })) : (s(), E(i(se), {
114
130
  key: 1,
115
131
  class: "hys-ui-select-chevron",
116
132
  size: 16,
117
133
  "aria-hidden": "true"
118
134
  }))
119
- ], 40, re),
120
- u.clearable && d.value.length && !u.disabled ? (s(), o("button", {
135
+ ], 40, de),
136
+ d.clearable && u.value.length && !d.disabled ? (s(), n("button", {
121
137
  key: 0,
122
138
  type: "button",
123
139
  class: "hys-ui-select-clear",
124
140
  "aria-label": "清空选择",
125
- onClick: O(j, ["stop"])
141
+ onClick: Z(O, ["stop"])
126
142
  }, [
127
- Q(i(ie), { size: 13 })
128
- ])) : g("", !0),
129
- (s(), E(Y, { to: "body" }, [
130
- i(v) ? (s(), o("div", q({
143
+ _(i(oe), { size: 13 })
144
+ ])) : V("", !0),
145
+ (s(), E(ee, { to: "body" }, [
146
+ i(v) ? (s(), n("div", F({
131
147
  key: 0,
132
148
  ref_key: "panel",
133
- ref: w
134
- }, i(M), {
149
+ ref: B
150
+ }, i(N), {
135
151
  class: "hys-ui-select-options hys-ui-floating-surface",
136
- style: i(W),
137
- onKeydown: P
152
+ style: i(j),
153
+ onKeydown: W
138
154
  }), [
139
- u.filterable ? Z((s(), o("input", {
155
+ d.filterable ? le((s(), n("input", {
140
156
  key: 0,
141
157
  ref_key: "searchInput",
142
- ref: N,
143
- "onUpdate:modelValue": l[0] || (l[0] = (a) => y.value = a),
158
+ ref: P,
159
+ "onUpdate:modelValue": a[0] || (a[0] = (l) => y.value = l),
144
160
  class: "hys-ui-select-search",
145
161
  placeholder: "搜索选项…",
146
162
  "aria-label": "搜索选项",
147
163
  "aria-controls": i(f),
148
- "aria-activedescendant": i(f) + "-" + n.value
149
- }, null, 8, de)), [
150
- [_, y.value]
151
- ]) : g("", !0),
152
- H("div", {
164
+ "aria-activedescendant": i(f) + "-" + o.value
165
+ }, null, 8, ye)), [
166
+ [ae, y.value]
167
+ ]) : V("", !0),
168
+ L("div", {
153
169
  id: i(f),
154
170
  role: "listbox",
155
- "aria-multiselectable": C.value || void 0
171
+ "aria-multiselectable": x.value || void 0
156
172
  }, [
157
- u.loading ? (s(), o("p", ve, [
158
- k(e.$slots, "loading", {}, () => [
159
- l[1] || (l[1] = z("加载中…", -1))
173
+ d.loading ? (s(), n("p", he, [
174
+ C(e.$slots, "loading", {}, () => [
175
+ a[1] || (a[1] = H("加载中…", -1))
160
176
  ], !0)
161
- ])) : (s(), o(A, { key: 1 }, [
162
- (s(!0), o(A, null, F(c.value, (a, r) => (s(), o("button", {
163
- id: i(f) + "-" + r,
164
- key: a.value,
177
+ ])) : (s(), n(D, { key: 1 }, [
178
+ (s(!0), n(D, null, K(r.value, (l, c) => (s(), n("button", {
179
+ id: i(f) + "-" + c,
180
+ key: l.value,
165
181
  type: "button",
166
182
  role: "option",
167
- class: ee(["hys-ui-select-option", { "hys-ui-selected": d.value.includes(a.value), "hys-ui-active": n.value === r && !a.disabled }]),
168
- "data-active": n.value === r,
169
- "aria-selected": d.value.includes(a.value),
170
- disabled: a.disabled,
171
- onPointerenter: (D) => !a.disabled && (n.value = r),
172
- onClick: (D) => S(r)
183
+ class: te(["hys-ui-select-option", { "hys-ui-selected": u.value.includes(l.value), "hys-ui-active": o.value === c && !l.disabled }]),
184
+ "data-active": o.value === c,
185
+ "aria-selected": u.value.includes(l.value),
186
+ disabled: l.disabled,
187
+ onPointerenter: (b) => !l.disabled && (o.value = c),
188
+ onClick: (b) => S(c)
173
189
  }, [
174
- k(e.$slots, "option", {
175
- option: a,
176
- selected: d.value.includes(a.value)
177
- }, () => [
178
- z(L(a.label), 1)
179
- ], !0),
180
- d.value.includes(a.value) ? (s(), E(i(se), {
190
+ L("span", {
191
+ class: "hys-ui-select-option-label",
192
+ title: l.label
193
+ }, [
194
+ C(e.$slots, "option", {
195
+ option: l,
196
+ selected: u.value.includes(l.value)
197
+ }, () => [
198
+ H(z(l.label), 1)
199
+ ], !0)
200
+ ], 8, pe),
201
+ u.value.includes(l.value) ? (s(), E(i(ue), {
181
202
  key: 0,
182
203
  size: 15,
183
204
  "aria-hidden": "true"
184
- })) : g("", !0)
185
- ], 42, ye))), 128)),
186
- c.value.length ? g("", !0) : (s(), o("p", fe, [
187
- k(e.$slots, "empty", {}, () => [
188
- z(L(u.emptyText), 1)
205
+ })) : V("", !0)
206
+ ], 42, be))), 128)),
207
+ r.value.length ? V("", !0) : (s(), n("p", me, [
208
+ C(e.$slots, "empty", {}, () => [
209
+ H(z(d.emptyText), 1)
189
210
  ], !0)
190
211
  ]))
191
212
  ], 64))
192
- ], 8, ce),
193
- k(e.$slots, "footer", {}, void 0, !0)
194
- ], 16)) : g("", !0)
213
+ ], 8, fe),
214
+ C(e.$slots, "footer", {}, void 0, !0)
215
+ ], 16)) : V("", !0)
195
216
  ]))
196
217
  ], 16));
197
218
  }
198
219
  });
199
220
  export {
200
- ke as default
221
+ Ve as default
201
222
  };
@@ -1,7 +1,7 @@
1
1
  import o from "./HysSlider2.vue.js";
2
2
  /* empty css */
3
3
  import r from "../../_virtual/_plugin-vue_export-helper.js";
4
- const f = /* @__PURE__ */ r(o, [["__scopeId", "data-v-75f3c7ec"]]);
4
+ const p = /* @__PURE__ */ r(o, [["__scopeId", "data-v-a22942a0"]]);
5
5
  export {
6
- f as default
6
+ p as default
7
7
  };
@@ -1,9 +1,9 @@
1
- import { defineComponent as A, computed as x, openBlock as i, createElementBlock as u, mergeProps as C, unref as B, toDisplayString as f, createCommentVNode as y, createElementVNode as T, withModifiers as N, normalizeClass as R, normalizeStyle as b, Fragment as g, renderList as V } from "vue";
2
- import { useHysRootAttrs as S } from "../../config.js";
3
- const z = { key: 0 }, E = ["aria-label", "min", "max", "step", "value", "disabled", "aria-valuetext", "onInput", "onChange"], H = {
1
+ import { defineComponent as C, computed as v, openBlock as u, createElementBlock as m, mergeProps as N, unref as B, toDisplayString as y, createCommentVNode as x, createElementVNode as T, withModifiers as S, normalizeClass as z, normalizeStyle as M, Fragment as V, renderList as k } from "vue";
2
+ import { useHysRootAttrs as F } from "../../config.js";
3
+ const R = { key: 0 }, E = ["aria-label", "min", "max", "step", "value", "disabled", "aria-valuetext", "onInput", "onChange"], H = {
4
4
  key: 1,
5
5
  class: "hys-ui-slider-marks"
6
- }, j = /* @__PURE__ */ A({
6
+ }, j = /* @__PURE__ */ C({
7
7
  __name: "HysSlider",
8
8
  props: {
9
9
  modelValue: {},
@@ -17,58 +17,58 @@ const z = { key: 0 }, E = ["aria-label", "min", "max", "step", "value", "disable
17
17
  formatTooltip: {}
18
18
  },
19
19
  emits: ["update:modelValue", "change"],
20
- setup(e, { emit: M }) {
21
- const t = e, s = M, k = S(), o = x(() => Array.isArray(t.modelValue)), m = x(() => Array.isArray(t.modelValue) ? t.modelValue : [t.modelValue]), c = (r) => Math.max(0, Math.min(100, (r - t.min) / Math.max(1, t.max - t.min) * 100));
22
- function w(r) {
23
- if (t.disabled || !o.value) return;
24
- const n = r.currentTarget.getBoundingClientRect();
25
- if (!n.width) return;
26
- const l = Math.min(t.max, Math.max(t.min, Math.round((t.min + (r.clientX - n.left) / n.width * (t.max - t.min)) / t.step) * t.step)), a = [...m.value], d = Math.abs(l - a[0]) < Math.abs(l - a[1]) ? 0 : 1;
27
- a[d] = l, s("update:modelValue", a), s("change", a);
20
+ setup(t, { emit: p }) {
21
+ const e = t, d = p, w = F(), s = v(() => Array.isArray(e.modelValue)), r = v(() => Array.isArray(e.modelValue) ? e.modelValue : [e.modelValue]), h = v(() => Number.isFinite(e.step) && e.step > 0 ? e.step : 1), b = (n) => Math.max(e.min, Math.min(Math.max(e.min, e.max), Number((e.min + Math.round((n - e.min) / h.value) * h.value).toFixed(10)))), c = (n) => Math.max(0, Math.min(100, (n - e.min) / (e.max > e.min ? e.max - e.min : 1) * 100));
22
+ function A(n) {
23
+ if (e.disabled || !s.value) return;
24
+ const i = n.currentTarget.getBoundingClientRect();
25
+ if (!i.width) return;
26
+ const l = b(e.min + (n.clientX - i.left) / i.width * (e.max - e.min)), a = [...r.value], o = Math.abs(l - a[0]) < Math.abs(l - a[1]) ? 0 : 1;
27
+ a[o] = Math.max(o === 1 ? a[0] : e.min, Math.min(o === 0 ? a[1] : e.max, l)), d("update:modelValue", a), d("change", a);
28
28
  }
29
- function v(r, n) {
30
- const l = Number(r.target.value);
31
- if (o.value) {
32
- const a = [...m.value];
33
- return a[n] = Math.max(n === 1 ? a[0] : t.min, Math.min(n === 0 ? a[1] : t.max, l)), a;
29
+ function g(n, i) {
30
+ const l = b(Number(n.target.value));
31
+ if (s.value) {
32
+ const a = [...r.value];
33
+ return a[i] = Math.max(i === 1 ? a[0] : e.min, Math.min(i === 0 ? a[1] : e.max, l)), a;
34
34
  }
35
35
  return l;
36
36
  }
37
- return (r, n) => (i(), u("div", C(B(k), { class: "hys-ui-ex-field" }), [
38
- e.showValue ? (i(), u("span", z, f(e.label || "数值") + ":" + f(m.value.map((l) => e.formatTooltip ? e.formatTooltip(l) : l).join(" ~ ")), 1)) : y("", !0),
37
+ return (n, i) => (u(), m("div", N(B(w), { class: "hys-ui-ex-field" }), [
38
+ t.showValue ? (u(), m("span", R, y(t.label || "数值") + ":" + y(r.value.map((l) => t.formatTooltip ? t.formatTooltip(l) : l).join(" ~ ")), 1)) : x("", !0),
39
39
  T("div", {
40
- class: R({ "hys-ui-slider-range": o.value }),
41
- onPointerdown: N(w, ["self"])
40
+ class: z({ "hys-ui-slider-range": s.value }),
41
+ onPointerdown: S(A, ["self"])
42
42
  }, [
43
- o.value ? (i(), u("div", {
43
+ s.value ? (u(), m("div", {
44
44
  key: 0,
45
45
  class: "hys-ui-slider-selection",
46
- style: b({ left: c(m.value[0]) + "%", width: c(m.value[1]) - c(m.value[0]) + "%" })
47
- }, null, 4)) : y("", !0),
48
- (i(!0), u(g, null, V(m.value, (l, a) => {
49
- var d;
50
- return i(), u("input", {
46
+ style: M({ left: c(r.value[0]) + "%", width: c(r.value[1]) - c(r.value[0]) + "%" })
47
+ }, null, 4)) : x("", !0),
48
+ (u(!0), m(V, null, k(r.value, (l, a) => {
49
+ var o;
50
+ return u(), m("input", {
51
51
  key: a,
52
52
  class: "hys-ui-ex-slider",
53
53
  type: "range",
54
- "aria-label": (e.label || "数值") + (o.value ? a === 0 ? "下限" : "上限" : ""),
55
- min: e.min,
56
- max: e.max,
57
- step: e.step,
54
+ "aria-label": (t.label || "数值") + (s.value ? a === 0 ? "下限" : "上限" : ""),
55
+ min: t.min,
56
+ max: t.max,
57
+ step: h.value,
58
58
  value: l,
59
- disabled: e.disabled,
60
- "aria-valuetext": (d = e.formatTooltip) == null ? void 0 : d.call(e, l),
61
- onInput: (h) => s("update:modelValue", v(h, a)),
62
- onChange: (h) => s("change", v(h, a))
59
+ disabled: t.disabled,
60
+ "aria-valuetext": (o = t.formatTooltip) == null ? void 0 : o.call(t, l),
61
+ onInput: (f) => d("update:modelValue", g(f, a)),
62
+ onChange: (f) => d("change", g(f, a))
63
63
  }, null, 40, E);
64
64
  }), 128))
65
65
  ], 34),
66
- e.marks ? (i(), u("div", H, [
67
- (i(!0), u(g, null, V(e.marks, (l, a) => (i(), u("span", {
66
+ t.marks ? (u(), m("div", H, [
67
+ (u(!0), m(V, null, k(t.marks, (l, a) => (u(), m("span", {
68
68
  key: a,
69
- style: b({ left: (Number(a) - e.min) / (e.max - e.min) * 100 + "%" })
70
- }, f(l), 5))), 128))
71
- ])) : y("", !0)
69
+ style: M({ left: c(Number(a)) + "%" })
70
+ }, y(l), 5))), 128))
71
+ ])) : x("", !0)
72
72
  ], 16));
73
73
  }
74
74
  });
@@ -1,65 +1,71 @@
1
- import { defineComponent as x, ref as E, computed as L, onDeactivated as g, onBeforeUnmount as A, openBlock as b, createElementBlock as M, mergeProps as k, unref as B, createElementVNode as d, renderSlot as v } from "vue";
2
- import { useHysRootAttrs as V } from "../../config.js";
3
- const R = { class: "hys-ui-ent-split-first" }, D = ["tabindex", "aria-orientation", "aria-valuenow", "aria-valuemin", "aria-valuemax"], P = { class: "hys-ui-ent-split-second" }, H = /* @__PURE__ */ x({
1
+ import { defineComponent as g, ref as M, computed as v, watch as z, onDeactivated as B, onBeforeUnmount as P, openBlock as V, createElementBlock as C, mergeProps as D, unref as I, createElementVNode as h, renderSlot as w } from "vue";
2
+ import { useHysRootAttrs as N } from "../../config.js";
3
+ const R = { class: "hys-ui-ent-split-first" }, F = ["tabindex", "aria-disabled", "aria-orientation", "aria-valuenow", "aria-valuemin", "aria-valuemax"], H = { class: "hys-ui-ent-split-second" }, K = /* @__PURE__ */ g({
4
4
  __name: "HysSplitPane",
5
5
  props: {
6
6
  modelValue: { default: 40 },
7
7
  min: { default: 15 },
8
8
  max: { default: 85 },
9
9
  vertical: { type: Boolean, default: !1 },
10
- disabled: { type: Boolean }
10
+ disabled: { type: Boolean },
11
+ step: { default: 2 }
11
12
  },
12
- emits: ["update:modelValue"],
13
- setup(i, { emit: p }) {
14
- const h = V(), t = i, u = p, s = E(), l = L(() => Math.min(t.max, Math.max(t.min, t.modelValue)));
15
- let o = () => {
13
+ emits: ["update:modelValue", "resizeStart", "resizeEnd"],
14
+ setup(l, { emit: E }) {
15
+ const a = l, d = E, x = N(), c = M(), s = v(() => Math.max(0, Math.min(100, Number.isFinite(a.min) ? a.min : 0))), m = v(() => Math.max(s.value, Math.min(100, Number.isFinite(a.max) ? a.max : 100))), p = (e) => Math.max(s.value, Math.min(m.value, Number.isFinite(e) ? e : s.value)), u = v(() => p(a.modelValue));
16
+ let r = () => {
16
17
  };
17
- g(() => o()), A(() => o());
18
- function f(n) {
19
- if (o(), !s.value || t.disabled) return;
20
- const e = n.currentTarget;
21
- e.setPointerCapture(n.pointerId);
22
- const r = s.value.getBoundingClientRect(), c = (m) => {
23
- const w = t.vertical ? (m.clientY - r.top) / r.height * 100 : (m.clientX - r.left) / r.width * 100;
24
- u("update:modelValue", Math.round(Math.max(t.min, Math.min(t.max, w))));
25
- }, a = () => {
26
- e.removeEventListener("pointermove", c), e.removeEventListener("pointerup", a), e.removeEventListener("pointercancel", a), e.removeEventListener("lostpointercapture", a), o = () => {
27
- };
18
+ z(() => [a.disabled, a.vertical, a.min, a.max], () => r()), B(() => r()), P(() => r());
19
+ function L(e) {
20
+ if (r(), !c.value || a.disabled || e.button !== 0) return;
21
+ const t = e.currentTarget, n = c.value.getBoundingClientRect(), f = a.vertical, y = f ? n.height : n.width;
22
+ if (!y) return;
23
+ e.preventDefault(), t.setPointerCapture(e.pointerId), d("resizeStart");
24
+ const b = (o) => {
25
+ if (a.disabled || o.pointerId !== e.pointerId) return;
26
+ const A = (f ? o.clientY - n.top : o.clientX - n.left) / y * 100;
27
+ d("update:modelValue", Math.round(p(A)));
28
+ }, i = () => {
29
+ var o;
30
+ r = () => {
31
+ }, t.removeEventListener("pointermove", b), t.removeEventListener("pointerup", i), t.removeEventListener("pointercancel", i), t.removeEventListener("lostpointercapture", i), (o = t.hasPointerCapture) != null && o.call(t, e.pointerId) && t.releasePointerCapture(e.pointerId), d("resizeEnd", u.value);
28
32
  };
29
- o = a, e.addEventListener("lostpointercapture", a), e.addEventListener("pointermove", c), e.addEventListener("pointerup", a), e.addEventListener("pointercancel", a);
33
+ r = i, t.addEventListener("pointermove", b), t.addEventListener("pointerup", i), t.addEventListener("pointercancel", i), t.addEventListener("lostpointercapture", i);
30
34
  }
31
- function y(n) {
32
- if (t.disabled) return;
33
- const e = n.shiftKey ? 10 : 2;
34
- ["ArrowLeft", "ArrowUp", "ArrowRight", "ArrowDown"].includes(n.key) && (n.preventDefault(), u("update:modelValue", Math.max(t.min, Math.min(t.max, l.value + (["ArrowRight", "ArrowDown"].includes(n.key) ? e : -e)))));
35
+ function k(e) {
36
+ if (a.disabled || !["ArrowLeft", "ArrowUp", "ArrowRight", "ArrowDown", "Home", "End"].includes(e.key)) return;
37
+ e.preventDefault();
38
+ const t = (Number.isFinite(a.step) && a.step > 0 ? a.step : 2) * (e.shiftKey ? 5 : 1), n = e.key === "Home" ? s.value : e.key === "End" ? m.value : u.value + (["ArrowRight", "ArrowDown"].includes(e.key) ? t : -t);
39
+ d("update:modelValue", p(n));
35
40
  }
36
- return (n, e) => (b(), M("div", k(B(h), {
41
+ return (e, t) => (V(), C("div", D(I(x), {
37
42
  ref_key: "host",
38
- ref: s,
39
- class: ["hys-ui-ent-split", { "hys-ui-vertical": i.vertical }],
40
- style: { "--hys-ui-split": l.value + "%" }
43
+ ref: c,
44
+ class: ["hys-ui-ent-split", { "hys-ui-vertical": l.vertical }],
45
+ style: { "--hys-ui-split": u.value + "%" }
41
46
  }), [
42
- d("div", R, [
43
- v(n.$slots, "first")
47
+ h("div", R, [
48
+ w(e.$slots, "first")
44
49
  ]),
45
- d("div", {
50
+ h("div", {
46
51
  class: "hys-ui-ent-split-handle",
47
52
  role: "separator",
48
- tabindex: i.disabled ? -1 : 0,
53
+ tabindex: l.disabled ? -1 : 0,
49
54
  "aria-label": "调整面板比例",
50
- "aria-orientation": i.vertical ? "horizontal" : "vertical",
51
- "aria-valuenow": l.value,
52
- "aria-valuemin": i.min,
53
- "aria-valuemax": i.max,
54
- onPointerdown: f,
55
- onKeydown: y
56
- }, null, 40, D),
57
- d("div", P, [
58
- v(n.$slots, "second")
55
+ "aria-disabled": l.disabled || void 0,
56
+ "aria-orientation": l.vertical ? "horizontal" : "vertical",
57
+ "aria-valuenow": u.value,
58
+ "aria-valuemin": s.value,
59
+ "aria-valuemax": m.value,
60
+ onPointerdown: L,
61
+ onKeydown: k
62
+ }, null, 40, F),
63
+ h("div", H, [
64
+ w(e.$slots, "second")
59
65
  ])
60
66
  ], 16));
61
67
  }
62
68
  });
63
69
  export {
64
- H as default
70
+ K as default
65
71
  };
@@ -1,7 +1,7 @@
1
1
  import o from "./HysSteps2.vue.js";
2
2
  /* empty css */
3
3
  import t from "../../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-111d19b5"]]);
4
+ const s = /* @__PURE__ */ t(o, [["__scopeId", "data-v-1ad8ab01"]]);
5
5
  export {
6
- m as default
6
+ s as default
7
7
  };