@guoyg578/k-ui 0.1.4 → 0.1.6

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 (102) hide show
  1. package/dist/components/KAutoComplete.vue.d.ts +2 -0
  2. package/dist/components/KAutoComplete.vue.js +1 -1
  3. package/dist/components/KAutoComplete.vue_vue_type_script_setup_true_lang.js +89 -29
  4. package/dist/components/KCalendar.vue.js +1 -1
  5. package/dist/components/KCalendar.vue_vue_type_script_setup_true_lang.js +132 -39
  6. package/dist/components/KCascader.vue.d.ts +2 -0
  7. package/dist/components/KCascader.vue.js +1 -1
  8. package/dist/components/KCascader.vue_vue_type_script_setup_true_lang.js +45 -43
  9. package/dist/components/KCheckbox.vue.d.ts +6 -2
  10. package/dist/components/KCheckbox.vue.js +1 -1
  11. package/dist/components/KCheckbox.vue_vue_type_script_setup_true_lang.js +38 -18
  12. package/dist/components/KCheckboxGroup.vue.d.ts +2 -0
  13. package/dist/components/KCheckboxGroup.vue.js +1 -1
  14. package/dist/components/KCheckboxGroup.vue_vue_type_script_setup_true_lang.js +23 -15
  15. package/dist/components/KCollapse.vue.d.ts +3 -1
  16. package/dist/components/KCollapse.vue.js +1 -1
  17. package/dist/components/KCollapse.vue_vue_type_script_setup_true_lang.js +27 -16
  18. package/dist/components/KCombobox.vue.js +1 -1
  19. package/dist/components/KCombobox.vue_vue_type_script_setup_true_lang.js +48 -47
  20. package/dist/components/KDataTable.vue.d.ts +48 -1
  21. package/dist/components/KDataTable.vue.js +1 -1
  22. package/dist/components/KDataTable.vue_vue_type_script_setup_true_lang.js +305 -74
  23. package/dist/components/KDatePicker.vue.d.ts +8 -0
  24. package/dist/components/KDatePicker.vue_vue_type_script_setup_true_lang.js +32 -22
  25. package/dist/components/KDialog.vue.d.ts +4 -4
  26. package/dist/components/KDialog.vue.js +1 -1
  27. package/dist/components/KDialog.vue_vue_type_script_setup_true_lang.js +83 -73
  28. package/dist/components/KDrawer.vue.js +1 -1
  29. package/dist/components/KDrawer.vue_vue_type_script_setup_true_lang.js +36 -35
  30. package/dist/components/KDropdown.vue.d.ts +4 -3
  31. package/dist/components/KDropdown.vue_vue_type_script_setup_true_lang.js +48 -30
  32. package/dist/components/KDynamicInput.vue.d.ts +2 -0
  33. package/dist/components/KDynamicInput.vue.js +1 -1
  34. package/dist/components/KDynamicInput.vue_vue_type_script_setup_true_lang.js +17 -6
  35. package/dist/components/KDynamicTags.vue.d.ts +2 -0
  36. package/dist/components/KDynamicTags.vue.js +1 -1
  37. package/dist/components/KDynamicTags.vue_vue_type_script_setup_true_lang.js +11 -10
  38. package/dist/components/KForm.vue.d.ts +12 -0
  39. package/dist/components/KForm.vue.js +1 -1
  40. package/dist/components/KForm.vue_vue_type_script_setup_true_lang.js +26 -4
  41. package/dist/components/KFormField.vue.d.ts +3 -1
  42. package/dist/components/KFormField.vue.js +1 -1
  43. package/dist/components/KFormField.vue_vue_type_script_setup_true_lang.js +124 -61
  44. package/dist/components/KInputNumber.vue.js +1 -1
  45. package/dist/components/KInputNumber.vue_vue_type_script_setup_true_lang.js +35 -29
  46. package/dist/components/KMention.vue.d.ts +2 -0
  47. package/dist/components/KMention.vue.js +1 -1
  48. package/dist/components/KMention.vue_vue_type_script_setup_true_lang.js +34 -33
  49. package/dist/components/KMenu.vue.js +1 -1
  50. package/dist/components/KMenu.vue_vue_type_script_setup_true_lang.js +132 -51
  51. package/dist/components/KMenuItem.vue.js +1 -1
  52. package/dist/components/KMenuItem.vue_vue_type_script_setup_true_lang.js +21 -6
  53. package/dist/components/KMessage.d.ts +5 -0
  54. package/dist/components/KMessage.js +36 -23
  55. package/dist/components/KNotification.d.ts +8 -0
  56. package/dist/components/KNotification.js +45 -29
  57. package/dist/components/KNotificationProvider.vue.js +3 -8
  58. package/dist/components/KNotificationProvider.vue_vue_type_script_setup_true_lang.js +11 -0
  59. package/dist/components/KPagination.vue.d.ts +4 -1
  60. package/dist/components/KPagination.vue.js +1 -1
  61. package/dist/components/KPagination.vue_vue_type_script_setup_true_lang.js +36 -33
  62. package/dist/components/KPopover.vue_vue_type_script_setup_true_lang.js +15 -14
  63. package/dist/components/KRadio.vue.d.ts +1 -0
  64. package/dist/components/KRadio.vue.js +1 -1
  65. package/dist/components/KRadio.vue_vue_type_script_setup_true_lang.js +22 -14
  66. package/dist/components/KRadioGroup.vue.d.ts +4 -2
  67. package/dist/components/KRadioGroup.vue.js +1 -1
  68. package/dist/components/KRadioGroup.vue_vue_type_script_setup_true_lang.js +16 -4
  69. package/dist/components/KRate.vue.d.ts +5 -0
  70. package/dist/components/KRate.vue.js +1 -1
  71. package/dist/components/KRate.vue_vue_type_script_setup_true_lang.js +72 -24
  72. package/dist/components/KSelect.vue.d.ts +2 -2
  73. package/dist/components/KSelect.vue.js +1 -1
  74. package/dist/components/KSelect.vue_vue_type_script_setup_true_lang.js +60 -59
  75. package/dist/components/KSlider.vue.d.ts +2 -0
  76. package/dist/components/KSlider.vue.js +1 -1
  77. package/dist/components/KSlider.vue_vue_type_script_setup_true_lang.js +17 -16
  78. package/dist/components/KTextarea.vue.d.ts +2 -0
  79. package/dist/components/KTextarea.vue.js +1 -1
  80. package/dist/components/KTextarea.vue_vue_type_script_setup_true_lang.js +10 -9
  81. package/dist/components/KTimePicker.vue.d.ts +2 -0
  82. package/dist/components/KTimePicker.vue.js +1 -1
  83. package/dist/components/KTimePicker.vue_vue_type_script_setup_true_lang.js +63 -49
  84. package/dist/components/KTooltip.vue_vue_type_script_setup_true_lang.js +13 -12
  85. package/dist/components/KTransfer.vue.d.ts +2 -0
  86. package/dist/components/KTransfer.vue.js +1 -1
  87. package/dist/components/KTransfer.vue_vue_type_script_setup_true_lang.js +35 -34
  88. package/dist/components/KTreeSelect.vue.d.ts +2 -0
  89. package/dist/components/KTreeSelect.vue.js +1 -1
  90. package/dist/components/KTreeSelect.vue_vue_type_script_setup_true_lang.js +20 -18
  91. package/dist/components/KUpload.vue.d.ts +14 -0
  92. package/dist/components/KUpload.vue.js +1 -1
  93. package/dist/components/KUpload.vue_vue_type_script_setup_true_lang.js +159 -117
  94. package/dist/components/checkbox-context.d.ts +10 -0
  95. package/dist/components/checkbox-context.js +4 -0
  96. package/dist/components/form-context.d.ts +19 -2
  97. package/dist/components/form-context.js +31 -1
  98. package/dist/components/menu-context.d.ts +4 -0
  99. package/dist/components/radio-context.d.ts +6 -1
  100. package/dist/k-ui.css +1 -1
  101. package/dist/styles/tokens.css +40 -1
  102. package/package.json +1 -1
