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,57 +1,140 @@
1
- import { defineComponent as v, ref as h, watch as g, onBeforeUnmount as C, onDeactivated as b, onActivated as k, openBlock as n, createBlock as c, Teleport as T, createVNode as m, Transition as B, withCtx as x, createElementBlock as d, mergeProps as A, unref as o, createElementVNode as N, resolveDynamicComponent as V, createTextVNode as D, toDisplayString as w, createCommentVNode as f } from "vue";
2
- import { useHysRootAttrs as z } from "../../config.js";
3
- import { CircleAlert as E, Info as H, CircleCheck as M, X as R } from "lucide-vue-next";
4
- const I = ["role"], j = /* @__PURE__ */ v({
1
+ import { defineComponent as X, useAttrs as j, useSlots as q, ref as d, computed as h, watch as N, onDeactivated as G, onActivated as J, nextTick as K, onBeforeUnmount as Q, openBlock as i, createBlock as H, Teleport as Y, createVNode as O, Transition as Z, withCtx as _, createElementBlock as m, mergeProps as ee, unref as x, renderSlot as A, resolveDynamicComponent as te, normalizeClass as ae, createCommentVNode as v, createElementVNode as oe, createTextVNode as se, toDisplayString as V } from "vue";
2
+ import { LoaderCircle as le, TriangleAlert as ne, Info as ie, CircleAlert as ue, CircleCheck as re, X as fe } from "lucide-vue-next";
3
+ import { useHysRootAttrs as ce } from "../../config.js";
4
+ import { registerToastEscape as de } from "../../composables/toastEscape.js";
5
+ const me = ["role", "aria-live"], ve = {
6
+ key: 0,
7
+ class: "hys-ui-toast-icon",
8
+ "aria-hidden": "true"
9
+ }, ye = { class: "hys-ui-toast-message" }, pe = ["aria-label"], he = {
10
+ key: 2,
11
+ class: "hys-ui-toast-action"
12
+ }, ke = /* @__PURE__ */ X({
13
+ inheritAttrs: !1,
5
14
  __name: "HysToast",
6
15
  props: {
7
- message: {},
16
+ message: { default: "" },
8
17
  type: { default: "success" },
9
- duration: { default: 3e3 },
18
+ duration: {},
10
19
  closable: { type: Boolean, default: !0 },
11
- position: { default: "bottom-right" }
20
+ position: { default: "top-center" },
21
+ offset: { default: 24 },
22
+ zIndex: { default: 2e3 },
23
+ showIcon: { type: Boolean, default: !0 },
24
+ pauseOnHover: { type: Boolean, default: !0 },
25
+ closeOnEscape: { type: Boolean },
26
+ repeat: { default: 1 },
27
+ plain: { type: Boolean },
28
+ teleport: { type: Boolean, default: !0 },
29
+ appendTo: { default: "body" }
12
30
  },
13
- emits: ["close"],
14
- setup(e, { emit: y }) {
15
- const p = z(), t = e, r = y, a = h(!0);
16
- let l;
17
- function s() {
18
- clearTimeout(l);
31
+ emits: ["close", "afterClose"],
32
+ setup(e, { expose: F, emit: S }) {
33
+ const a = e, w = S, E = j(), $ = q(), L = ce(), b = d(), u = d(!0), o = d(!1), C = d(!1), T = d(!1), R = h(() => a.position === "top" ? "top-center" : a.position === "bottom" ? "bottom-center" : a.position), g = h(() => Math.max(0, Number.isFinite(a.duration ?? 3e3) ? a.duration ?? (a.type === "loading" ? 0 : 3e3) : 0)), P = h(() => !!a.message || !!$.default), U = h(() => ({ success: re, error: ue, info: ie, warning: ne, loading: le })[a.type]);
34
+ let y, l, f = 0, z = 0, k = !1, I = !0;
35
+ function D() {
36
+ clearTimeout(y), y = void 0;
19
37
  }
20
- function i() {
21
- s(), a.value && t.message && t.duration > 0 && (l = setTimeout(() => r("close"), t.duration));
38
+ function r() {
39
+ y && (f = Math.max(0, f - (Date.now() - z))), D();
22
40
  }
23
- return g(() => [t.message, t.duration], i, { immediate: !0 }), C(s), b(() => {
24
- a.value = !1, s();
25
- }), k(() => {
26
- a.value = !0, i();
27
- }), (P, u) => (n(), c(T, { to: "body" }, [
28
- m(B, { name: "hys-ui-toast-motion" }, {
29
- default: x(() => [
30
- e.message && a.value ? (n(), d("div", A({ key: 0 }, o(p), {
31
- class: ["hys-ui-toast", ["hys-ui-toast-" + e.type, "hys-ui-toast-position-" + e.position]],
41
+ function c() {
42
+ if (D(), !(!u.value || !o.value || C.value || T.value || g.value <= 0)) {
43
+ if (f <= 0) {
44
+ n();
45
+ return;
46
+ }
47
+ z = Date.now(), y = setTimeout(n, f);
48
+ }
49
+ }
50
+ function B() {
51
+ f = g.value, c();
52
+ }
53
+ function n() {
54
+ o.value && (r(), o.value = !1, k || (k = !0, w("close")));
55
+ }
56
+ function W() {
57
+ !o.value && u.value && w("afterClose");
58
+ }
59
+ return N(() => [a.message, g.value, a.repeat], (s, t) => {
60
+ s[0] || !t && $.default ? (o.value = !0, k = !1, B()) : !P.value || t != null && t[0] ? n() : o.value && B();
61
+ }, { immediate: !0 }), N(() => o.value && u.value && a.closeOnEscape, (s) => {
62
+ l == null || l(), l = s ? de(n) : void 0;
63
+ }, { immediate: !0 }), G(() => {
64
+ u.value = !1, r();
65
+ }), J(() => {
66
+ u.value = !0, K(() => I && c());
67
+ }), Q(() => {
68
+ I = !1, r(), l == null || l();
69
+ }), F({ close: n, pause: r, resume: c, restart: B, element: b }), (s, t) => (i(), H(Y, {
70
+ to: e.appendTo,
71
+ disabled: !e.teleport
72
+ }, [
73
+ O(Z, {
74
+ name: "hys-ui-toast-motion",
75
+ appear: "",
76
+ onAfterLeave: W
77
+ }, {
78
+ default: _(() => [
79
+ o.value && u.value ? (i(), m("div", ee({
80
+ key: 0,
81
+ ref_key: "element",
82
+ ref: b
83
+ }, { ...x(L), ...x(E) }, {
84
+ class: ["hys-ui-toast", ["hys-ui-toast-" + e.type, "hys-ui-toast-position-" + R.value, { "hys-ui-toast-inline": !e.teleport, "hys-ui-toast-plain": e.plain }]],
85
+ style: { "--hys-ui-toast-offset": Math.max(0, e.offset) + "px", zIndex: e.zIndex },
32
86
  role: e.type === "error" ? "alert" : "status",
33
- onMouseenter: s,
34
- onMouseleave: i
87
+ "aria-live": e.type === "error" ? "assertive" : "polite",
88
+ "aria-atomic": "true",
89
+ onMouseenter: t[0] || (t[0] = (p) => e.pauseOnHover && (C.value = !0, r())),
90
+ onMouseleave: t[1] || (t[1] = (p) => {
91
+ C.value = !1, c();
92
+ }),
93
+ onFocusin: t[2] || (t[2] = (p) => {
94
+ T.value = !0, r();
95
+ }),
96
+ onFocusout: t[3] || (t[3] = (p) => {
97
+ var M;
98
+ return !((M = b.value) != null && M.contains(p.relatedTarget)) && (T.value = !1, c());
99
+ })
35
100
  }), [
36
- N("span", null, [
37
- (n(), c(V(e.type === "error" ? o(E) : e.type === "info" ? o(H) : o(M)), { size: 18 }))
101
+ e.showIcon ? (i(), m("span", ve, [
102
+ A(s.$slots, "icon", {}, () => [
103
+ (i(), H(te(U.value), {
104
+ size: 18,
105
+ class: ae({ "hys-ui-toast-spinner": e.type === "loading" })
106
+ }, null, 8, ["class"]))
107
+ ], !0)
108
+ ])) : v("", !0),
109
+ oe("div", ye, [
110
+ A(s.$slots, "default", {}, () => [
111
+ se(V(e.message), 1)
112
+ ], !0)
38
113
  ]),
39
- D(w(e.message), 1),
40
- e.closable ? (n(), d("button", {
41
- key: 0,
114
+ e.repeat > 1 ? (i(), m("span", {
115
+ key: 1,
116
+ class: "hys-ui-toast-repeat",
117
+ "aria-label": "重复 " + e.repeat + " 次"
118
+ }, "×" + V(e.repeat), 9, pe)) : v("", !0),
119
+ s.$slots.action ? (i(), m("span", he, [
120
+ A(s.$slots, "action", { close: n }, void 0, !0)
121
+ ])) : v("", !0),
122
+ e.closable ? (i(), m("button", {
123
+ key: 3,
124
+ class: "hys-ui-toast-close",
42
125
  type: "button",
43
126
  "aria-label": "关闭提示",
44
- onClick: u[0] || (u[0] = (S) => r("close"))
127
+ onClick: n
45
128
  }, [
46
- m(o(R), { size: 14 })
47
- ])) : f("", !0)
48
- ], 16, I)) : f("", !0)
129
+ O(x(fe), { size: 14 })
130
+ ])) : v("", !0)
131
+ ], 16, me)) : v("", !0)
49
132
  ]),
50
- _: 1
133
+ _: 3
51
134
  })
52
- ]));
135
+ ], 8, ["to", "disabled"]));
53
136
  }
54
137
  });
55
138
  export {
56
- j as default
139
+ ke as default
57
140
  };
@@ -1,74 +1,79 @@
1
- import { defineComponent as C, useModel as M, ref as V, watch as g, openBlock as B, createBlock as E, withCtx as a, createElementVNode as h, toDisplayString as u, createVNode as d, createTextVNode as f, mergeModels as x } from "vue";
2
- import H from "../HysModal/HysModal.vue.js";
3
- import m from "../HysButton/HysButton.vue.js";
4
- const O = /* @__PURE__ */ C({
1
+ import { defineComponent as C, useModel as V, ref as B, watch as f, openBlock as N, createBlock as b, withCtx as s, createElementVNode as x, toDisplayString as i, createVNode as m, createTextVNode as p, mergeModels as M } from "vue";
2
+ import E from "../HysModal/HysModal.vue.js";
3
+ import v from "../HysButton/HysButton.vue.js";
4
+ const T = /* @__PURE__ */ C({
5
5
  __name: "HysTour",
6
- props: /* @__PURE__ */ x({
6
+ props: /* @__PURE__ */ M({
7
7
  steps: {},
8
8
  current: {},
9
- closeOnEscape: { type: Boolean }
9
+ closeOnEscape: { type: Boolean, default: !0 }
10
10
  }, {
11
11
  modelValue: { type: Boolean, default: !1 },
12
12
  modelModifiers: {}
13
13
  }),
14
- emits: /* @__PURE__ */ x(["finish", "close", "change", "update:current"], ["update:modelValue"]),
15
- setup(t, { emit: y }) {
16
- const o = t, i = M(t, "modelValue"), s = y, e = V(o.current || 0);
17
- g(() => o.current, (l) => {
18
- l !== void 0 && (e.value = l);
19
- }), g(i, (l) => {
20
- l && (e.value = o.current || 0);
14
+ emits: /* @__PURE__ */ M(["finish", "close", "change", "update:current"], ["update:modelValue"]),
15
+ setup(l, { emit: y }) {
16
+ const n = l, r = V(l, "modelValue"), u = y, e = B(o(n.current ?? 0));
17
+ function o(t) {
18
+ return Math.max(0, Math.min(Math.max(0, n.steps.length - 1), Number.isFinite(t) ? Math.floor(t) : 0));
19
+ }
20
+ f(() => n.current, (t) => {
21
+ t !== void 0 && (e.value = o(t));
22
+ }), f(r, (t) => {
23
+ t && (e.value = o(n.current ?? 0));
24
+ }), f(() => n.steps.length, () => {
25
+ e.value = o(e.value);
21
26
  });
22
- function p(l) {
23
- e.value = Math.max(0, Math.min(o.steps.length - 1, l)), s("change", e.value), s("update:current", e.value);
27
+ function h(t) {
28
+ e.value = o(t), u("change", e.value), u("update:current", e.value);
24
29
  }
25
- function r() {
26
- i.value = !1, s("close");
30
+ function c() {
31
+ r.value = !1, u("close");
27
32
  }
28
33
  function k() {
29
- e.value >= o.steps.length - 1 ? (s("finish"), r()) : p(e.value + 1);
34
+ e.value >= n.steps.length - 1 ? (u("finish"), c()) : h(e.value + 1);
30
35
  }
31
- return (l, n) => {
32
- var v;
33
- return B(), E(H, {
34
- open: i.value,
35
- title: ((v = t.steps[e.value]) == null ? void 0 : v.title) || "引导",
36
- "close-on-escape": t.closeOnEscape !== !1,
36
+ return (t, a) => {
37
+ var g;
38
+ return N(), b(E, {
39
+ open: r.value,
40
+ title: ((g = l.steps[e.value]) == null ? void 0 : g.title) || "引导",
41
+ "close-on-escape": l.closeOnEscape !== !1,
37
42
  "close-on-mask": !1,
38
- onClose: r
43
+ onClose: c
39
44
  }, {
40
- footer: a(() => [
41
- h("span", null, u(t.steps.length ? e.value + 1 : 0) + " / " + u(t.steps.length), 1),
42
- d(m, {
45
+ footer: s(() => [
46
+ x("span", null, i(l.steps.length ? e.value + 1 : 0) + " / " + i(l.steps.length), 1),
47
+ m(v, {
43
48
  variant: "ghost",
44
- onClick: r
49
+ onClick: c
45
50
  }, {
46
- default: a(() => [...n[1] || (n[1] = [
47
- f("跳过", -1)
51
+ default: s(() => [...a[1] || (a[1] = [
52
+ p("跳过", -1)
48
53
  ])]),
49
54
  _: 1
50
55
  }),
51
- d(m, {
56
+ m(v, {
52
57
  variant: "secondary",
53
58
  disabled: e.value === 0,
54
- onClick: n[0] || (n[0] = (c) => p(e.value - 1))
59
+ onClick: a[0] || (a[0] = (d) => h(e.value - 1))
55
60
  }, {
56
- default: a(() => [...n[2] || (n[2] = [
57
- f("上一步", -1)
61
+ default: s(() => [...a[2] || (a[2] = [
62
+ p("上一步", -1)
58
63
  ])]),
59
64
  _: 1
60
65
  }, 8, ["disabled"]),
61
- d(m, { onClick: k }, {
62
- default: a(() => [
63
- f(u(e.value >= t.steps.length - 1 ? "完成" : "下一步"), 1)
66
+ m(v, { onClick: k }, {
67
+ default: s(() => [
68
+ p(i(e.value >= l.steps.length - 1 ? "完成" : "下一步"), 1)
64
69
  ]),
65
70
  _: 1
66
71
  })
67
72
  ]),
68
- default: a(() => {
69
- var c;
73
+ default: s(() => {
74
+ var d;
70
75
  return [
71
- h("p", null, u(((c = t.steps[e.value]) == null ? void 0 : c.description) || "暂无引导步骤"), 1)
76
+ x("p", null, i(((d = l.steps[e.value]) == null ? void 0 : d.description) || "暂无引导步骤"), 1)
72
77
  ];
73
78
  }),
74
79
  _: 1
@@ -77,5 +82,5 @@ const O = /* @__PURE__ */ C({
77
82
  }
78
83
  });
79
84
  export {
80
- O as default
85
+ T as default
81
86
  };