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