@@ -1,11 +1,8 @@
1
- import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, normalizeClass as l, openBlock as u, renderList as d, toDisplayString as f, unref as p, withCtx as m } from "vue";
2
- import { ChevronLeft as h, ChevronRight as g, ChevronsLeft as _, ChevronsRight as v } from "lucide-vue-next";
3
- import { PaginationEllipsis as y, PaginationFirst as b, PaginationLast as x, PaginationList as S, PaginationListItem as C, PaginationNext as w, PaginationPrev as T, PaginationRoot as E } from "reka-ui";
1
+ import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, normalizeClass as l, openBlock as u, renderList as d, toDisplayString as f, unref as p, watch as m, withCtx as h } from "vue";
2
+ import { ChevronLeft as g, ChevronRight as _, ChevronsLeft as v, ChevronsRight as y } from "lucide-vue-next";
3
+ import { PaginationEllipsis as b, PaginationFirst as x, PaginationLast as S, PaginationList as C, PaginationListItem as w, PaginationNext as T, PaginationPrev as E, PaginationRoot as D } from "reka-ui";
4
4
  //#region components/KPagination.vue?vue&type=script&setup=true&lang.ts
5
- var D = {
6
- key: 0,
7
- class: "k-pg-bar"
8
- }, O = {
5
+ var O = {
9
6
  key: 0,
10
7
  class: "k-pg-side"
11
8
  }, k = {
@@ -17,74 +14,80 @@ var D = {
17
14
  page: {},
18
15
  pageSize: {},
19
16
  total: {},
20
- showSummary: { type: Boolean }
17
+ showSummary: { type: Boolean },
18
+ size: { default: "md" }
21
19
  },
22
20
  emits: ["update:page"],
23
21
  setup(c, { emit: A }) {
24
- let j = c, M = A, N = t(() => j.total === 0 ? 0 : (j.page - 1) * j.pageSize + 1), P = t(() => Math.min(j.total, j.page * j.pageSize)), F = t(() => j.pageSize > 0 ? Math.ceil(j.total / j.pageSize) : 0);
25
- function I(e) {
26
- e !== j.page && M("update:page", e);
22
+ let j = c, M = t(() => j.size === "small" || j.size === "sm" ? "sm" : j.size === "large" || j.size === "lg" ? "lg" : "md"), N = A, P = t(() => j.total === 0 ? 0 : (j.page - 1) * j.pageSize + 1), F = t(() => Math.min(j.total, j.page * j.pageSize)), I = t(() => j.pageSize > 0 ? Math.ceil(j.total / j.pageSize) : 0);
23
+ function L(e) {
24
+ e !== j.page && N("update:page", e);
27
25
  }
28
- return (t, A) => F.value > 1 ? (u(), i("div", D, [
26
+ return m([() => j.page, I], ([e, t]) => {
27
+ t <= 0 || (e > t ? N("update:page", t) : e < 1 && N("update:page", 1));
28
+ }, { immediate: !0 }), (t, m) => I.value > 1 ? (u(), i("div", {
29
+ key: 0,
30
+ class: l(["k-pg-bar", `k-pg-bar--${M.value}`])
31
+ }, [
29
32
  c.showSummary ? (u(), i("div", O, [
30
- a("span", null, f(N.value), 1),
31
- A[0] ||= o("–", -1),
32
33
  a("span", null, f(P.value), 1),
33
- A[1] ||= o(" / ", -1),
34
+ m[0] ||= o("", -1),
35
+ a("span", null, f(F.value), 1),
36
+ m[1] ||= o(" / ", -1),
34
37
  a("span", null, f(c.total), 1)
35
38
  ])) : (u(), i("div", k)),
36
- s(p(E), {
39
+ s(p(D), {
37
40
  page: c.page,
38
41
  "items-per-page": c.pageSize,
39
42
  total: c.total,
40
43
  "sibling-count": 1,
41
44
  "show-edges": "",
42
45
  class: "k-pg-center",
43
- "onUpdate:page": I
46
+ "onUpdate:page": L
44
47
  }, {
45
- default: m(() => [s(p(S), { class: "k-pg-list" }, {
46
- default: m(({ items: t }) => [
47
- s(p(b), {
48
+ default: h(() => [s(p(C), { class: "k-pg-list" }, {
49
+ default: h(({ items: t }) => [
50
+ s(p(x), {
48
51
  class: "k-pg-btn k-pg-arrow",
49
52
  title: "首页"
50
53
  }, {
51
- default: m(() => [s(p(_), { size: 14 })]),
54
+ default: h(() => [s(p(v), { size: 14 })]),
52
55
  _: 1
53
56
  }),
54
- s(p(T), {
57
+ s(p(E), {
55
58
  class: "k-pg-btn k-pg-arrow",
56
59
  title: "上一页"
57
60
  }, {
58
- default: m(() => [s(p(h), { size: 14 })]),
61
+ default: h(() => [s(p(g), { size: 14 })]),
59
62
  _: 1
60
63
  }),
61
- (u(!0), i(e, null, d(t, (t, r) => (u(), i(e, null, [t.type === "page" ? (u(), n(p(C), {
64
+ (u(!0), i(e, null, d(t, (t, r) => (u(), i(e, null, [t.type === "page" ? (u(), n(p(w), {
62
65
  key: `p-${t.value}`,
63
66
  value: t.value,
64
67
  class: l(["k-pg-btn k-pg-page", { active: t.value === c.page }])
65
68
  }, {
66
- default: m(() => [o(f(t.value), 1)]),
69
+ default: h(() => [o(f(t.value), 1)]),
67
70
  _: 2
68
- }, 1032, ["value", "class"])) : (u(), n(p(y), {
71
+ }, 1032, ["value", "class"])) : (u(), n(p(b), {
69
72
  key: `e-${r}`,
70
73
  index: r,
71
74
  class: "k-pg-ellipsis"
72
75
  }, {
73
- default: m(() => [...A[2] ||= [o("…", -1)]]),
76
+ default: h(() => [...m[2] ||= [o("…", -1)]]),
74
77
  _: 1
75
78
  }, 8, ["index"]))], 64))), 256)),
76
- s(p(w), {
79
+ s(p(T), {
77
80
  class: "k-pg-btn k-pg-arrow",
78
81
  title: "下一页"
79
82
  }, {
80
- default: m(() => [s(p(g), { size: 14 })]),
83
+ default: h(() => [s(p(_), { size: 14 })]),
81
84
  _: 1
82
85
  }),
83
- s(p(x), {
86
+ s(p(S), {
84
87
  class: "k-pg-btn k-pg-arrow",
85
88
  title: "末页"
86
89
  }, {
87
- default: m(() => [s(p(v), { size: 14 })]),
90
+ default: h(() => [s(p(y), { size: 14 })]),
88
91
  _: 1
89
92
  })
90
93
  ]),
@@ -96,8 +99,8 @@ var D = {
96
99
  "items-per-page",
97
100
  "total"
98
101
  ]),
99
- A[3] ||= a("div", { class: "k-pg-side" }, null, -1)
100
- ])) : r("", !0);
102
+ m[3] ||= a("div", { class: "k-pg-side" }, null, -1)
103
+ ], 2)) : r("", !0);
101
104
  }
102
105
  });
103
106
  //#endregion
@@ -1,7 +1,8 @@
1
- import { createBlock as e, createCommentVNode as t, createVNode as n, defineComponent as r, mergeModels as i, normalizeClass as a, openBlock as o, renderSlot as s, unref as c, useModel as l, withCtx as u } from "vue";
2
- import { PopoverArrow as d, PopoverContent as f, PopoverPortal as p, PopoverRoot as m, PopoverTrigger as h } from "reka-ui";
1
+ import { createBlock as e, createCommentVNode as t, createVNode as n, defineComponent as r, mergeModels as i, mergeProps as a, normalizeClass as o, openBlock as s, renderSlot as c, unref as l, useModel as u, withCtx as d } from "vue";
2
+ import { PopoverArrow as f, PopoverContent as p, PopoverPortal as m, PopoverRoot as h, PopoverTrigger as g } from "reka-ui";
3
3
  //#region components/KPopover.vue?vue&type=script&setup=true&lang.ts
4
- var g = /* @__PURE__ */ r({
4
+ var _ = /* @__PURE__ */ r({
5
+ inheritAttrs: !1,
5
6
  __name: "KPopover",
6
7
  props: /* @__PURE__ */ i({
7
8
  side: { default: "bottom" },
@@ -22,25 +23,25 @@ var g = /* @__PURE__ */ r({
22
23
  }),
23
24
  emits: ["update:open"],
24
25
  setup(r) {
25
- let i = l(r, "open");
26
- return (l, g) => (o(), e(c(m), {
26
+ let i = u(r, "open");
27
+ return (u, _) => (s(), e(l(h), {
27
28
  open: i.value,
28
- "onUpdate:open": g[0] ||= (e) => i.value = e
29
+ "onUpdate:open": _[0] ||= (e) => i.value = e
29
30
  }, {
30
- default: u(() => [n(c(h), {
31
+ default: d(() => [n(l(g), a(u.$attrs, {
31
32
  "as-child": "",
32
33
  disabled: r.disabled
33
- }, {
34
- default: u(() => [s(l.$slots, "default")]),
34
+ }), {
35
+ default: d(() => [c(u.$slots, "default")]),
35
36
  _: 3
36
- }, 8, ["disabled"]), n(c(p), null, {
37
- default: u(() => [n(c(f), {
38
- class: a(["k-popover-content", r.contentClass]),
37
+ }, 16, ["disabled"]), n(l(m), null, {
38
+ default: d(() => [n(l(p), {
39
+ class: o(["k-popover-content", r.contentClass]),
39
40
  side: r.side,
40
41
  align: r.align,
41
42
  "side-offset": r.sideOffset
42
43
  }, {
43
- default: u(() => [s(l.$slots, "content", { close: () => i.value = !1 }), r.showArrow ? (o(), e(c(d), {
44
+ default: d(() => [c(u.$slots, "content", { close: () => i.value = !1 }), r.showArrow ? (s(), e(l(f), {
44
45
  key: 0,
45
46
  class: "k-popover-arrow",
46
47
  width: 11,
@@ -60,4 +61,4 @@ var g = /* @__PURE__ */ r({
60
61
  }
61
62
  });
62
63
  //#endregion
63
- export { g as default };
64
+ export { _ as default };
@@ -2,6 +2,7 @@ type __VLS_Props = {
2
2
  value: string | number;
3
3
  disabled?: boolean;
4
4
  label?: string;
5
+ size?: 'small' | 'sm' | 'medium' | 'md' | 'large' | 'lg';
5
6
  };
6
7
  declare var __VLS_8: {}, __VLS_21: {};
7
8
  type __VLS_Slots = {} & {
@@ -2,6 +2,6 @@ import e from "../_virtual/_plugin-vue_export-helper.js";
2
2
  import t from "./KRadio.vue_vue_type_script_setup_true_lang.js";
3
3
  /* empty css */
4
4
  //#region components/KRadio.vue
5
- var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-9ec711b6"]]);
5
+ var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-4980d31b"]]);
6
6
  //#endregion
7
7
  export { n as default };
@@ -1,39 +1,47 @@
1
1
  import { RADIO_GROUP_KEY as e } from "./radio-context.js";
2
- import { computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createTextVNode as a, createVNode as o, defineComponent as s, inject as c, normalizeClass as l, openBlock as u, renderSlot as d, toDisplayString as f, unref as p, withCtx as m } from "vue";
3
- import { RadioGroupIndicator as h, RadioGroupItem as g } from "reka-ui";
2
+ import { computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createTextVNode as a, createVNode as o, defineComponent as s, inject as c, normalizeClass as l, onBeforeUnmount as u, openBlock as d, renderSlot as f, toDisplayString as p, unref as m, watch as h, withCtx as g } from "vue";
3
+ import { RadioGroupIndicator as _, RadioGroupItem as v } from "reka-ui";
4
4
  //#region components/KRadio.vue?vue&type=script&setup=true&lang.ts
5
- var _ = {
5
+ var y = {
6
6
  key: 0,
7
7
  class: "k-radio__label"
8
- }, v = /* @__PURE__ */ s({
8
+ }, b = /* @__PURE__ */ s({
9
9
  __name: "KRadio",
10
10
  props: {
11
11
  value: {},
12
12
  disabled: { type: Boolean },
13
- label: {}
13
+ label: {},
14
+ size: {}
14
15
  },
15
16
  setup(s) {
16
- let v = c(e, null), y = t(() => !!v?.button.value);
17
- return (e, t) => y.value ? (u(), n(p(g), {
17
+ let b = s, x = c(e, null), S = t(() => !!x?.button.value);
18
+ h(() => b.value, (e, t) => {
19
+ t !== void 0 && t !== e && x?.unregister(t), x?.register(e);
20
+ }, { immediate: !0 }), u(() => x?.unregister(b.value));
21
+ let C = t(() => b.size ?? x?.size?.value ?? "md"), w = t(() => {
22
+ let e = C.value;
23
+ return e === "small" || e === "sm" ? "sm" : e === "large" || e === "lg" ? "lg" : "md";
24
+ });
25
+ return (e, t) => S.value ? (d(), n(m(v), {
18
26
  key: 0,
19
27
  value: String(s.value),
20
28
  disabled: s.disabled,
21
29
  class: "k-radio-btn"
22
30
  }, {
23
- default: m(() => [d(e.$slots, "default", {}, () => [a(f(s.label), 1)], !0)]),
31
+ default: g(() => [f(e.$slots, "default", {}, () => [a(p(s.label), 1)], !0)]),
24
32
  _: 3
25
- }, 8, ["value", "disabled"])) : (u(), i("label", {
33
+ }, 8, ["value", "disabled"])) : (d(), i("label", {
26
34
  key: 1,
27
- class: l(["k-radio-wrap", { "k-radio-wrap--disabled": s.disabled }])
28
- }, [o(p(g), {
35
+ class: l(["k-radio-wrap", [`k-radio-wrap--${w.value}`, { "k-radio-wrap--disabled": s.disabled }]])
36
+ }, [o(m(v), {
29
37
  value: String(s.value),
30
38
  disabled: s.disabled,
31
39
  class: "k-radio"
32
40
  }, {
33
- default: m(() => [o(p(h), { class: "k-radio__indicator" })]),
41
+ default: g(() => [o(m(_), { class: "k-radio__indicator" })]),
34
42
  _: 1
35
- }, 8, ["value", "disabled"]), s.label || e.$slots.default ? (u(), i("span", _, [d(e.$slots, "default", {}, () => [a(f(s.label), 1)], !0)])) : r("", !0)], 2));
43
+ }, 8, ["value", "disabled"]), s.label || e.$slots.default ? (d(), i("span", y, [f(e.$slots, "default", {}, () => [a(p(s.label), 1)], !0)])) : r("", !0)], 2));
36
44
  }
37
45
  });
38
46
  //#endregion
39
- export { v as default };
47
+ export { b as default };
@@ -4,15 +4,17 @@ type __VLS_Props = {
4
4
  direction?: 'horizontal' | 'vertical';
5
5
  /** 分段按钮样式(对齐 naive-ui NRadioButton) */
6
6
  button?: boolean;
7
+ /** 组级尺寸,下发给未单独设置 size 的 KRadio */
8
+ size?: 'small' | 'sm' | 'medium' | 'md' | 'large' | 'lg';
7
9
  };
8
10
  declare var __VLS_10: {};
9
11
  type __VLS_Slots = {} & {
10
12
  default?: (props: typeof __VLS_10) => any;
11
13
  };
12
14
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
13
- "update:modelValue": (v: string) => any;
15
+ "update:modelValue": (v: string | number) => any;
14
16
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
15
- "onUpdate:modelValue"?: ((v: string) => any) | undefined;
17
+ "onUpdate:modelValue"?: ((v: string | number) => any) | undefined;
16
18
  }>, {
17
19
  button: boolean;
18
20
  disabled: boolean;
@@ -2,6 +2,6 @@ import e from "../_virtual/_plugin-vue_export-helper.js";
2
2
  import t from "./KRadioGroup.vue_vue_type_script_setup_true_lang.js";
3
3
  /* empty css */
4
4
  //#region components/KRadioGroup.vue
5
- var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-813698ee"]]);
5
+ var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-c8d44ff2"]]);
6
6
  //#endregion
7
7
  export { n as default };
@@ -14,15 +14,27 @@ var d = /* @__PURE__ */ n({
14
14
  button: {
15
15
  type: Boolean,
16
16
  default: !1
17
- }
17
+ },
18
+ size: {}
18
19
  },
19
20
  emits: ["update:modelValue"],
20
- setup(n) {
21
- return a(e, { button: s(n, "button") }), (e, a) => (i(), t(c(u), {
21
+ setup(n, { emit: d }) {
22
+ let f = n, p = d, m = /* @__PURE__ */ new Map();
23
+ a(e, {
24
+ button: s(f, "button"),
25
+ size: s(f, "size"),
26
+ register: (e) => m.set(String(e), e),
27
+ unregister: (e) => m.delete(String(e))
28
+ });
29
+ function h(e) {
30
+ let t = String(e);
31
+ p("update:modelValue", m.has(t) ? m.get(t) : t);
32
+ }
33
+ return (e, a) => (i(), t(c(u), {
22
34
  "model-value": String(n.modelValue),
23
35
  disabled: n.disabled,
24
36
  class: r(["k-radio-group", [`k-radio-group--${n.direction}`, { "k-radio-group--button": n.button }]]),
25
- "onUpdate:modelValue": a[0] ||= (t) => e.$emit("update:modelValue", String(t))
37
+ "onUpdate:modelValue": a[0] ||= (e) => h(String(e))
26
38
  }, {
27
39
  default: l(() => [o(e.$slots, "default", {}, void 0, !0)]),
28
40
  _: 3
@@ -3,10 +3,13 @@ type __VLS_Props = {
3
3
  count?: number;
4
4
  allowHalf?: boolean;
5
5
  readonly?: boolean;
6
+ disabled?: boolean;
6
7
  size?: number;
7
8
  color?: string;
8
9
  /** 再次点击同值清零 */
9
10
  clearable?: boolean;
11
+ /** 无障碍标签 */
12
+ ariaLabel?: string;
10
13
  };
11
14
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
12
15
  "update:modelValue": (v: number) => any;
@@ -14,12 +17,14 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
14
17
  "onUpdate:modelValue"?: ((v: number) => any) | undefined;
15
18
  }>, {
16
19
  size: number;
20
+ disabled: boolean;
17
21
  color: string;
18
22
  modelValue: number;
19
23
  readonly: boolean;
20
24
  clearable: boolean;
21
25
  count: number;
22
26
  allowHalf: boolean;
27
+ ariaLabel: string;
23
28
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
29
  declare const _default: typeof __VLS_export;
25
30
  export default _default;
@@ -2,6 +2,6 @@ import e from "../_virtual/_plugin-vue_export-helper.js";
2
2
  import t from "./KRate.vue_vue_type_script_setup_true_lang.js";
3
3
  /* empty css */
4
4
  //#region components/KRate.vue
5
- var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-9306d0f6"]]);
5
+ var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-9aa17cdf"]]);
6
6
  //#endregion
7
7
  export { n as default };
@@ -1,7 +1,15 @@
1
1
  import { Fragment as e, computed as t, createElementBlock as n, createElementVNode as r, createVNode as i, defineComponent as a, normalizeClass as o, normalizeStyle as s, openBlock as c, ref as l, renderList as u, unref as d } from "vue";
2
2
  import { Star as f } from "lucide-vue-next";
3
3
  //#region components/KRate.vue?vue&type=script&setup=true&lang.ts
4
- var p = ["onMousemove", "onClick"], m = /* @__PURE__ */ a({
4
+ var p = [
5
+ "tabindex",
6
+ "aria-label",
7
+ "aria-valuemax",
8
+ "aria-valuenow",
9
+ "aria-valuetext",
10
+ "aria-readonly",
11
+ "aria-disabled"
12
+ ], m = ["onMousemove", "onClick"], h = /* @__PURE__ */ a({
5
13
  __name: "KRate",
6
14
  props: {
7
15
  modelValue: { default: 0 },
@@ -14,39 +22,79 @@ var p = ["onMousemove", "onClick"], m = /* @__PURE__ */ a({
14
22
  type: Boolean,
15
23
  default: !1
16
24
  },
25
+ disabled: {
26
+ type: Boolean,
27
+ default: !1
28
+ },
17
29
  size: { default: 22 },
18
30
  color: { default: "#f59e0b" },
19
31
  clearable: {
20
32
  type: Boolean,
21
33
  default: !0
22
- }
34
+ },
35
+ ariaLabel: { default: "评分" }
23
36
  },
24
37
  emits: ["update:modelValue"],
25
- setup(a, { emit: m }) {
26
- let h = a, g = m, _ = l(null), v = t(() => _.value ?? h.modelValue);
27
- function y(e) {
28
- let t = v.value;
29
- return t >= e ? "full" : h.allowHalf && t >= e - .5 ? "half" : "empty";
38
+ setup(a, { emit: h }) {
39
+ let g = a, _ = h, v = l(null), y = t(() => v.value ?? g.modelValue), b = t(() => g.allowHalf ? .5 : 1);
40
+ function x(e) {
41
+ if (g.readonly || g.disabled) return;
42
+ let t = g.modelValue;
43
+ switch (e.key) {
44
+ case "ArrowRight":
45
+ case "ArrowUp":
46
+ t = Math.min(g.count, t + b.value);
47
+ break;
48
+ case "ArrowLeft":
49
+ case "ArrowDown":
50
+ t = Math.max(0, t - b.value);
51
+ break;
52
+ case "Home":
53
+ t = 0;
54
+ break;
55
+ case "End":
56
+ t = g.count;
57
+ break;
58
+ default: return;
59
+ }
60
+ e.preventDefault(), t !== g.modelValue && _("update:modelValue", t);
61
+ }
62
+ function S(e) {
63
+ let t = y.value;
64
+ return t >= e ? "full" : g.allowHalf && t >= e - .5 ? "half" : "empty";
30
65
  }
31
- function b(e, t) {
32
- if (!h.allowHalf) return e;
66
+ function C(e, t) {
67
+ if (!g.allowHalf) return e;
33
68
  let n = t.currentTarget.getBoundingClientRect();
34
69
  return t.clientX - n.left < n.width / 2 ? e - .5 : e;
35
70
  }
36
- function x(e, t) {
37
- h.readonly || (_.value = b(e, t));
71
+ function w(e, t) {
72
+ g.readonly || g.disabled || (v.value = C(e, t));
38
73
  }
39
- function S() {
40
- _.value = null;
74
+ function T() {
75
+ v.value = null;
41
76
  }
42
- function C(e, t) {
43
- if (h.readonly) return;
44
- let n = b(e, t);
45
- h.clearable && h.modelValue === n && (n = 0), g("update:modelValue", n);
77
+ function E(e, t) {
78
+ if (g.readonly || g.disabled) return;
79
+ let n = C(e, t);
80
+ g.clearable && g.modelValue === n && (n = 0), _("update:modelValue", n);
46
81
  }
47
82
  return (t, l) => (c(), n("div", {
48
- class: o(["k-rate", { "k-rate--readonly": a.readonly }]),
49
- onMouseleave: S
83
+ class: o(["k-rate", {
84
+ "k-rate--readonly": a.readonly,
85
+ "k-rate--disabled": a.disabled
86
+ }]),
87
+ role: "slider",
88
+ tabindex: a.readonly || a.disabled ? -1 : 0,
89
+ "aria-label": a.ariaLabel,
90
+ "aria-valuemin": 0,
91
+ "aria-valuemax": a.count,
92
+ "aria-valuenow": a.modelValue,
93
+ "aria-valuetext": `${a.modelValue} / ${a.count}`,
94
+ "aria-readonly": a.readonly || void 0,
95
+ "aria-disabled": a.disabled || void 0,
96
+ onMouseleave: T,
97
+ onKeydown: x
50
98
  }, [(c(!0), n(e, null, u(a.count, (e) => (c(), n("span", {
51
99
  key: e,
52
100
  class: "k-rate__star",
@@ -54,14 +102,14 @@ var p = ["onMousemove", "onClick"], m = /* @__PURE__ */ a({
54
102
  width: `${a.size}px`,
55
103
  height: `${a.size}px`
56
104
  }),
57
- onMousemove: (t) => x(e, t),
58
- onClick: (t) => C(e, t)
105
+ onMousemove: (t) => w(e, t),
106
+ onClick: (t) => E(e, t)
59
107
  }, [i(d(f), {
60
108
  size: a.size,
61
109
  class: "k-rate__bg"
62
110
  }, null, 8, ["size"]), r("span", {
63
111
  class: "k-rate__fill",
64
- style: s({ width: y(e) === "full" ? "100%" : y(e) === "half" ? "50%" : "0%" })
112
+ style: s({ width: S(e) === "full" ? "100%" : S(e) === "half" ? "50%" : "0%" })
65
113
  }, [i(d(f), {
66
114
  size: a.size,
67
115
  fill: a.color,
@@ -70,8 +118,8 @@ var p = ["onMousemove", "onClick"], m = /* @__PURE__ */ a({
70
118
  "size",
71
119
  "fill",
72
120
  "color"
73
- ])], 4)], 44, p))), 128))], 34));
121
+ ])], 4)], 44, m))), 128))], 42, p));
74
122
  }
75
123
  });
76
124
  //#endregion
77
- export { m as default };
125
+ export { h as default };
@@ -15,9 +15,9 @@ type __VLS_Props = {
15
15
  filterPlaceholder?: string;
16
16
  };
17
17
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
18
- "update:modelValue": (v: string | number) => any;
18
+ "update:modelValue": (v: string | number | null) => any;
19
19
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
20
- "onUpdate:modelValue"?: ((v: string | number) => any) | undefined;
20
+ "onUpdate:modelValue"?: ((v: string | number | null) => any) | undefined;
21
21
  }>, {
22
22
  size: "tiny" | "xs" | "small" | "sm" | "medium" | "md" | "large" | "lg";
23
23
  disabled: boolean;
@@ -4,6 +4,6 @@ import t from "./KSelect.vue_vue_type_script_setup_true_lang.js";
4
4
  /* empty css */
5
5
  /* empty css */
6
6
  //#region components/KSelect.vue
7
- var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-b8c18845"]]);
7
+ var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-42b3118e"]]);
8
8
  //#endregion
9
9
  export { n as default };