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
package/CHANGELOG.md CHANGED
@@ -1,8 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.1
4
+
5
+ - Center toast messages at the top by default and add seven placement options.
6
+ - Remove the toast accent border; add warning/loading states, content/icon/action slots and timer pause/resume.
7
+ - Add useHysToast for keyed updates, grouping, bounded queues, close handles and completion callbacks.
8
+ - Improve toast transitions, narrow-screen layout and cached-page resource cleanup.
9
+ - Add createHysToast for shared services outside component setup.
10
+ - Match drawer entrance/exit directions to placement, including fullscreen; support explicit top/bottom height.
11
+ - Fit Gantt timelines to the available container width and preserve date calculations while resizing.
12
+ - Keep select options on one line, size popups to content, and add exact-width and custom filtering options.
13
+ - Preserve remote selection labels and improve keyboard navigation, disabled options and composition handling.
14
+ - Unify checkbox/radio visuals and compose them in trees, transfer lists and permission matrices.
15
+ - Add permission batch selection and transfer change events; preserve drag/drop animations.
16
+ - Prevent stale asynchronous switch, upload and dialog actions after cancellation or page changes.
17
+ - Improve form validation for custom controls, field descriptions, readonly behavior and reset feedback.
18
+ - Correct slider step alignment, calendar initial selection, numeric animation boundaries and resize cleanup.
19
+ - Synchronize pagination models after page-size changes and validate typed jump targets immediately.
20
+ - Preserve typed numeric precision and expose draft input events from number inputs.
21
+ - Respect disabled notification actions; defer incomplete search composition and cancel stale queries.
22
+ - Reset command highlights after filtering, normalize organization input and tour step bounds, and enable default tour Escape behavior.
23
+ - Guard pending rich-text link commands and improve composite form focus and keyboard file selection.
24
+ - Expand select examples and organize configuration panels into aligned parameter and behavior groups.
25
+ - Add formatted, highlighted, lazy-loaded source panels with toolbar copy actions and responsive layout.
26
+ - Simplify documentation to focus on component features, API and examples.
27
+
3
28
  ## 0.1.0
4
29
 
5
- - Extract 69 independent Vue components with Hys-prefixed public names.
30
+ - Introduce reusable Vue components with Hys-prefixed public names.
6
31
  - Add isolated styles, six themes, reactive configuration and public TypeScript declarations.
7
32
  - Expand common interaction capabilities across form, selection, feedback, navigation, layout and data components.
8
33
  - Add rule-based forms, asynchronous validation, reset and accessible field feedback.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # HYS UI
2
2
 
3
- 69 个独立的 Vue 3.5+ 组件,提供 TypeScript 类型、六套主题和独立的中文交互文档。
3
+ 面向 Vue 3.5+ 的组件库,提供 TypeScript 类型、主题配置和独立的中文交互文档。
4
4
 
5
5
  ## 安装
6
6
 
@@ -47,7 +47,7 @@ npm run dev:docs
47
47
  访问 http://127.0.0.1:5174。每个组件有独立路由、运行场景、源码、API 与说明,页面状态通过 KeepAlive 保留。API 从源码生成。
48
48
 
49
49
  - `packages/ui`:唯一的组件源码及 npm 包。
50
- - `apps/docs`:独立文档应用,包含 69 个组件页面。
50
+ - `apps/docs`:独立组件文档与交互示例。
51
51
  - `tests`:核心行为回归。
52
52
  - `scripts`:元信息提取、完整性检查、打包与发布验证。
53
53
 
@@ -59,15 +59,25 @@ npm run check:contracts
59
59
  npm run check:release
