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.
- package/CHANGELOG.md +26 -1
- package/README.md +16 -6
- package/dist/components/HysAlert/HysAlert.vue.js +14 -14
- package/dist/components/HysAnimatedNumber/HysAnimatedNumber.vue.js +23 -20
- package/dist/components/HysBadge/HysBadge.vue.js +1 -1
- package/dist/components/HysBadge/HysBadge2.vue.js +20 -19
- package/dist/components/HysCalendar/HysCalendar.vue.js +48 -40
- package/dist/components/HysCard/HysCard.vue.js +2 -2
- package/dist/components/HysCard/HysCard2.vue.js +9 -9
- package/dist/components/HysCascader/HysCascader.vue.js +88 -76
- package/dist/components/HysCheckbox/HysCheckbox.vue.js +5 -39
- package/dist/components/HysCheckbox/HysCheckbox2.vue.js +85 -2
- package/dist/components/HysCommandPalette/HysCommandPalette.vue.js +52 -51
- package/dist/components/HysCommentEditor/HysCommentEditor.vue.js +17 -17
- package/dist/components/HysDataGrid/HysDataGrid2.vue.js +22 -22
- package/dist/components/HysDrawer/HysDrawer.vue.js +1 -1
- package/dist/components/HysDrawer/HysDrawer2.vue.js +55 -54
- package/dist/components/HysFileManager/HysFileManager.vue.js +5 -63
- package/dist/components/HysFileManager/HysFileManager2.vue.js +85 -2
- package/dist/components/HysForm/HysForm.vue.js +2 -2
- package/dist/components/HysForm/HysForm2.vue.js +66 -64
- package/dist/components/HysFormItem/HysFormItem.vue.js +53 -37
- package/dist/components/HysGantt/HysGantt.vue.js +5 -264
- package/dist/components/HysGantt/HysGantt2.vue.js +302 -2
- package/dist/components/HysInput/HysInput.vue.js +1 -1
- package/dist/components/HysInput/HysInput2.vue.js +42 -41
- package/dist/components/HysModal/HysModal.vue.js +2 -2
- package/dist/components/HysModal/HysModal2.vue.js +35 -35
- package/dist/components/HysNotificationCenter/HysNotificationCenter.vue.js +37 -36
- package/dist/components/HysNumberInput/HysNumberInput.vue.js +2 -2
- package/dist/components/HysNumberInput/HysNumberInput2.vue.js +49 -40
- package/dist/components/HysOrgTree/HysOrgTree.vue.js +34 -32
- package/dist/components/HysPagination/HysPagination.vue.js +2 -2
- package/dist/components/HysPagination/HysPagination2.vue.js +91 -91
- package/dist/components/HysPermissionMatrix/HysPermissionMatrix.vue.js +5 -41
- package/dist/components/HysPermissionMatrix/HysPermissionMatrix2.vue.js +100 -2
- package/dist/components/HysRadioGroup/HysRadioGroup.vue.js +5 -40
- package/dist/components/HysRadioGroup/HysRadioGroup2.vue.js +80 -2
- package/dist/components/HysResizablePanel/HysResizablePanel.vue.js +46 -28
- package/dist/components/HysRichTextEditor/HysRichTextEditor.vue.js +2 -2
- package/dist/components/HysRichTextEditor/HysRichTextEditor2.vue.js +86 -67
- package/dist/components/HysSearch/HysSearch.vue.js +49 -38
- package/dist/components/HysSegmented/HysSegmented.vue.js +39 -34
- package/dist/components/HysSelect/HysSelect.vue.js +2 -2
- package/dist/components/HysSelect/HysSelect2.vue.js +130 -109
- package/dist/components/HysSlider/HysSlider.vue.js +2 -2
- package/dist/components/HysSlider/HysSlider2.vue.js +40 -40
- package/dist/components/HysSplitPane/HysSplitPane.vue.js +48 -42
- package/dist/components/HysSteps/HysSteps.vue.js +2 -2
- package/dist/components/HysSteps/HysSteps2.vue.js +15 -14
- package/dist/components/HysSwitch/HysSwitch.vue.js +2 -2
- package/dist/components/HysSwitch/HysSwitch2.vue.js +38 -27
- package/dist/components/HysTable/HysTable.vue.js +2 -2
- package/dist/components/HysTable/HysTable2.vue.js +42 -38
- package/dist/components/HysTabs/HysTabs.vue.js +1 -1
- package/dist/components/HysTabs/HysTabs2.vue.js +8 -6
- package/dist/components/HysTextarea/HysTextarea.vue.js +58 -48
- package/dist/components/HysToast/HysToast.vue.js +2 -2
- package/dist/components/HysToast/HysToast2.vue.js +121 -38
- package/dist/components/HysTour/HysTour.vue.js +47 -42
- package/dist/components/HysTransfer/HysTransfer.vue.js +159 -143
- package/dist/components/HysTree/HysTree.vue.js +2 -2
- package/dist/components/HysTree/HysTree2.vue.js +62 -61
- package/dist/components/HysTreeSelect/HysTreeSelect.vue.js +64 -57
- package/dist/components/HysUpload/HysUpload.vue.js +2 -2
- package/dist/components/HysUpload/HysUpload2.vue.js +95 -77
- package/dist/composables/formContext.js +9 -3
- package/dist/composables/toastEscape.js +16 -0
- package/dist/composables/useDialog.js +16 -16
- package/dist/composables/useFloating.js +40 -40
- package/dist/composables/useHysToast.js +148 -0
- package/dist/config.js +18 -15
- package/dist/index.js +10 -7
- package/dist/style.css +1 -1
- package/dist/types/components/HysCalendar/HysCalendar.vue.d.ts +2 -0
- package/dist/types/components/HysCard/HysCard.vue.d.ts +5 -1
- package/dist/types/components/HysCheckbox/HysCheckbox.vue.d.ts +21 -4
- package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +1 -0
- package/dist/types/components/HysFileManager/HysFileManager.vue.d.ts +6 -2
- package/dist/types/components/HysGantt/HysGantt.vue.d.ts +6 -0
- package/dist/types/components/HysNumberInput/HysNumberInput.vue.d.ts +2 -0
- package/dist/types/components/HysOrgTree/HysOrgTree.vue.d.ts +3 -1
- package/dist/types/components/HysPermissionMatrix/HysPermissionMatrix.vue.d.ts +8 -1
- package/dist/types/components/HysRadioGroup/HysRadioGroup.vue.d.ts +40 -17
- package/dist/types/components/HysResizablePanel/HysResizablePanel.vue.d.ts +6 -0
- package/dist/types/components/HysSelect/HysSelect.vue.d.ts +7 -1
- package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +6 -0
- package/dist/types/components/HysSteps/HysSteps.vue.d.ts +1 -0
- package/dist/types/components/HysSwitch/HysSwitch.vue.d.ts +1 -1
- package/dist/types/components/HysTextarea/HysTextarea.vue.d.ts +1 -1
- package/dist/types/components/HysToast/HysToast.vue.d.ts +55 -7
- package/dist/types/components/HysTour/HysTour.vue.d.ts +3 -1
- package/dist/types/components/HysTransfer/HysTransfer.vue.d.ts +11 -1
- package/dist/types/composables/formContext.d.ts +5 -0
- package/dist/types/composables/toastEscape.d.ts +1 -0
- package/dist/types/composables/useFloating.d.ts +1 -1
- package/dist/types/composables/useHysToast.d.ts +50 -0
- package/dist/types/index.d.ts +5 -0
- package/package.json +46 -11
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ChevronDown as
|
|
3
|
-
import { useHysRootAttrs as
|
|
4
|
-
import { useFloating as
|
|
5
|
-
const
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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(
|
|
26
|
-
const r =
|
|
27
|
-
V(() => r.modelValue, (e) =>
|
|
28
|
-
e && (
|
|
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 &&
|
|
30
|
+
e && h();
|
|
31
31
|
});
|
|
32
|
-
const
|
|
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
|
|
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
|
|
44
|
-
|
|
43
|
+
function x(e) {
|
|
44
|
+
A("update:modelValue", e), A("change", e);
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function z(e, l) {
|
|
47
47
|
var t, o;
|
|
48
|
-
e.disabled || r.disabled || (
|
|
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 _ =
|
|
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
|
-
}),
|
|
57
|
+
}), O = S(() => {
|
|
58
58
|
const e = [];
|
|
59
59
|
function l(t, o = [], a = [], c = !1) {
|
|
60
|
-
var
|
|
61
|
-
for (const
|
|
62
|
-
const
|
|
63
|
-
!
|
|
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,
|
|
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(),
|
|
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
|
|
78
|
-
(
|
|
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
|
|
82
|
-
(
|
|
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) => (
|
|
86
|
-
|
|
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:
|
|
99
|
+
ref: $,
|
|
89
100
|
class: "hys-ui-v4-control hys-ui-pf-select-trigger",
|
|
90
101
|
type: "button",
|
|
91
|
-
disabled:
|
|
92
|
-
"aria-expanded": i(
|
|
102
|
+
disabled: p.disabled,
|
|
103
|
+
"aria-expanded": i(w),
|
|
93
104
|
"aria-haspopup": "dialog",
|
|
94
|
-
onClick: l[0] || (l[0] = (t) => i(
|
|
105
|
+
onClick: l[0] || (l[0] = (t) => i(w) ? i(h)() : R()),
|
|
106
|
+
onKeydown: I(W(R, ["prevent"]), ["down"])
|
|
95
107
|
}, [
|
|
96
|
-
|
|
97
|
-
|
|
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
|
-
],
|
|
102
|
-
(
|
|
103
|
-
i(
|
|
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:
|
|
107
|
-
}, i(
|
|
118
|
+
ref: v
|
|
119
|
+
}, i(N), {
|
|
108
120
|
class: "hys-ui-v4-menu hys-ui-pf-select-menu",
|
|
109
|
-
style: i(
|
|
121
|
+
style: i(H),
|
|
110
122
|
role: "dialog",
|
|
111
123
|
"aria-label": "级联选择",
|
|
112
124
|
onKeydown: F
|
|
113
125
|
}), [
|
|
114
|
-
|
|
126
|
+
p.filterable ? Q((s(), n("input", {
|
|
115
127
|
key: 0,
|
|
116
|
-
"onUpdate:modelValue": l[1] || (l[1] = (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
|
-
[
|
|
122
|
-
]) :
|
|
123
|
-
|
|
124
|
-
(
|
|
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
|
-
|
|
141
|
+
x(t.path), i(h)(!0);
|
|
130
142
|
}
|
|
131
|
-
},
|
|
132
|
-
|
|
133
|
-
])) : (
|
|
134
|
-
(
|
|
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
|
-
(
|
|
152
|
+
(s(!0), n(q, null, E(t, (a) => {
|
|
141
153
|
var c;
|
|
142
|
-
return
|
|
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":
|
|
148
|
-
onClick: (
|
|
159
|
+
"aria-current": y.value[o] === a.value ? "true" : void 0,
|
|
160
|
+
onClick: (f) => z(a, o)
|
|
149
161
|
}, [
|
|
150
|
-
|
|
151
|
-
|
|
162
|
+
Y(e.$slots, "option", { node: a }, () => [
|
|
163
|
+
Z(L(a.label), 1)
|
|
152
164
|
]),
|
|
153
|
-
(c = a.children) != null && c.length ? (
|
|
165
|
+
(c = a.children) != null && c.length ? (s(), B(i(te), {
|
|
154
166
|
key: 0,
|
|
155
167
|
size: 15
|
|
156
|
-
})) :
|
|
168
|
+
})) : y.value[o] === a.value ? (s(), B(i(oe), {
|
|
157
169
|
key: 1,
|
|
158
170
|
size: 15
|
|
159
|
-
})) :
|
|
160
|
-
], 8,
|
|
171
|
+
})) : g("", !0)
|
|
172
|
+
], 8, ye);
|
|
161
173
|
}), 128))
|
|
162
|
-
], 8,
|
|
174
|
+
], 8, de))), 128))
|
|
163
175
|
])),
|
|
164
|
-
|
|
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
|
-
|
|
181
|
+
x([]), A("clear"), i(h)(!0);
|
|
170
182
|
})
|
|
171
|
-
}, "清空选择")) :
|
|
172
|
-
|
|
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(
|
|
187
|
+
onClick: l[3] || (l[3] = (t) => i(h)(!0))
|
|
176
188
|
}, "关闭")
|
|
177
|
-
], 16)) :
|
|
189
|
+
], 16)) : g("", !0)
|
|
178
190
|
]))
|
|
179
191
|
], 16));
|
|
180
192
|
}
|
|
181
193
|
});
|
|
182
194
|
export {
|
|
183
|
-
|
|
195
|
+
be as default
|
|
184
196
|
};
|
|
@@ -1,41 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
6
|
+
s as default
|
|
41
7
|
};
|
|
@@ -1,4 +1,87 @@
|
|
|
1
|
-
import
|
|
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
|
-
|
|
86
|
+
w as default
|
|
4
87
|
};
|
|
@@ -1,104 +1,105 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useHysRootAttrs as
|
|
3
|
-
import { Command as
|
|
4
|
-
import { useDialog as
|
|
5
|
-
const
|
|
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(
|
|
16
|
-
const f =
|
|
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
|
-
|
|
15
|
+
s.value = !0, u.value = "", t.value = 0, W(() => {
|
|
19
16
|
var e;
|
|
20
|
-
return (e =
|
|
17
|
+
return (e = k.value) == null ? void 0 : e.focus();
|
|
21
18
|
});
|
|
22
19
|
}
|
|
23
|
-
function
|
|
24
|
-
|
|
20
|
+
function d() {
|
|
21
|
+
s.value = !1;
|
|
25
22
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
23
|
+
function g(e) {
|
|
24
|
+
P("select", e), d();
|
|
28
25
|
}
|
|
29
|
-
function
|
|
30
|
-
e.defaultPrevented || (e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "k" && (e.preventDefault(),
|
|
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
|
|
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] &&
|
|
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
|
|
36
|
-
a("button",
|
|
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:
|
|
35
|
+
ref: A,
|
|
39
36
|
type: "button",
|
|
40
37
|
class: "hys-ui-v4-control",
|
|
41
38
|
onClick: w
|
|
42
39
|
}), [
|
|
43
|
-
|
|
40
|
+
q(i(Y), {
|
|
44
41
|
size: 14,
|
|
45
42
|
"aria-hidden": "true"
|
|
46
43
|
}),
|
|
47
|
-
|
|
44
|
+
p[1] || (p[1] = _(" / Ctrl + K · 快捷命令", -1))
|
|
48
45
|
], 16),
|
|
49
|
-
(r(),
|
|
50
|
-
|
|
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:
|
|
49
|
+
onPointerdown: j(d, ["self"])
|
|
53
50
|
}), [
|
|
54
51
|
a("section", {
|
|
55
52
|
ref_key: "dialog",
|
|
56
|
-
ref:
|
|
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
|
-
|
|
60
|
+
G(a("input", {
|
|
64
61
|
ref_key: "input",
|
|
65
|
-
ref:
|
|
66
|
-
"onUpdate:modelValue":
|
|
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":
|
|
67
|
+
"aria-controls": i(y),
|
|
71
68
|
"aria-expanded": !0,
|
|
72
|
-
onKeydown:
|
|
73
|
-
}, null,
|
|
74
|
-
[
|
|
69
|
+
onKeydown: V
|
|
70
|
+
}, null, 40, ee), [
|
|
71
|
+
[J, u.value]
|
|
75
72
|
]),
|
|
76
|
-
a("div",
|
|
77
|
-
|
|
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:
|
|
81
|
+
class: Q(["hys-ui-v4-option", { "hys-ui-v4-active": m === t.value }]),
|
|
81
82
|
role: "option",
|
|
82
|
-
"aria-selected":
|
|
83
|
-
onPointerenter: (
|
|
84
|
-
onClick: (
|
|
83
|
+
"aria-selected": m === t.value,
|
|
84
|
+
onPointerenter: (N) => t.value = m,
|
|
85
|
+
onClick: (N) => g(n.id)
|
|
85
86
|
}, [
|
|
86
|
-
|
|
87
|
-
a("small", null,
|
|
88
|
-
], 42,
|
|
89
|
-
o.value.length ?
|
|
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:
|
|
95
|
+
onClick: d
|
|
95
96
|
}, "关闭 Esc")
|
|
96
97
|
], 512)
|
|
97
|
-
], 16)) :
|
|
98
|
+
], 16)) : D("", !0)
|
|
98
99
|
]))
|
|
99
100
|
], 64));
|
|
100
101
|
}
|
|
101
102
|
});
|
|
102
103
|
export {
|
|
103
|
-
|
|
104
|
+
se as default
|
|
104
105
|
};
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useHysRootAttrs as
|
|
3
|
-
const x = ["onClick"],
|
|
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 =
|
|
11
|
-
function
|
|
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 (
|
|
15
|
-
(
|
|
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,
|
|
20
|
-
n("small", null,
|
|
21
|
-
n("p", null,
|
|
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
|
-
|
|
28
|
-
"onUpdate:modelValue":
|
|
27
|
+
C(n("textarea", {
|
|
28
|
+
"onUpdate:modelValue": o[0] || (o[0] = (e) => t.value = e),
|
|
29
29
|
placeholder: "输入评论,Ctrl+Enter 发送",
|
|
30
|
-
onKeydown: b(k(
|
|
31
|
-
}, null,
|
|
32
|
-
[
|
|
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:
|
|
38
|
-
}, "发送评论", 8,
|
|
37
|
+
onClick: m
|
|
38
|
+
}, "发送评论", 8, w)
|
|
39
39
|
], 16));
|
|
40
40
|
}
|
|
41
41
|
});
|