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,48 +1,66 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useHysRootAttrs as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as W, useModel as P, ref as k, computed as p, watch as z, onDeactivated as g, onBeforeUnmount as M, openBlock as E, createElementBlock as A, mergeProps as N, unref as B, renderSlot as C, createElementVNode as F, mergeModels as v } from "vue";
|
|
2
|
+
import { useHysRootAttrs as H } from "../../config.js";
|
|
3
|
+
const R = ["tabindex", "aria-disabled", "aria-valuemin", "aria-valuemax", "aria-valuenow"], I = /* @__PURE__ */ W({
|
|
4
4
|
__name: "HysResizablePanel",
|
|
5
|
-
props: /* @__PURE__ */
|
|
5
|
+
props: /* @__PURE__ */ v({
|
|
6
6
|
minWidth: { default: 180 },
|
|
7
7
|
maxWidth: { default: 1200 },
|
|
8
|
-
disabled: { type: Boolean }
|
|
8
|
+
disabled: { type: Boolean },
|
|
9
|
+
step: { default: 10 }
|
|
9
10
|
}, {
|
|
10
11
|
modelValue: { default: 320 },
|
|
11
12
|
modelModifiers: {}
|
|
12
13
|
}),
|
|
13
|
-
emits: ["update:modelValue"],
|
|
14
|
-
setup(
|
|
15
|
-
const s = P(), n =
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
emits: /* @__PURE__ */ v(["resizeStart", "resizeEnd"], ["update:modelValue"]),
|
|
15
|
+
setup(l, { emit: h }) {
|
|
16
|
+
const a = l, c = h, s = P(l, "modelValue"), b = H(), d = k(), n = p(() => Math.max(0, Number.isFinite(a.minWidth) ? a.minWidth : 0)), u = p(() => Math.max(n.value, Number.isFinite(a.maxWidth) ? a.maxWidth : 1200)), m = (e) => Math.max(n.value, Math.min(u.value, Number.isFinite(e) ? e : n.value)), o = p(() => m(s.value));
|
|
17
|
+
let t;
|
|
18
|
+
function r() {
|
|
19
|
+
var i, f;
|
|
20
|
+
const e = t;
|
|
21
|
+
t = void 0, e && ((f = (i = d.value) == null ? void 0 : i.hasPointerCapture) != null && f.call(i, e.pointer) && d.value.releasePointerCapture(e.pointer), c("resizeEnd", o.value));
|
|
18
22
|
}
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
z(() => [a.disabled, a.minWidth, a.maxWidth], r), g(r), M(r);
|
|
24
|
+
function x(e) {
|
|
25
|
+
var i;
|
|
26
|
+
a.disabled || e.button !== 0 || (r(), e.preventDefault(), t = { pointer: e.pointerId, x: e.clientX, initial: o.value }, (i = d.value) == null || i.setPointerCapture(e.pointerId), c("resizeStart"));
|
|
21
27
|
}
|
|
22
|
-
|
|
28
|
+
function y(e) {
|
|
29
|
+
!t || a.disabled || t.pointer !== e.pointerId || (s.value = m(t.initial + e.clientX - t.x));
|
|
30
|
+
}
|
|
31
|
+
function w(e) {
|
|
32
|
+
if (a.disabled || !["ArrowLeft", "ArrowRight", "Home", "End"].includes(e.key)) return;
|
|
33
|
+
e.preventDefault();
|
|
34
|
+
const i = (Number.isFinite(a.step) && a.step > 0 ? a.step : 10) * (e.shiftKey ? 5 : 1);
|
|
35
|
+
s.value = e.key === "Home" ? n.value : e.key === "End" ? u.value : m(o.value + (e.key === "ArrowLeft" ? -i : i));
|
|
36
|
+
}
|
|
37
|
+
return (e, i) => (E(), A("div", N(B(b), {
|
|
23
38
|
class: "hys-ui-ent-resizable",
|
|
24
|
-
style: { width:
|
|
39
|
+
style: { width: o.value + "px", minWidth: n.value + "px", maxWidth: u.value + "px" }
|
|
25
40
|
}), [
|
|
26
|
-
|
|
27
|
-
|
|
41
|
+
C(e.$slots, "default"),
|
|
42
|
+
F("div", {
|
|
43
|
+
ref_key: "edge",
|
|
44
|
+
ref: d,
|
|
28
45
|
class: "hys-ui-ent-resize-edge",
|
|
29
46
|
role: "separator",
|
|
30
|
-
tabindex:
|
|
47
|
+
tabindex: l.disabled ? -1 : 0,
|
|
31
48
|
"aria-label": "调整面板宽度",
|
|
32
49
|
"aria-orientation": "vertical",
|
|
33
|
-
"aria-
|
|
34
|
-
"aria-
|
|
35
|
-
"aria-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
50
|
+
"aria-disabled": l.disabled || void 0,
|
|
51
|
+
"aria-valuemin": n.value,
|
|
52
|
+
"aria-valuemax": u.value,
|
|
53
|
+
"aria-valuenow": o.value,
|
|
54
|
+
onPointerdown: x,
|
|
55
|
+
onPointermove: y,
|
|
56
|
+
onPointerup: r,
|
|
57
|
+
onPointercancel: r,
|
|
58
|
+
onLostpointercapture: r,
|
|
59
|
+
onKeydown: w
|
|
60
|
+
}, null, 40, R)
|
|
43
61
|
], 16));
|
|
44
62
|
}
|
|
45
63
|
});
|
|
46
64
|
export {
|
|
47
|
-
|
|
65
|
+
I as default
|
|
48
66
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./HysRichTextEditor2.vue.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const i = /* @__PURE__ */ t(o, [["__scopeId", "data-v-5fd1d858"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
i as default
|
|
7
7
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useHysRootAttrs as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
const
|
|
1
|
+
import { defineComponent as N, useModel as S, ref as f, watch as M, onActivated as E, onDeactivated as U, onBeforeUnmount as D, onMounted as F, openBlock as k, createElementBlock as h, mergeProps as I, unref as O, Fragment as $, renderList as P, createElementVNode as x, withModifiers as j, toDisplayString as q, createCommentVNode as z, createVNode as C, withCtx as L, createTextVNode as G, mergeModels as w, nextTick as J } from "vue";
|
|
2
|
+
import { useHysRootAttrs as K } from "../../config.js";
|
|
3
|
+
import Q from "../HysModal/HysModal.vue.js";
|
|
4
|
+
import W from "../HysInput/HysInput.vue.js";
|
|
5
|
+
import X from "../HysButton/HysButton.vue.js";
|
|
6
|
+
const Y = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "hys-ui-ent-toolbar",
|
|
9
9
|
role: "toolbar",
|
|
10
10
|
"aria-label": "文本格式"
|
|
11
|
-
},
|
|
11
|
+
}, Z = ["disabled", "onClick"], _ = ["contenteditable", "data-placeholder", "aria-readonly", "aria-disabled"], ae = /* @__PURE__ */ N({
|
|
12
12
|
__name: "HysRichTextEditor",
|
|
13
|
-
props: /* @__PURE__ */
|
|
13
|
+
props: /* @__PURE__ */ w({
|
|
14
14
|
disabled: { type: Boolean },
|
|
15
15
|
readonly: { type: Boolean },
|
|
16
16
|
placeholder: {},
|
|
@@ -19,96 +19,115 @@ const G = {
|
|
|
19
19
|
modelValue: { default: "" },
|
|
20
20
|
modelModifiers: {}
|
|
21
21
|
}),
|
|
22
|
-
emits: /* @__PURE__ */
|
|
23
|
-
setup(
|
|
24
|
-
const
|
|
25
|
-
let
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
22
|
+
emits: /* @__PURE__ */ w(["change", "focus", "blur"], ["update:modelValue"]),
|
|
23
|
+
setup(l, { expose: H, emit: R }) {
|
|
24
|
+
const a = l, c = S(l, "modelValue"), m = R, T = K(), n = f(), d = f(!1), u = f(""), v = f(""), V = [["bold", "粗体"], ["italic", "斜体"], ["insertUnorderedList", "列表"], ["insertOrderedList", "编号"], ["createLink", "链接"], ["undo", "撤销"], ["redo", "重做"]];
|
|
25
|
+
let y = !1, s, i = !0, b = 0;
|
|
26
|
+
function p() {
|
|
27
|
+
b++, d.value = !1, s = void 0;
|
|
28
|
+
}
|
|
29
|
+
M(() => [a.disabled, a.readonly], p), E(() => {
|
|
30
|
+
i = !0;
|
|
31
|
+
}), U(() => {
|
|
32
|
+
i = !1, p();
|
|
33
|
+
}), D(() => {
|
|
34
|
+
i = !1, p();
|
|
35
|
+
}), F(() => {
|
|
36
|
+
n.value && (n.value.innerHTML = c.value);
|
|
37
|
+
}), M(c, (t) => {
|
|
38
|
+
!y && n.value && n.value.innerHTML !== t && (n.value.innerHTML = t), y = !1;
|
|
30
39
|
});
|
|
31
|
-
function
|
|
40
|
+
function g() {
|
|
32
41
|
var t;
|
|
33
|
-
|
|
42
|
+
a.disabled || a.readonly || (y = !0, c.value = ((t = n.value) == null ? void 0 : t.innerHTML) || "", m("change", c.value));
|
|
34
43
|
}
|
|
35
|
-
function
|
|
36
|
-
var
|
|
37
|
-
if (!(i.disabled ||
|
|
44
|
+
function A(t) {
|
|
45
|
+
var o, e;
|
|
46
|
+
if (!(!i || a.disabled || a.readonly)) {
|
|
38
47
|
if (t === "createLink") {
|
|
39
|
-
const
|
|
40
|
-
|
|
48
|
+
const r = window.getSelection();
|
|
49
|
+
s = r != null && r.rangeCount && ((o = n.value) != null && o.contains(r.getRangeAt(0).commonAncestorContainer)) ? r.getRangeAt(0).cloneRange() : void 0, u.value = "", v.value = "", d.value = !0;
|
|
41
50
|
return;
|
|
42
51
|
}
|
|
43
|
-
(
|
|
52
|
+
(e = n.value) == null || e.focus(), document.execCommand(t, !1), g();
|
|
44
53
|
}
|
|
45
54
|
}
|
|
46
|
-
async function
|
|
47
|
-
var
|
|
48
|
-
if (
|
|
49
|
-
|
|
55
|
+
async function B() {
|
|
56
|
+
var o;
|
|
57
|
+
if (!i || a.disabled || a.readonly) return;
|
|
58
|
+
if (!/^https?:\/\//i.test(u.value)) {
|
|
59
|
+
v.value = "请输入 http:// 或 https:// 链接";
|
|
50
60
|
return;
|
|
51
61
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
62
|
+
const t = ++b;
|
|
63
|
+
if (d.value = !1, await J(), !(!i || a.disabled || a.readonly || t !== b || !((o = n.value) != null && o.isConnected))) {
|
|
64
|
+
if (n.value.focus(), s && n.value.contains(s.commonAncestorContainer)) {
|
|
65
|
+
const e = window.getSelection();
|
|
66
|
+
e == null || e.removeAllRanges(), e == null || e.addRange(s);
|
|
67
|
+
} else {
|
|
68
|
+
const e = window.getSelection();
|
|
69
|
+
if (e && !n.value.contains(e.anchorNode)) {
|
|
70
|
+
const r = document.createRange();
|
|
71
|
+
r.selectNodeContents(n.value), r.collapse(!1), e.removeAllRanges(), e.addRange(r);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
document.execCommand("createLink", !1, u.value), g();
|
|
55
75
|
}
|
|
56
|
-
document.execCommand("createLink", !1, r.value), y();
|
|
57
76
|
}
|
|
58
|
-
return
|
|
77
|
+
return H({ focus: () => {
|
|
59
78
|
var t;
|
|
60
|
-
return (t =
|
|
79
|
+
return (t = n.value) == null ? void 0 : t.focus();
|
|
61
80
|
}, blur: () => {
|
|
62
81
|
var t;
|
|
63
|
-
return (t =
|
|
82
|
+
return (t = n.value) == null ? void 0 : t.blur();
|
|
64
83
|
}, getHTML: () => {
|
|
65
84
|
var t;
|
|
66
|
-
return ((t =
|
|
67
|
-
} }), (t,
|
|
68
|
-
|
|
69
|
-
(
|
|
70
|
-
key:
|
|
85
|
+
return ((t = n.value) == null ? void 0 : t.innerHTML) || "";
|
|
86
|
+
} }), (t, o) => (k(), h("div", I(O(T), { class: "hys-ui-ent-panel" }), [
|
|
87
|
+
l.hideToolbar ? z("", !0) : (k(), h("div", Y, [
|
|
88
|
+
(k(), h($, null, P(V, (e) => x("button", {
|
|
89
|
+
key: e[0],
|
|
71
90
|
type: "button",
|
|
72
|
-
disabled:
|
|
73
|
-
onMousedown:
|
|
91
|
+
disabled: l.disabled || l.readonly,
|
|
92
|
+
onMousedown: o[0] || (o[0] = j(() => {
|
|
74
93
|
}, ["prevent"])),
|
|
75
|
-
onClick: (
|
|
76
|
-
},
|
|
94
|
+
onClick: (r) => A(e[0])
|
|
95
|
+
}, q(e[1]), 41, Z)), 64))
|
|
77
96
|
])),
|
|
78
|
-
|
|
97
|
+
x("div", {
|
|
79
98
|
ref_key: "editor",
|
|
80
|
-
ref:
|
|
99
|
+
ref: n,
|
|
81
100
|
class: "hys-ui-ent-editor",
|
|
82
|
-
contenteditable: !
|
|
83
|
-
"data-placeholder":
|
|
101
|
+
contenteditable: !l.disabled && !l.readonly,
|
|
102
|
+
"data-placeholder": l.placeholder,
|
|
84
103
|
role: "textbox",
|
|
85
|
-
"aria-readonly":
|
|
86
|
-
"aria-disabled":
|
|
104
|
+
"aria-readonly": l.readonly,
|
|
105
|
+
"aria-disabled": l.disabled,
|
|
87
106
|
"aria-label": "富文本编辑器",
|
|
88
107
|
"aria-multiline": "true",
|
|
89
|
-
onInput:
|
|
90
|
-
onFocus:
|
|
91
|
-
onBlur:
|
|
92
|
-
}, null, 40,
|
|
93
|
-
|
|
94
|
-
open:
|
|
108
|
+
onInput: g,
|
|
109
|
+
onFocus: o[1] || (o[1] = (e) => m("focus", e)),
|
|
110
|
+
onBlur: o[2] || (o[2] = (e) => m("blur", e))
|
|
111
|
+
}, null, 40, _),
|
|
112
|
+
C(Q, {
|
|
113
|
+
open: d.value,
|
|
95
114
|
title: "插入链接",
|
|
96
|
-
onClose:
|
|
115
|
+
onClose: o[4] || (o[4] = (e) => d.value = !1)
|
|
97
116
|
}, {
|
|
98
|
-
footer:
|
|
99
|
-
|
|
100
|
-
default:
|
|
101
|
-
|
|
117
|
+
footer: L(() => [
|
|
118
|
+
C(X, { onClick: B }, {
|
|
119
|
+
default: L(() => [...o[5] || (o[5] = [
|
|
120
|
+
G("插入", -1)
|
|
102
121
|
])]),
|
|
103
122
|
_: 1
|
|
104
123
|
})
|
|
105
124
|
]),
|
|
106
|
-
default:
|
|
107
|
-
|
|
108
|
-
modelValue:
|
|
109
|
-
"onUpdate:modelValue":
|
|
125
|
+
default: L(() => [
|
|
126
|
+
C(W, {
|
|
127
|
+
modelValue: u.value,
|
|
128
|
+
"onUpdate:modelValue": o[3] || (o[3] = (e) => u.value = e),
|
|
110
129
|
placeholder: "https://example.com",
|
|
111
|
-
error:
|
|
130
|
+
error: v.value
|
|
112
131
|
}, null, 8, ["modelValue", "error"])
|
|
113
132
|
]),
|
|
114
133
|
_: 1
|
|
@@ -117,5 +136,5 @@ const G = {
|
|
|
117
136
|
}
|
|
118
137
|
});
|
|
119
138
|
export {
|
|
120
|
-
|
|
139
|
+
ae as default
|
|
121
140
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as C, ref as v, watch as p, onBeforeUnmount as x, onDeactivated as N, openBlock as s, createElementBlock as V, mergeProps as w, unref as m, createBlock as g, createElementVNode as z, withKeys as L, createVNode as A, createCommentVNode as E } from "vue";
|
|
2
|
+
import { LoaderCircle as F, Search as H, X as K } from "lucide-vue-next";
|
|
3
|
+
import { useHysRootAttrs as R } from "../../config.js";
|
|
4
|
+
const S = ["value", "placeholder", "disabled", "readonly", "aria-label"], M = /* @__PURE__ */ C({
|
|
5
5
|
__name: "HysSearch",
|
|
6
6
|
props: {
|
|
7
7
|
modelValue: {},
|
|
@@ -14,59 +14,70 @@ const E = ["value", "placeholder", "disabled", "readonly", "aria-label"], S = /*
|
|
|
14
14
|
ariaLabel: {}
|
|
15
15
|
},
|
|
16
16
|
emits: ["update:modelValue", "search", "clear", "focus", "blur"],
|
|
17
|
-
setup(
|
|
18
|
-
const
|
|
19
|
-
let
|
|
20
|
-
function
|
|
21
|
-
clearTimeout(
|
|
17
|
+
setup(a, { expose: k, emit: B }) {
|
|
18
|
+
const t = a, i = B, h = R(), r = v(), d = v(!1);
|
|
19
|
+
let y, u;
|
|
20
|
+
function n() {
|
|
21
|
+
clearTimeout(y), y = void 0, u = void 0;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
n.disabled ||
|
|
23
|
+
function c(e) {
|
|
24
|
+
n(), t.disabled || i("search", e);
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
function f(e) {
|
|
27
|
+
t.disabled || t.readonly || d.value || (n(), u = e, i("update:modelValue", e), y = setTimeout(() => c(e), Number.isFinite(t.delay) ? Math.max(0, t.delay) : 300));
|
|
28
|
+
}
|
|
29
|
+
return p(() => [t.disabled, t.readonly], n, { flush: "sync" }), p(() => t.modelValue, (e) => {
|
|
30
|
+
u !== void 0 && e !== u && n();
|
|
31
|
+
}), x(n), N(n), k({ focus: () => {
|
|
32
|
+
var e;
|
|
33
|
+
return (e = r.value) == null ? void 0 : e.focus();
|
|
29
34
|
}, blur: () => {
|
|
30
|
-
var
|
|
31
|
-
return (
|
|
32
|
-
} }), (
|
|
33
|
-
|
|
35
|
+
var e;
|
|
36
|
+
return (e = r.value) == null ? void 0 : e.blur();
|
|
37
|
+
} }), (e, l) => (s(), V("div", w(m(h), { class: "hys-ui-ex-search" }), [
|
|
38
|
+
a.loading ? (s(), g(m(F), {
|
|
34
39
|
key: 0,
|
|
35
40
|
class: "hys-ui-icon-spin",
|
|
36
41
|
size: 16
|
|
37
|
-
})) : (
|
|
42
|
+
})) : (s(), g(m(H), {
|
|
38
43
|
key: 1,
|
|
39
44
|
size: 16,
|
|
40
45
|
"aria-hidden": "true"
|
|
41
46
|
})),
|
|
42
|
-
|
|
47
|
+
z("input", {
|
|
43
48
|
ref_key: "input",
|
|
44
|
-
ref:
|
|
49
|
+
ref: r,
|
|
45
50
|
type: "search",
|
|
46
|
-
value:
|
|
47
|
-
placeholder:
|
|
48
|
-
disabled:
|
|
49
|
-
readonly:
|
|
50
|
-
"aria-label":
|
|
51
|
-
onInput:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
value: a.modelValue,
|
|
52
|
+
placeholder: a.placeholder,
|
|
53
|
+
disabled: a.disabled,
|
|
54
|
+
readonly: a.readonly,
|
|
55
|
+
"aria-label": a.ariaLabel || "搜索",
|
|
56
|
+
onInput: l[0] || (l[0] = (o) => f(o.target.value)),
|
|
57
|
+
onCompositionstart: l[1] || (l[1] = (o) => {
|
|
58
|
+
d.value = !0, n();
|
|
59
|
+
}),
|
|
60
|
+
onCompositionend: l[2] || (l[2] = (o) => {
|
|
61
|
+
d.value = !1, f(o.target.value);
|
|
62
|
+
}),
|
|
63
|
+
onKeydown: l[3] || (l[3] = L((o) => !o.isComposing && o.keyCode !== 229 && !d.value && c(a.modelValue), ["enter"])),
|
|
64
|
+
onFocus: l[4] || (l[4] = (o) => i("focus", o)),
|
|
65
|
+
onBlur: l[5] || (l[5] = (o) => i("blur", o))
|
|
66
|
+
}, null, 40, S),
|
|
67
|
+
a.clearable && a.modelValue && !a.disabled && !a.readonly ? (s(), V("button", {
|
|
57
68
|
key: 2,
|
|
58
69
|
type: "button",
|
|
59
70
|
"aria-label": "清空搜索",
|
|
60
|
-
onClick:
|
|
61
|
-
var
|
|
62
|
-
|
|
71
|
+
onClick: l[6] || (l[6] = (o) => {
|
|
72
|
+
var b;
|
|
73
|
+
f(""), i("clear"), (b = r.value) == null || b.focus();
|
|
63
74
|
})
|
|
64
75
|
}, [
|
|
65
|
-
|
|
66
|
-
])) :
|
|
76
|
+
A(m(K), { size: 14 })
|
|
77
|
+
])) : E("", !0)
|
|
67
78
|
], 16));
|
|
68
79
|
}
|
|
69
80
|
});
|
|
70
81
|
export {
|
|
71
|
-
|
|
82
|
+
M as default
|
|
72
83
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useHysRootAttrs as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as x, ref as V, computed as y, openBlock as n, createElementBlock as r, mergeProps as A, unref as p, Fragment as L, renderList as w, normalizeStyle as z, normalizeClass as S, renderSlot as B, createTextVNode as C, toDisplayString as H } from "vue";
|
|
2
|
+
import { useHysRootAttrs as E } from "../../config.js";
|
|
3
|
+
const R = ["aria-label"], D = ["data-value", "disabled", "aria-checked", "tabindex", "onClick"], F = /* @__PURE__ */ x({
|
|
4
4
|
__name: "HysSegmented",
|
|
5
5
|
props: {
|
|
6
6
|
modelValue: {},
|
|
@@ -11,50 +11,55 @@ const H = ["aria-label"], E = ["data-value", "disabled", "aria-checked", "tabind
|
|
|
11
11
|
ariaLabel: {}
|
|
12
12
|
},
|
|
13
13
|
emits: ["update:modelValue", "change"],
|
|
14
|
-
setup(
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
setup(t, { emit: v }) {
|
|
15
|
+
const g = E(), d = t, s = v, u = V(), c = y(() => d.options.filter((e) => !d.disabled && !e.disabled)), h = y(() => {
|
|
16
|
+
var e, a;
|
|
17
|
+
return ((e = c.value.find((l) => l.value === d.modelValue)) == null ? void 0 : e.value) ?? ((a = c.value[0]) == null ? void 0 : a.value);
|
|
18
|
+
});
|
|
19
|
+
function f(e) {
|
|
20
|
+
var l;
|
|
21
|
+
if (d.disabled || (l = d.options.find((o) => o.value === e)) != null && l.disabled) return;
|
|
22
|
+
const a = e !== d.modelValue;
|
|
23
|
+
s("update:modelValue", e), a && s("change", e);
|
|
19
24
|
}
|
|
20
|
-
function k(
|
|
21
|
-
var m,
|
|
22
|
-
if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(
|
|
23
|
-
const
|
|
24
|
-
if (!
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
25
|
+
function k(e) {
|
|
26
|
+
var m, b;
|
|
27
|
+
if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(e.key) || d.disabled) return;
|
|
28
|
+
const a = d.options.filter((i) => !i.disabled);
|
|
29
|
+
if (!a.length) return;
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
const l = a.findIndex((i) => i.value === d.modelValue), o = a[e.key === "Home" ? 0 : e.key === "End" ? a.length - 1 : l < 0 ? e.key === "ArrowLeft" ? a.length - 1 : 0 : (l + (e.key === "ArrowLeft" ? -1 : 1) + a.length) % a.length];
|
|
32
|
+
f(o.value), (b = Array.from(((m = u.value) == null ? void 0 : m.querySelectorAll("button")) || []).find((i) => i.dataset.value === o.value)) == null || b.focus();
|
|
28
33
|
}
|
|
29
|
-
return (
|
|
34
|
+
return (e, a) => (n(), r("div", A({
|
|
30
35
|
ref_key: "root",
|
|
31
36
|
ref: u
|
|
32
|
-
},
|
|
37
|
+
}, p(g), {
|
|
33
38
|
class: "hys-ui-ex-segment",
|
|
34
39
|
role: "radiogroup",
|
|
35
|
-
"aria-label":
|
|
36
|
-
style: { display:
|
|
40
|
+
"aria-label": t.ariaLabel || "分段选择",
|
|
41
|
+
style: { display: t.block ? "flex" : void 0 },
|
|
37
42
|
onKeydown: k
|
|
38
43
|
}), [
|
|
39
|
-
(n(!0), r(
|
|
40
|
-
key:
|
|
41
|
-
"data-value":
|
|
44
|
+
(n(!0), r(L, null, w(t.options, (l) => (n(), r("button", {
|
|
45
|
+
key: l.value,
|
|
46
|
+
"data-value": l.value,
|
|
42
47
|
type: "button",
|
|
43
48
|
role: "radio",
|
|
44
|
-
disabled:
|
|
45
|
-
"aria-checked":
|
|
46
|
-
tabindex:
|
|
47
|
-
class:
|
|
48
|
-
style: z({ flex:
|
|
49
|
-
onClick: (
|
|
49
|
+
disabled: t.disabled || l.disabled,
|
|
50
|
+
"aria-checked": t.modelValue === l.value,
|
|
51
|
+
tabindex: h.value === l.value ? 0 : -1,
|
|
52
|
+
class: S({ "hys-ui-active": t.modelValue === l.value }),
|
|
53
|
+
style: z({ flex: t.block ? 1 : void 0, padding: t.size === "sm" ? "5px 10px" : t.size === "lg" ? "12px 20px" : void 0 }),
|
|
54
|
+
onClick: (o) => f(l.value)
|
|
50
55
|
}, [
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
B(e.$slots, "label", { option: l }, () => [
|
|
57
|
+
C(H(l.label), 1)
|
|
53
58
|
])
|
|
54
|
-
], 14,
|
|
55
|
-
], 16,
|
|
59
|
+
], 14, D))), 128))
|
|
60
|
+
], 16, R));
|
|
56
61
|
}
|
|
57
62
|
});
|
|
58
63
|
export {
|
|
59
|
-
|
|
64
|
+
F as default
|
|
60
65
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./HysSelect2.vue.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const c = /* @__PURE__ */ t(o, [["__scopeId", "data-v-eb19a68c"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
c as default
|
|
7
7
|
};
|