60
60
  ```
61
61
 
62
- `build:docs` 输出到 `apps/docs/dist`,部署服务需要将未知路径回退到 `index.html`。本仓库独立于项目治理平台,平台仅作为组件库的使用方。
62
+ `build:docs` 输出到 `apps/docs/dist`,部署服务需要将未知路径回退到 `index.html`。
63
63
 
64
- ## 功能对标
64
+ ## 轻提示
65
65
 
66
- 参考 Element Plus、Ant Design Vue、Naive UI 的成熟使用模式,覆盖所有能找到同类组件的核心场景。具体对应项、能力边界和高级能力迭代见 [组件能力对标](https://github.com/lampo1024/hys-ui/blob/main/docs/COMPONENT_PARITY.md)。HYS UI 保持自己的 API,不提供这三家组件库的直接替换兼容层。
66
+ 轻提示默认显示在顶部中间,支持七种位置、五种状态和自定义内容。
67
+
68
+ ```ts
69
+ import { useHysToast } from 'hys-ui'
70
+
71
+ // 在组件 setup 中使用
72
+ const toast = useHysToast({ maxCount: 5 })
73
+ toast.success('保存成功')
74
+ const task = toast.loading('正在上传…')
75
+ task.update({ type: 'success', message: '上传完成', duration: 2000 })
76
+ ```
67
77
 
68
78
  ## 发布
69
79
 
70
- 根工作区和文档应用为私有,npm 包名为 `hys-ui`,首版 `0.1.0`,MIT 公开发布。
80
+ 根工作区和文档应用为私有,npm 包名为 `hys-ui`,版本 `0.1.1`,MIT 公开发布。
71
81
 
72
82
  ```bash
73
83
  npm run pack:ui
@@ -1,7 +1,7 @@
1
- import { defineComponent as b, ref as k, computed as C, watch as g, openBlock as o, createElementBlock as i, mergeProps as B, unref as t, createBlock as w, resolveDynamicComponent as A, createCommentVNode as l, createElementVNode as c, renderSlot as u, createTextVNode as d, toDisplayString as m, createVNode as N } from "vue";
1
+ import { defineComponent as b, ref as k, computed as C, watch as g, openBlock as o, createElementBlock as s, mergeProps as B, unref as t, createBlock as w, resolveDynamicComponent as A, createCommentVNode as l, createElementVNode as c, renderSlot as u, createTextVNode as d, toDisplayString as m, createVNode as N } from "vue";
2
2
  import { useHysRootAttrs as V } from "../../config.js";
