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 { LoaderCircle as
|
|
3
|
-
import { useHysRootAttrs as
|
|
4
|
-
import { useFloating as
|
|
5
|
-
const
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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(
|
|
29
|
-
const t =
|
|
30
|
-
|
|
31
|
-
|
|
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
|
|
35
|
-
!
|
|
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
|
|
46
|
+
function O() {
|
|
38
47
|
var e;
|
|
39
|
-
t.disabled || (
|
|
48
|
+
t.disabled || ($(x.value ? [] : ""), k("clear"), (e = g.value) == null || e.focus());
|
|
40
49
|
}
|
|
41
|
-
async function
|
|
42
|
-
var
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
|
52
|
-
var
|
|
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
|
|
58
|
-
let
|
|
59
|
-
for (let U = 0; U <
|
|
60
|
-
if (
|
|
61
|
-
|
|
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
|
|
66
|
-
} else e.key === "Enter" || e.key === " " && !t.filterable ? (e.preventDefault(), v.value ? S(
|
|
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
|
|
69
|
-
|
|
70
|
-
}),
|
|
71
|
-
e &&
|
|
72
|
-
}
|
|
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 =
|
|
88
|
+
return (e = g.value) == null ? void 0 : e.focus();
|
|
75
89
|
}, blur: () => {
|
|
76
90
|
var e;
|
|
77
|
-
return (e =
|
|
78
|
-
}, close: () =>
|
|
79
|
-
class: ["hys-ui-select-wrap", "hys-ui-select-" +
|
|
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
|
-
|
|
95
|
+
L("button", {
|
|
82
96
|
ref_key: "trigger",
|
|
83
|
-
ref:
|
|
97
|
+
ref: g,
|
|
84
98
|
type: "button",
|
|
85
99
|
class: "hys-ui-select",
|
|
86
|
-
"aria-label":
|
|
87
|
-
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) + "-" +
|
|
93
|
-
onClick:
|
|
94
|
-
onKeydown:
|
|
106
|
+
"aria-activedescendant": i(v) ? i(f) + "-" + o.value : void 0,
|
|
107
|
+
onClick: M,
|
|
108
|
+
onKeydown: W
|
|
95
109
|
}, [
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
var
|
|
110
|
+
L("span", ce, [
|
|
111
|
+
C(e.$slots, "label", { selected: w.value }, () => {
|
|
112
|
+
var l, c;
|
|
99
113
|
return [
|
|
100
|
-
|
|
101
|
-
key:
|
|
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
|
-
},
|
|
104
|
-
|
|
105
|
-
|
|
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
|
-
|
|
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(
|
|
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,
|
|
120
|
-
|
|
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
|
|
141
|
+
onClick: Z(O, ["stop"])
|
|
126
142
|
}, [
|
|
127
|
-
|
|
128
|
-
])) :
|
|
129
|
-
(s(), E(
|
|
130
|
-
i(v) ? (s(),
|
|
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:
|
|
134
|
-
}, i(
|
|
149
|
+
ref: B
|
|
150
|
+
}, i(N), {
|
|
135
151
|
class: "hys-ui-select-options hys-ui-floating-surface",
|
|
136
|
-
style: i(
|
|
137
|
-
onKeydown:
|
|
152
|
+
style: i(j),
|
|
153
|
+
onKeydown: W
|
|
138
154
|
}), [
|
|
139
|
-
|
|
155
|
+
d.filterable ? le((s(), n("input", {
|
|
140
156
|
key: 0,
|
|
141
157
|
ref_key: "searchInput",
|
|
142
|
-
ref:
|
|
143
|
-
"onUpdate:modelValue":
|
|
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) + "-" +
|
|
149
|
-
}, null, 8,
|
|
150
|
-
[
|
|
151
|
-
]) :
|
|
152
|
-
|
|
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":
|
|
171
|
+
"aria-multiselectable": x.value || void 0
|
|
156
172
|
}, [
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
173
|
+
d.loading ? (s(), n("p", he, [
|
|
174
|
+
C(e.$slots, "loading", {}, () => [
|
|
175
|
+
a[1] || (a[1] = H("加载中…", -1))
|
|
160
176
|
], !0)
|
|
161
|
-
])) : (s(),
|
|
162
|
-
(s(!0),
|
|
163
|
-
id: i(f) + "-" +
|
|
164
|
-
key:
|
|
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:
|
|
168
|
-
"data-active":
|
|
169
|
-
"aria-selected":
|
|
170
|
-
disabled:
|
|
171
|
-
onPointerenter: (
|
|
172
|
-
onClick: (
|
|
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
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
},
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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
|
-
})) :
|
|
185
|
-
], 42,
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
z(
|
|
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,
|
|
193
|
-
|
|
194
|
-
], 16)) :
|
|
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
|
-
|
|
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
|
|
4
|
+
const p = /* @__PURE__ */ r(o, [["__scopeId", "data-v-a22942a0"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
p as default
|
|
7
7
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useHysRootAttrs as
|
|
3
|
-
const
|
|
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__ */
|
|
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(
|
|
21
|
-
const
|
|
22
|
-
function
|
|
23
|
-
if (
|
|
24
|
-
const
|
|
25
|
-
if (!
|
|
26
|
-
const l =
|
|
27
|
-
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
|
|
30
|
-
const l = Number(
|
|
31
|
-
if (
|
|
32
|
-
const a = [...
|
|
33
|
-
return 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 (
|
|
38
|
-
|
|
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:
|
|
41
|
-
onPointerdown:
|
|
40
|
+
class: z({ "hys-ui-slider-range": s.value }),
|
|
41
|
+
onPointerdown: S(A, ["self"])
|
|
42
42
|
}, [
|
|
43
|
-
|
|
43
|
+
s.value ? (u(), m("div", {
|
|
44
44
|
key: 0,
|
|
45
45
|
class: "hys-ui-slider-selection",
|
|
46
|
-
style:
|
|
47
|
-
}, null, 4)) :
|
|
48
|
-
(
|
|
49
|
-
var
|
|
50
|
-
return
|
|
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": (
|
|
55
|
-
min:
|
|
56
|
-
max:
|
|
57
|
-
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:
|
|
60
|
-
"aria-valuetext": (
|
|
61
|
-
onInput: (
|
|
62
|
-
onChange: (
|
|
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
|
-
|
|
67
|
-
(
|
|
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:
|
|
70
|
-
},
|
|
71
|
-
])) :
|
|
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
|
|
2
|
-
import { useHysRootAttrs as
|
|
3
|
-
const R = { class: "hys-ui-ent-split-first" },
|
|
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(
|
|
14
|
-
const
|
|
15
|
-
let
|
|
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
|
-
|
|
18
|
-
function
|
|
19
|
-
if (
|
|
20
|
-
const e = n.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
33
|
+
r = i, t.addEventListener("pointermove", b), t.addEventListener("pointerup", i), t.addEventListener("pointercancel", i), t.addEventListener("lostpointercapture", i);
|
|
30
34
|
}
|
|
31
|
-
function
|
|
32
|
-
if (
|
|
33
|
-
|
|
34
|
-
|
|
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 (
|
|
41
|
+
return (e, t) => (V(), C("div", D(I(x), {
|
|
37
42
|
ref_key: "host",
|
|
38
|
-
ref:
|
|
39
|
-
class: ["hys-ui-ent-split", { "hys-ui-vertical":
|
|
40
|
-
style: { "--hys-ui-split":
|
|
43
|
+
ref: c,
|
|
44
|
+
class: ["hys-ui-ent-split", { "hys-ui-vertical": l.vertical }],
|
|
45
|
+
style: { "--hys-ui-split": u.value + "%" }
|
|
41
46
|
}), [
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
h("div", R, [
|
|
48
|
+
w(e.$slots, "first")
|
|
44
49
|
]),
|
|
45
|
-
|
|
50
|
+
h("div", {
|
|
46
51
|
class: "hys-ui-ent-split-handle",
|
|
47
52
|
role: "separator",
|
|
48
|
-
tabindex:
|
|
53
|
+
tabindex: l.disabled ? -1 : 0,
|
|
49
54
|
"aria-label": "调整面板比例",
|
|
50
|
-
"aria-
|
|
51
|
-
"aria-
|
|
52
|
-
"aria-
|
|
53
|
-
"aria-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
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
|
|
4
|
+
const s = /* @__PURE__ */ t(o, [["__scopeId", "data-v-1ad8ab01"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
s as default
|
|
7
7
|
};
|