3
- import { CircleCheck as x, TriangleAlert as I, CircleAlert as p, Info as z, X as D } from "lucide-vue-next";
4
- const E = ["role"], H = { key: 0 }, j = /* @__PURE__ */ b({
3
+ import { CircleCheck as I, TriangleAlert as $, CircleAlert as p, Info as x, X as z } from "lucide-vue-next";
4
+ const D = ["role"], E = { key: 0 }, j = /* @__PURE__ */ b({
5
5
  __name: "HysAlert",
6
6
  props: {
7
7
  tone: { default: "info" },
@@ -14,41 +14,41 @@ const E = ["role"], H = { key: 0 }, j = /* @__PURE__ */ b({
14
14
  },
15
15
  emits: ["close", "update:visible"],
16
16
  setup(e, { emit: y }) {
17
- const f = V(), s = e, r = y, n = k(!0), v = C(() => s.visible ?? n.value);
18
- g(() => s.title, () => n.value = !0);
17
+ const f = V(), r = e, a = y, n = k(!0), v = C(() => r.visible ?? n.value);
18
+ g(() => r.title, () => n.value = !0);
19
19
  function h() {
20
- n.value = !1, r("update:visible", !1), r("close");
20
+ n.value = !1, a("update:visible", !1), a("close");
21
21
  }
22
- return (a, R) => v.value ? (o(), i("div", B({ key: 0 }, t(f), {
22
+ return (i, H) => v.value ? (o(), s("div", B({ key: 0 }, t(f), {
23
23
  class: ["hys-ui-ex-alert", "hys-ui-ex-" + e.tone],
24
24
  role: e.tone === "danger" ? "alert" : "status",
25
25
  style: { justifyContent: e.center ? "center" : void 0 }
26
26
  }), [
27
- e.showIcon ? (o(), w(A(e.tone === "success" ? t(x) : e.tone === "warning" ? t(I) : e.tone === "danger" ? t(p) : t(z)), {
27
+ e.showIcon ? (o(), w(A(e.tone === "success" ? t(I) : e.tone === "warning" ? t($) : e.tone === "danger" ? t(p) : t(x)), {
28
28
  key: 0,
29
29
  size: 18
30
30
  })) : l("", !0),
31
31
  c("div", null, [
32
- e.title ? (o(), i("strong", H, [
33
- u(a.$slots, "title", {}, () => [
32
+ e.title || i.$slots.title ? (o(), s("strong", E, [
33
+ u(i.$slots, "title", {}, () => [
34
34
  d(m(e.title), 1)
35
35
  ])
36
36
  ])) : l("", !0),
37
37
  c("div", null, [
38
- u(a.$slots, "default", {}, () => [
38
+ u(i.$slots, "default", {}, () => [
39
39
  d(m(e.description), 1)
40
40
  ])
41
41
  ])
42
42
  ]),
43
- e.closable ? (o(), i("button", {
43
+ e.closable ? (o(), s("button", {
44
44
  key: 1,
45
45
  type: "button",
46
46
  "aria-label": "关闭提示",
47
47
  onClick: h
48
48
  }, [
49
- N(t(D), { size: 14 })
49
+ N(t(z), { size: 14 })
50
50
  ])) : l("", !0)
51
- ], 16, E)) : l("", !0);
51
+ ], 16, D)) : l("", !0);
52
52
  }
53
53
  });
54
54
  export {
@@ -1,7 +1,7 @@
1
- import { defineComponent as A, ref as M, watch as F, onDeactivated as x, onActivated as y, onBeforeUnmount as b, openBlock as w, createElementBlock as _, mergeProps as B, unref as g, toDisplayString as k } from "vue";
2
- import { useHysRootAttrs as q } from "../../config.js";
3
- import { useMotion as D } from "../../motion/useMotion.js";
4
- const H = ["aria-label"], E = /* @__PURE__ */ A({
1
+ import { defineComponent as A, ref as b, watch as M, onDeactivated as x, onActivated as y, onBeforeUnmount as N, openBlock as w, createElementBlock as B, mergeProps as k, unref as q, toDisplayString as D } from "vue";
2
+ import { useHysRootAttrs as H } from "../../config.js";
3
+ import { useMotion as R } from "../../motion/useMotion.js";
4
+ const S = ["aria-label"], P = /* @__PURE__ */ A({
5
5
  __name: "HysAnimatedNumber",
6
6
  props: {
7
7
  value: {},
@@ -9,32 +9,35 @@ const H = ["aria-label"], E = /* @__PURE__ */ A({
9
9
  decimals: { default: 0 }
10
10
  },
11
11
  setup(o) {
12
- const m = q(), { effectiveMotion: u } = D(), n = o, e = M(n.value);
12
+ const l = H(), { effectiveMotion: u } = R(), t = o, n = b(Number.isFinite(t.value) ? t.value : 0);
13
13
  let a = 0, r = !0;
14
- function l(t) {
15
- if (cancelAnimationFrame(a), u.value === "off") {
16
- e.value = t;
14
+ function i(e) {
15
+ return Number.isFinite(e) ? e : 0;
16
+ }
17
+ function f(e) {
18
+ if (e = i(e), cancelAnimationFrame(a), u.value === "off" || !Number.isFinite(t.duration) || t.duration <= 0) {
19
+ n.value = e;
17
20
  return;
18
21
  }
19
- const i = e.value, d = performance.now(), v = Math.max(1, n.duration);
20
- function s(p) {
21
- const c = Math.min(1, (p - d) / v), h = 1 - Math.pow(1 - c, 3);
22
- e.value = i + (t - i) * h, c < 1 && (a = requestAnimationFrame(s));
22
+ const s = n.value, v = performance.now(), h = Math.max(1, t.duration);
23
+ function m(p) {
24
+ const c = Math.min(1, (p - v) / h), F = 1 - Math.pow(1 - c, 3);
25
+ n.value = s + (e - s) * F, c < 1 && (a = requestAnimationFrame(m));
23
26
  }
24
- a = requestAnimationFrame(s);
27
+ a = requestAnimationFrame(m);
25
28
  }
26
- return F(() => n.value, (t) => {
27
- r ? l(t) : e.value = t;
29
+ return M(() => [t.value, t.duration, u.value], ([e]) => {
30
+ r ? f(e) : n.value = i(e);
28
31
  }), x(() => {
29
32
  r = !1, cancelAnimationFrame(a);
30
33
  }), y(() => {
31
- r = !0, e.value = n.value;
32
- }), b(() => cancelAnimationFrame(a)), (t, f) => (w(), _("span", B(g(m), {
34
+ r = !0, n.value = i(t.value);
35
+ }), N(() => cancelAnimationFrame(a)), (e, d) => (w(), B("span", k(q(l), {
33
36
  class: "hys-ui-motion-number",
34
- "aria-label": String(o.value)
35
- }), k(e.value.toFixed(Math.max(0, Math.min(5, o.decimals)))), 17, H));
37
+ "aria-label": String(i(o.value))
38
+ }), D(n.value.toFixed(Number.isFinite(o.decimals) ? Math.max(0, Math.min(5, Math.floor(o.decimals))) : 0)), 17, S));
36
39
  }
37
40
  });
38
41
  export {
39
- E as default
42
+ P as default
40
43
  };
@@ -1,7 +1,7 @@
1
1
  import o from "./HysBadge2.vue.js";
2
2
  /* empty css */
3
3
  import t from "../../_virtual/_plugin-vue_export-helper.js";
4
- const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-81723701"]]);
4
+ const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-743d37a3"]]);
5
5
  export {
6
6
  p as default
7
7
  };
@@ -1,7 +1,7 @@
1
- import { defineComponent as y, openBlock as t, createElementBlock as o, mergeProps as c, unref as l, createElementVNode as f, normalizeStyle as b, normalizeClass as n, renderSlot as v, withModifiers as g, createVNode as h, createCommentVNode as s, toDisplayString as B } from "vue";
2
- import { useHysRootAttrs as x } from "../../config.js";
3
- import { X as z } from "lucide-vue-next";
4
- const S = /* @__PURE__ */ y({
1
+ import { defineComponent as y, openBlock as t, createElementBlock as o, mergeProps as b, unref as u, normalizeStyle as c, normalizeClass as n, renderSlot as f, withModifiers as v, createVNode as g, createCommentVNode as l, toDisplayString as h } from "vue";
2
+ import { useHysRootAttrs as B } from "../../config.js";
3
+ import { X as k } from "lucide-vue-next";
4
+ const C = /* @__PURE__ */ y({
5
5
  __name: "HysBadge",
6
6
  props: {
7
7
  tone: { default: "blue" },
@@ -14,30 +14,31 @@ const S = /* @__PURE__ */ y({
14
14
  showZero: { type: Boolean }
15
15
  },
16
16
  emits: ["close"],
17
- setup(e, { emit: u }) {
18
- const d = x(), i = u;
19
- return (r, a) => (t(), o("span", c(l(d), { class: "hys-ui-badge-wrap" }), [
20
- f("span", {
21
- class: n(["hys-ui-badge", "hys-ui-badge-" + e.tone]),
22
- style: b({ borderRadius: e.round ? "99px" : void 0, fontSize: e.size === "sm" ? "10px" : void 0 })
17
+ setup(e, { emit: d }) {
18
+ const i = B(), m = d;
19
+ return (a, s) => (t(), o("span", b(u(i), { class: "hys-ui-badge-wrap" }), [
20
+ a.$slots.default || e.closable ? (t(), o("span", {
21
+ key: 0,
22
+ class: n(["hys-ui-badge", ["hys-ui-badge-" + e.tone, { "hys-ui-badge-content": e.dot || e.value !== void 0 }]]),
23
+ style: c({ borderRadius: e.round ? "99px" : void 0, fontSize: e.size === "sm" ? "10px" : void 0 })
23
24
  }, [
24
- v(r.$slots, "default", {}, void 0, !0),
25
+ f(a.$slots, "default", {}, void 0, !0),
25
26
  e.closable ? (t(), o("button", {
26
27
  key: 0,
27
28
  type: "button",
28
29
  "aria-label": "关闭标签",
29
- onClick: a[0] || (a[0] = g((m) => i("close", m), ["stop"]))
30
+ onClick: s[0] || (s[0] = v((r) => m("close", r), ["stop"]))
30
31
  }, [
31
- h(l(z), { size: 12 })
32
- ])) : s("", !0)
33
- ], 6),
32
+ g(u(k), { size: 12 })
33
+ ])) : l("", !0)
34
+ ], 6)) : l("", !0),
34
35
  e.dot || e.value !== void 0 && (e.value !== 0 || e.showZero) ? (t(), o("sup", {
35
- key: 0,
36
- class: n(["hys-ui-badge-counter", { "hys-ui-badge-dot": e.dot }])
37
- }, B(e.dot ? "" : typeof e.value == "number" && e.value > e.max ? e.max + "+" : e.value), 3)) : s("", !0)
36
+ key: 1,
37
+ class: n(["hys-ui-badge-counter", { "hys-ui-badge-dot": e.dot, "hys-ui-badge-standalone": !a.$slots.default && !e.closable }])
38
+ }, h(e.dot ? "" : typeof e.value == "number" && e.value > e.max ? e.max + "+" : e.value), 3)) : l("", !0)
38
39
  ], 16));
39
40
  }
40
41
  });
41
42
  export {
42
- S as default
43
+ C as default
43
44
  };
@@ -1,80 +1,88 @@
1
- import { defineComponent as A, ref as p, computed as C, openBlock as a, createElementBlock as l, mergeProps as F, unref as y, createElementVNode as i, createVNode as $, toDisplayString as c, Fragment as h, renderList as b, renderSlot as N, createTextVNode as R, createCommentVNode as x } from "vue";
2
- import { useHysRootAttrs as z } from "../../config.js";
3
- import { ChevronLeft as B, ChevronRight as E } from "lucide-vue-next";
4
- const H = { class: "hys-ui-ent-toolbar" }, L = { class: "hys-ui-ent-calendar" }, M = ["disabled", "aria-pressed", "onClick"], Y = ["onClick"], G = /* @__PURE__ */ A({
1
+ import { defineComponent as F, ref as k, watch as T, computed as $, openBlock as r, createElementBlock as i, mergeProps as A, unref as v, createElementVNode as d, createVNode as D, toDisplayString as c, Fragment as b, renderList as h, renderSlot as B, createTextVNode as M, createCommentVNode as R } from "vue";
2
+ import { useHysRootAttrs as Y } from "../../config.js";
3
+ import { ChevronLeft as x, ChevronRight as z } from "lucide-vue-next";
4
+ const E = { class: "hys-ui-ent-toolbar" }, H = { class: "hys-ui-ent-calendar" }, L = ["disabled", "aria-readonly", "aria-pressed", "onClick"], U = ["disabled", "onClick"], j = /* @__PURE__ */ F({
5
5
  __name: "HysCalendar",
6
6
  props: {
7
7
  modelValue: {},
8
8
  events: {},
9
+ disabled: { type: Boolean },
10
+ readonly: { type: Boolean },
9
11
  disabledDate: { type: Function }
10
12
  },
11
13
  emits: ["update:modelValue", "select", "event"],
12
- setup(d, { emit: D }) {
13
- const V = z(), m = D, f = /* @__PURE__ */ new Date(), o = p(f.getFullYear()), r = p(f.getMonth()), S = C(() => `${o.value}年${r.value + 1}月`), w = C(() => {
14
- const n = (new Date(o.value, r.value, 1).getDay() + 6) % 7, t = new Date(o.value, r.value + 1, 0).getDate();
15
- return [...Array(n).fill(null), ...Array.from({ length: t }, (e, v) => v + 1)];
14
+ setup(a, { emit: V }) {
15
+ const S = Y(), N = a, y = V, g = /* @__PURE__ */ new Date(), l = k(g.getFullYear()), o = k(g.getMonth());
16
+ T(() => N.modelValue, (n) => {
17
+ if (!n || !/^\d{4}-\d{2}-\d{2}$/.test(n)) return;
18
+ const t = /* @__PURE__ */ new Date(n + "T00:00:00Z");
19
+ !Number.isNaN(t.getTime()) && t.toISOString().slice(0, 10) === n && (l.value = t.getUTCFullYear(), o.value = t.getUTCMonth());
20
+ }, { immediate: !0 });
21
+ const p = $(() => `${l.value}年${o.value + 1}月`), w = $(() => {
22
+ const n = (new Date(l.value, o.value, 1).getDay() + 6) % 7, t = new Date(l.value, o.value + 1, 0).getDate();
23
+ return [...Array(n).fill(null), ...Array.from({ length: t }, (e, m) => m + 1)];
16
24
  });
17
- function g(n) {
18
- const t = new Date(o.value, r.value + n, 1);
19
- o.value = t.getFullYear(), r.value = t.getMonth();
25
+ function f(n) {
26
+ const t = new Date(l.value, o.value + n, 1);
27
+ l.value = t.getFullYear(), o.value = t.getMonth();
20
28
  }
21
29
  function s(n) {
22
- return `${o.value}-${String(r.value + 1).padStart(2, "0")}-${String(n).padStart(2, "0")}`;
30
+ return `${l.value}-${String(o.value + 1).padStart(2, "0")}-${String(n).padStart(2, "0")}`;
23
31
  }
24
- return (n, t) => (a(), l("section", F(y(V), { class: "hys-ui-ent-panel" }), [
25
- i("header", H, [
26
- i("button", {
32
+ return (n, t) => (r(), i("section", A(v(S), { class: "hys-ui-ent-panel" }), [
33
+ d("header", E, [
34
+ d("button", {
27
35
  type: "button",
28
36
  "aria-label": "上个月",
29
- onClick: t[0] || (t[0] = (e) => g(-1))
37
+ onClick: t[0] || (t[0] = (e) => f(-1))
30
38
  }, [
31
- $(y(B), {
39
+ D(v(x), {
32
40
  size: 16,
33
41
  "aria-hidden": "true"
34
42
  })
35
43
  ]),
36
- i("strong", null, c(S.value), 1),
37
- i("button", {
44
+ d("strong", null, c(p.value), 1),
45
+ d("button", {
38
46
  type: "button",
39
47
  "aria-label": "下个月",
40
- onClick: t[1] || (t[1] = (e) => g(1))
48
+ onClick: t[1] || (t[1] = (e) => f(1))
41
49
  }, [
42
- $(y(E), {
50
+ D(v(z), {
43
51
  size: 16,
44
52
  "aria-hidden": "true"
45
53
  })
46
54
  ])
47
55
  ]),
48
- i("div", L, [
49
- (a(), l(h, null, b(["一", "二", "三", "四", "五", "六", "日"], (e) => i("strong", { key: e }, c(e), 1)), 64)),
50
- (a(!0), l(h, null, b(w.value, (e, v) => {
51
- var k;
52
- return a(), l("div", {
53
- key: v,
56
+ d("div", H, [
57
+ (r(), i(b, null, h(["一", "二", "三", "四", "五", "六", "日"], (e) => d("strong", { key: e }, c(e), 1)), 64)),
58
+ (r(!0), i(b, null, h(w.value, (e, m) => {
59
+ var C;
60
+ return r(), i("div", {
61
+ key: m,
54
62
  class: "hys-ui-ent-calendar-day"
55
63
  }, [
56
- e ? (a(), l("button", {
64
+ e ? (r(), i("button", {
57
65
  key: 0,
58
66
  type: "button",
59
- disabled: (k = d.disabledDate) == null ? void 0 : k.call(d, s(e)),
60
- "aria-pressed": d.modelValue === s(e),
61
- onClick: (u) => {
62
- m("select", s(e)), m("update:modelValue", s(e));
63
- }
67
+ disabled: a.disabled || ((C = a.disabledDate) == null ? void 0 : C.call(a, s(e))),
68
+ "aria-readonly": a.readonly || void 0,
69
+ "aria-pressed": a.modelValue === s(e),
70
+ onClick: (u) => !a.readonly && (y("select", s(e)), y("update:modelValue", s(e)))
64
71
  }, [
65
- N(n.$slots, "date", {
72
+ B(n.$slots, "date", {
66
73
  date: s(e),
67
74
  day: e
68
75
  }, () => [
69
- R(c(e), 1)
76
+ M(c(e), 1)
70
77
  ])
71
- ], 8, M)) : x("", !0),
72
- (a(!0), l(h, null, b((d.events || []).filter((u) => e && u.date === s(e)), (u) => (a(), l("button", {
78
+ ], 8, L)) : R("", !0),
79
+ (r(!0), i(b, null, h((a.events || []).filter((u) => e && u.date === s(e)), (u) => (r(), i("button", {
73
80
  type: "button",
74
81
  key: u.id,
75
82
  class: "hys-ui-ent-event",
76
- onClick: (P) => m("event", u.id)
77
- }, c(u.title), 9, Y))), 128))
83
+ disabled: a.disabled,
84
+ onClick: (I) => y("event", u.id)
85
+ }, c(u.title), 9, U))), 128))
78
86
  ]);
79
87
  }), 128))
80
88
  ])
@@ -82,5 +90,5 @@ const H = { class: "hys-ui-ent-toolbar" }, L = { class: "hys-ui-ent-calendar" },
82
90
  }
83
91
  });
84
92
  export {
85
- G as default
93
+ j as default
86
94
  };
@@ -1,7 +1,7 @@
1
1
  import o from "./HysCard2.vue.js";
2
2
  /* empty css */
3
3
  import r from "../../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-2eee4550"]]);
4
+ const p = /* @__PURE__ */ r(o, [["__scopeId", "data-v-7c0b794e"]]);
5
5
  export {
6
- m as default
6
+ p as default
7
7
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent as n, openBlock as s, createElementBlock as o, mergeProps as u, unref as y, renderSlot as l, createElementVNode as d, toDisplayString as a, createCommentVNode as i, normalizeStyle as c } from "vue";
1
+ import { defineComponent as n, openBlock as s, createElementBlock as o, mergeProps as u, unref as y, renderSlot as l, createElementVNode as d, toDisplayString as i, createCommentVNode as a, normalizeStyle as c } from "vue";
2
2
  import { useHysRootAttrs as h } from "../../config.js";
3
3
  const m = {
4
4
  key: 0,
@@ -18,10 +18,10 @@ const m = {
18
18
  title: {},
19
19
  subtitle: {},
20
20
  loading: { type: Boolean },
21
- bordered: { type: Boolean },
22
- shadow: {},
21
+ bordered: { type: Boolean, default: !0 },
22
+ shadow: { default: "never" },
23
23
  bodyStyle: {},
24
- size: {}
24
+ size: { default: "md" }
25
25
  },
26
26
  setup(e) {
27
27
  const r = h();
@@ -29,17 +29,17 @@ const m = {
29
29
  class: ["hys-ui-card", ["hys-ui-card-shadow-" + (e.shadow || "never"), "hys-ui-card-size-" + (e.size || "md")]],
30
30
  style: { border: e.bordered === !1 ? "0" : void 0 }
31
31
  }), [
32
- e.title || t.$slots.header || t.$slots.action ? (s(), o("header", m, [
32
+ e.title || e.subtitle || t.$slots.header || t.$slots.action ? (s(), o("header", m, [
33
33
  l(t.$slots, "header", {}, () => [
34
34
  d("div", null, [
35
- d("h3", null, a(e.title), 1),
36
- e.subtitle ? (s(), o("p", f, a(e.subtitle), 1)) : i("", !0)
35
+ d("h3", null, i(e.title), 1),
36
+ e.subtitle ? (s(), o("p", f, i(e.subtitle), 1)) : a("", !0)
37
37
  ])
38
38
  ], !0),
39
39
  d("div", null, [
40
40
  l(t.$slots, "action", {}, void 0, !0)
41
41
  ])
42
- ])) : i("", !0),
42
+ ])) : a("", !0),
43
43
  d("div", {
44
44
  class: "hys-ui-card-content",
45
45
  style: c(e.bodyStyle),
@@ -49,7 +49,7 @@ const m = {
49
49
  ], 12, b),
50
50
  t.$slots.footer ? (s(), o("footer", $, [
51
51
  l(t.$slots, "footer", {}, void 0, !0)
52
- ])) : i("", !0)
52
+ ])) : a("", !0)
53
53
  ], 16));
54
54
  }
55
55
  });