@guoyg578/k-ui 0.1.5 → 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 (96) 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 +19 -18
  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/KDataTable.vue.d.ts +48 -1
  19. package/dist/components/KDataTable.vue.js +1 -1
  20. package/dist/components/KDataTable.vue_vue_type_script_setup_true_lang.js +305 -74
  21. package/dist/components/KDatePicker.vue.d.ts +8 -0
  22. package/dist/components/KDatePicker.vue_vue_type_script_setup_true_lang.js +32 -22
  23. package/dist/components/KDialog.vue.d.ts +4 -4
  24. package/dist/components/KDialog.vue.js +1 -1
  25. package/dist/components/KDialog.vue_vue_type_script_setup_true_lang.js +80 -71
  26. package/dist/components/KDropdown.vue.d.ts +4 -3
  27. package/dist/components/KDropdown.vue_vue_type_script_setup_true_lang.js +45 -28
  28. package/dist/components/KDynamicInput.vue.d.ts +2 -0
  29. package/dist/components/KDynamicInput.vue.js +1 -1
  30. package/dist/components/KDynamicInput.vue_vue_type_script_setup_true_lang.js +17 -6
  31. package/dist/components/KDynamicTags.vue.d.ts +2 -0
  32. package/dist/components/KDynamicTags.vue.js +1 -1
  33. package/dist/components/KDynamicTags.vue_vue_type_script_setup_true_lang.js +11 -10
  34. package/dist/components/KForm.vue.d.ts +12 -0
  35. package/dist/components/KForm.vue.js +1 -1
  36. package/dist/components/KForm.vue_vue_type_script_setup_true_lang.js +26 -4
  37. package/dist/components/KFormField.vue.d.ts +3 -1
  38. package/dist/components/KFormField.vue.js +1 -1
  39. package/dist/components/KFormField.vue_vue_type_script_setup_true_lang.js +124 -61
  40. package/dist/components/KInputNumber.vue.js +1 -1
  41. package/dist/components/KInputNumber.vue_vue_type_script_setup_true_lang.js +35 -29
  42. package/dist/components/KMention.vue.d.ts +2 -0
  43. package/dist/components/KMention.vue.js +1 -1
  44. package/dist/components/KMention.vue_vue_type_script_setup_true_lang.js +34 -33
  45. package/dist/components/KMenu.vue.js +1 -1
  46. package/dist/components/KMenu.vue_vue_type_script_setup_true_lang.js +132 -51
  47. package/dist/components/KMenuItem.vue.js +1 -1
  48. package/dist/components/KMenuItem.vue_vue_type_script_setup_true_lang.js +21 -6
  49. package/dist/components/KMessage.d.ts +5 -0
  50. package/dist/components/KMessage.js +36 -23
  51. package/dist/components/KNotification.d.ts +8 -0
  52. package/dist/components/KNotification.js +45 -29
  53. package/dist/components/KNotificationProvider.vue.js +3 -8
  54. package/dist/components/KNotificationProvider.vue_vue_type_script_setup_true_lang.js +11 -0
  55. package/dist/components/KPagination.vue.d.ts +4 -1
  56. package/dist/components/KPagination.vue.js +1 -1
  57. package/dist/components/KPagination.vue_vue_type_script_setup_true_lang.js +36 -33
  58. package/dist/components/KRadio.vue.d.ts +1 -0
  59. package/dist/components/KRadio.vue.js +1 -1
  60. package/dist/components/KRadio.vue_vue_type_script_setup_true_lang.js +22 -14
  61. package/dist/components/KRadioGroup.vue.d.ts +4 -2
  62. package/dist/components/KRadioGroup.vue.js +1 -1
  63. package/dist/components/KRadioGroup.vue_vue_type_script_setup_true_lang.js +16 -4
  64. package/dist/components/KRate.vue.d.ts +5 -0
  65. package/dist/components/KRate.vue.js +1 -1
  66. package/dist/components/KRate.vue_vue_type_script_setup_true_lang.js +72 -24
  67. package/dist/components/KSelect.vue.d.ts +2 -2
  68. package/dist/components/KSelect.vue.js +1 -1
  69. package/dist/components/KSelect.vue_vue_type_script_setup_true_lang.js +1 -1
  70. package/dist/components/KSlider.vue.d.ts +2 -0
  71. package/dist/components/KSlider.vue.js +1 -1
  72. package/dist/components/KSlider.vue_vue_type_script_setup_true_lang.js +17 -16
  73. package/dist/components/KTextarea.vue.d.ts +2 -0
  74. package/dist/components/KTextarea.vue.js +1 -1
  75. package/dist/components/KTextarea.vue_vue_type_script_setup_true_lang.js +10 -9
  76. package/dist/components/KTimePicker.vue.d.ts +2 -0
  77. package/dist/components/KTimePicker.vue.js +1 -1
  78. package/dist/components/KTimePicker.vue_vue_type_script_setup_true_lang.js +61 -48
  79. package/dist/components/KTransfer.vue.d.ts +2 -0
  80. package/dist/components/KTransfer.vue.js +1 -1
  81. package/dist/components/KTransfer.vue_vue_type_script_setup_true_lang.js +35 -34
  82. package/dist/components/KTreeSelect.vue.d.ts +2 -0
  83. package/dist/components/KTreeSelect.vue.js +1 -1
  84. package/dist/components/KTreeSelect.vue_vue_type_script_setup_true_lang.js +15 -14
  85. package/dist/components/KUpload.vue.d.ts +14 -0
  86. package/dist/components/KUpload.vue.js +1 -1
  87. package/dist/components/KUpload.vue_vue_type_script_setup_true_lang.js +159 -117
  88. package/dist/components/checkbox-context.d.ts +10 -0
  89. package/dist/components/checkbox-context.js +4 -0
  90. package/dist/components/form-context.d.ts +19 -2
  91. package/dist/components/form-context.js +31 -1
  92. package/dist/components/menu-context.d.ts +4 -0
  93. package/dist/components/radio-context.d.ts +6 -1
  94. package/dist/k-ui.css +1 -1
  95. package/dist/styles/tokens.css +40 -1
  96. package/package.json +1 -1
@@ -9,6 +9,7 @@ type __VLS_Props = {
9
9
  disabled?: boolean;
10
10
  /** 是否按输入内容过滤候选 */
11
11
  filter?: boolean;
12
+ size?: 'tiny' | 'xs' | 'small' | 'sm' | 'medium' | 'md' | 'large' | 'lg';
12
13
  };
13
14
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
14
15
  select: (v: string) => any;
@@ -18,6 +19,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
18
19
  "onUpdate:modelValue"?: ((v: string) => any) | undefined;
19
20
  }>, {
20
21
  filter: boolean;
22
+ size: "tiny" | "xs" | "small" | "sm" | "medium" | "md" | "large" | "lg";
21
23
  disabled: boolean;
22
24
  modelValue: string;
23
25
  options: (string | AcOption)[];
@@ -3,6 +3,6 @@ import t from "./KAutoComplete.vue_vue_type_script_setup_true_lang.js";
3
3
  /* empty css */
4
4
  /* empty css */
5
5
  //#region components/KAutoComplete.vue
6
- var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-cfefb1e5"]]);
6
+ var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-a45db640"]]);
7
7
  //#endregion
8
8
  export { n as default };
@@ -1,13 +1,17 @@
1
- import { Fragment as e, computed as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, defineComponent as a, normalizeClass as o, openBlock as s, ref as c, renderList as l, toDisplayString as u, withModifiers as d } from "vue";
1
+ import { Fragment as e, computed as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, defineComponent as a, nextTick as o, normalizeClass as s, openBlock as c, ref as l, renderList as u, toDisplayString as d, useId as f, watch as p, withModifiers as m } from "vue";
2
2
  //#region components/KAutoComplete.vue?vue&type=script&setup=true&lang.ts
3
- var f = { class: "k-ac" }, p = [
3
+ var h = { class: "k-ac" }, g = [
4
4
  "value",
5
5
  "placeholder",
6
- "disabled"
7
- ], m = {
8
- key: 0,
9
- class: "k-ac__list k-menu-surface"
10
- }, h = ["onMousedown"], g = /* @__PURE__ */ a({
6
+ "disabled",
7
+ "aria-expanded",
8
+ "aria-activedescendant"
9
+ ], _ = [
10
+ "id",
11
+ "aria-selected",
12
+ "onMousedown",
13
+ "onMousemove"
14
+ ], v = /* @__PURE__ */ a({
11
15
  __name: "KAutoComplete",
12
16
  props: {
13
17
  modelValue: { default: "" },
@@ -20,39 +24,95 @@ var f = { class: "k-ac" }, p = [
20
24
  filter: {
21
25
  type: Boolean,
22
26
  default: !0
23
- }
27
+ },
28
+ size: { default: "md" }
24
29
  },
25
30
  emits: ["update:modelValue", "select"],
26
- setup(a, { emit: g }) {
27
- let _ = a, v = g, y = c(!1), b = t(() => (_.options ?? []).map((e) => typeof e == "string" ? {
31
+ setup(a, { emit: v }) {
32
+ let y = f(), b = `${y}-list`, x = (e) => `${y}-opt-${e}`, S = a, C = v, w = l(!1), T = l(-1), E = l(), D = t(() => S.size === "tiny" || S.size === "xs" || S.size === "small" || S.size === "sm" ? "sm" : S.size === "large" || S.size === "lg" ? "lg" : "md"), O = t(() => (S.options ?? []).map((e) => typeof e == "string" ? {
28
33
  label: e,
29
34
  value: e
30
- } : e)), x = t(() => {
31
- if (!_.filter || !_.modelValue) return b.value;
32
- let e = _.modelValue.toLowerCase();
33
- return b.value.filter((t) => t.label.toLowerCase().includes(e));
34
- }), S = t(() => y.value && !_.disabled && x.value.length > 0);
35
- function C(e) {
36
- v("update:modelValue", e.target.value);
35
+ } : e)), k = t(() => {
36
+ if (!S.filter || !S.modelValue) return O.value;
37
+ let e = S.modelValue.toLowerCase();
38
+ return O.value.filter((t) => t.label.toLowerCase().includes(e));
39
+ }), A = t(() => w.value && !S.disabled && k.value.length > 0);
40
+ p(k, () => {
41
+ T.value >= k.value.length && (T.value = k.value.length - 1);
42
+ });
43
+ function j(e) {
44
+ C("update:modelValue", e.target.value), w.value = !0, T.value = -1;
45
+ }
46
+ function M(e) {
47
+ C("update:modelValue", e.value), C("select", e.value), w.value = !1, T.value = -1;
48
+ }
49
+ function N() {
50
+ o(() => {
51
+ E.value?.querySelector(".k-ac__item--active")?.scrollIntoView({ block: "nearest" });
52
+ });
53
+ }
54
+ function P(e) {
55
+ if (!A.value) {
56
+ w.value = !0;
57
+ return;
58
+ }
59
+ let t = k.value.length;
60
+ T.value = (T.value + e + t) % t, N();
37
61
  }
38
- function w(e) {
39
- v("update:modelValue", e.value), v("select", e.value), y.value = !1;
62
+ function F(e) {
63
+ if (!S.disabled) switch (e.key) {
64
+ case "ArrowDown":
65
+ e.preventDefault(), P(1);
66
+ break;
67
+ case "ArrowUp":
68
+ e.preventDefault(), P(-1);
69
+ break;
70
+ case "Home":
71
+ A.value && (e.preventDefault(), T.value = 0, N());
72
+ break;
73
+ case "End":
74
+ A.value && (e.preventDefault(), T.value = k.value.length - 1, N());
75
+ break;
76
+ case "Enter":
77
+ A.value && T.value >= 0 && (e.preventDefault(), M(k.value[T.value]));
78
+ break;
79
+ case "Escape":
80
+ A.value && (e.preventDefault(), w.value = !1, T.value = -1);
81
+ break;
82
+ }
40
83
  }
41
- return (t, c) => (s(), r("div", f, [i("input", {
42
- class: "k-ac__input",
84
+ return (t, o) => (c(), r("div", h, [i("input", {
85
+ class: s(["k-ac__input", `k-ac__input--${D.value}`]),
43
86
  value: a.modelValue,
44
87
  placeholder: a.placeholder,
45
88
  disabled: a.disabled,
46
- onInput: C,
47
- onFocus: c[0] ||= (e) => y.value = !0,
48
- onBlur: c[1] ||= (e) => y.value = !1
49
- }, null, 40, p), S.value ? (s(), r("div", m, [(s(!0), r(e, null, l(x.value, (e) => (s(), r("button", {
89
+ role: "combobox",
90
+ "aria-autocomplete": "list",
91
+ "aria-expanded": A.value,
92
+ "aria-controls": b,
93
+ "aria-activedescendant": A.value && T.value >= 0 ? x(T.value) : void 0,
94
+ onInput: j,
95
+ onKeydown: F,
96
+ onFocus: o[0] ||= (e) => w.value = !0,
97
+ onBlur: o[1] ||= (e) => w.value = !1
98
+ }, null, 42, g), A.value ? (c(), r("div", {
99
+ key: 0,
100
+ id: b,
101
+ ref_key: "listEl",
102
+ ref: E,
103
+ class: "k-ac__list k-menu-surface",
104
+ role: "listbox"
105
+ }, [(c(!0), r(e, null, u(k.value, (e, t) => (c(), r("button", {
106
+ id: x(t),
50
107
  key: e.value,
51
108
  type: "button",
52
- class: o(["k-ac__item", { "k-ac__item--active": e.value === a.modelValue }]),
53
- onMousedown: d((t) => w(e), ["prevent"])
54
- }, u(e.label), 43, h))), 128))])) : n("", !0)]));
109
+ role: "option",
110
+ "aria-selected": t === T.value,
111
+ class: s(["k-ac__item", { "k-ac__item--active": t === T.value }]),
112
+ onMousedown: m((t) => M(e), ["prevent"]),
113
+ onMousemove: (e) => T.value = t
114
+ }, d(e.label), 43, _))), 128))], 512)) : n("", !0)]));
55
115
  }
56
116
  });
57
117
  //#endregion
58
- export { g as default };
118
+ export { v as default };
@@ -2,6 +2,6 @@ import e from "../_virtual/_plugin-vue_export-helper.js";
2
2
  import t from "./KCalendar.vue_vue_type_script_setup_true_lang.js";
3
3
  /* empty css */
4
4
  //#region components/KCalendar.vue
5
- var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-67422762"]]);
5
+ var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-6a7d6984"]]);
6
6
  //#endregion
7
7
  export { n as default };
@@ -1,19 +1,39 @@
1
- import { Fragment as e, computed as t, createElementBlock as n, createElementVNode as r, createTextVNode as i, createVNode as a, defineComponent as o, normalizeClass as s, openBlock as c, ref as l, renderList as u, renderSlot as d, toDisplayString as f, unref as p } from "vue";
2
- import { ChevronLeft as m, ChevronRight as h } from "lucide-vue-next";
1
+ import { Fragment as e, computed as t, createElementBlock as n, createElementVNode as r, createTextVNode as i, createVNode as a, defineComponent as o, nextTick as s, normalizeClass as c, openBlock as l, ref as u, renderList as d, renderSlot as f, toDisplayString as p, unref as m, watch as h } from "vue";
2
+ import { ChevronLeft as g, ChevronRight as _ } from "lucide-vue-next";
3
3
  //#region components/KCalendar.vue?vue&type=script&setup=true&lang.ts
4
- var g = { class: "k-cal" }, _ = { class: "k-cal__head" }, v = { class: "k-cal__title" }, y = { class: "k-cal__nav" }, b = { class: "k-cal__grid k-cal__weekdays" }, x = { class: "k-cal__grid" }, S = ["onClick"], C = /* @__PURE__ */ o({
4
+ var v = { class: "k-cal" }, y = { class: "k-cal__head" }, b = { class: "k-cal__title" }, x = { class: "k-cal__nav" }, S = {
5
+ class: "k-cal__grid k-cal__weekdays",
6
+ "aria-hidden": "true"
7
+ }, C = [
8
+ "data-ts",
9
+ "tabindex",
10
+ "aria-selected",
11
+ "aria-label",
12
+ "onClick"
13
+ ], w = /* @__PURE__ */ o({
5
14
  __name: "KCalendar",
6
15
  props: { modelValue: { default: null } },
7
16
  emits: ["update:modelValue", "panelChange"],
8
- setup(o, { emit: C }) {
9
- let w = o, T = C;
10
- function E(e) {
17
+ setup(o, { emit: w }) {
18
+ let T = o, E = w;
19
+ function D(e) {
11
20
  return e == null ? null : e instanceof Date ? e : new Date(e);
12
21
  }
13
- let D = t(() => E(w.modelValue)), O = /* @__PURE__ */ new Date(), k = D.value ?? O, A = l({
14
- y: k.getFullYear(),
15
- m: k.getMonth()
16
- }), j = [
22
+ let O = t(() => D(T.modelValue)), k = /* @__PURE__ */ new Date();
23
+ function A(e) {
24
+ return new Date(e.getFullYear(), e.getMonth(), e.getDate());
25
+ }
26
+ let j = O.value ?? k, M = u({
27
+ y: j.getFullYear(),
28
+ m: j.getMonth()
29
+ }), N = u(A(j)), P = u();
30
+ h(O, (e) => {
31
+ e && (M.value = {
32
+ y: e.getFullYear(),
33
+ m: e.getMonth()
34
+ }, N.value = A(e));
35
+ });
36
+ let F = [
17
37
  "一",
18
38
  "二",
19
39
  "三",
@@ -21,58 +41,131 @@ var g = { class: "k-cal" }, _ = { class: "k-cal__head" }, v = { class: "k-cal__t
21
41
  "五",
22
42
  "六",
23
43
  "日"
24
- ], M = t(() => `${A.value.y} 年 ${A.value.m + 1} 月`), N = t(() => {
25
- let { y: e, m: t } = A.value, n = (new Date(e, t, 1).getDay() + 6) % 7, r = new Date(e, t, 1 - n);
44
+ ], I = t(() => `${M.value.y} 年 ${M.value.m + 1} 月`), L = t(() => {
45
+ let { y: e, m: t } = M.value, n = (new Date(e, t, 1).getDay() + 6) % 7, r = new Date(e, t, 1 - n);
26
46
  return Array.from({ length: 42 }, (e, t) => {
27
47
  let n = new Date(r);
28
48
  return n.setDate(r.getDate() + t), n;
29
49
  });
30
- });
31
- function P(e, t) {
50
+ }), R = t(() => Array.from({ length: 6 }, (e, t) => L.value.slice(t * 7, t * 7 + 7)));
51
+ function z(e) {
52
+ return `${e.getFullYear()}年${e.getMonth() + 1}月${e.getDate()}日`;
53
+ }
54
+ function B(e, t) {
55
+ let n = e.getDate();
56
+ e.setDate(1), e.setMonth(e.getMonth() + t);
57
+ let r = new Date(e.getFullYear(), e.getMonth() + 1, 0).getDate();
58
+ e.setDate(Math.min(n, r));
59
+ }
60
+ function V(e, t) {
32
61
  return !!t && e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate();
33
62
  }
34
- function F(e) {
35
- let { y: t, m: n } = A.value;
36
- n += e, n < 0 ? (--t, n = 11) : n > 11 && (t += 1, n = 0), A.value = {
63
+ function H(e) {
64
+ let { y: t, m: n } = M.value;
65
+ n += e, n < 0 ? (--t, n = 11) : n > 11 && (t += 1, n = 0), M.value = {
37
66
  y: t,
38
67
  m: n
39
- }, T("panelChange", {
68
+ }, N.value = new Date(t, n, 1), E("panelChange", {
40
69
  year: t,
41
70
  month: n + 1
42
71
  });
43
72
  }
44
- function I(e) {
45
- T("update:modelValue", e.getTime());
73
+ function U(e) {
74
+ E("update:modelValue", e.getTime());
75
+ }
76
+ function W() {
77
+ s(() => {
78
+ P.value?.querySelector(`[data-ts="${N.value.getTime()}"]`)?.focus();
79
+ });
80
+ }
81
+ function G(e) {
82
+ N.value = e, (e.getFullYear() !== M.value.y || e.getMonth() !== M.value.m) && (M.value = {
83
+ y: e.getFullYear(),
84
+ m: e.getMonth()
85
+ }, E("panelChange", {
86
+ year: e.getFullYear(),
87
+ month: e.getMonth() + 1
88
+ })), W();
89
+ }
90
+ function K(e) {
91
+ let t = new Date(N.value), n = (t.getDay() + 6) % 7;
92
+ switch (e.key) {
93
+ case "ArrowLeft":
94
+ t.setDate(t.getDate() - 1);
95
+ break;
96
+ case "ArrowRight":
97
+ t.setDate(t.getDate() + 1);
98
+ break;
99
+ case "ArrowUp":
100
+ t.setDate(t.getDate() - 7);
101
+ break;
102
+ case "ArrowDown":
103
+ t.setDate(t.getDate() + 7);
104
+ break;
105
+ case "Home":
106
+ t.setDate(t.getDate() - n);
107
+ break;
108
+ case "End":
109
+ t.setDate(t.getDate() + (6 - n));
110
+ break;
111
+ case "PageUp":
112
+ B(t, -1);
113
+ break;
114
+ case "PageDown":
115
+ B(t, 1);
116
+ break;
117
+ case "Enter":
118
+ case " ":
119
+ e.preventDefault(), U(N.value);
120
+ return;
121
+ default: return;
122
+ }
123
+ e.preventDefault(), G(t);
46
124
  }
47
- return (t, o) => (c(), n("div", g, [
48
- r("div", _, [r("span", v, f(M.value), 1), r("div", y, [r("button", {
125
+ return (t, o) => (l(), n("div", v, [
126
+ r("div", y, [r("span", b, p(I.value), 1), r("div", x, [r("button", {
49
127
  type: "button",
50
- onClick: o[0] ||= (e) => F(-1),
128
+ onClick: o[0] ||= (e) => H(-1),
51
129
  "aria-label": "上个月"
52
- }, [a(p(m), { size: 16 })]), r("button", {
130
+ }, [a(m(g), { size: 16 })]), r("button", {
53
131
  type: "button",
54
- onClick: o[1] ||= (e) => F(1),
132
+ onClick: o[1] ||= (e) => H(1),
55
133
  "aria-label": "下个月"
56
- }, [a(p(h), { size: 16 })])])]),
57
- r("div", b, [(c(), n(e, null, u(j, (e) => r("span", {
134
+ }, [a(m(_), { size: 16 })])])]),
135
+ r("div", S, [(l(), n(e, null, d(F, (e) => r("span", {
58
136
  key: e,
59
137
  class: "k-cal__weekday"
60
- }, f(e), 1)), 64))]),
61
- r("div", x, [(c(!0), n(e, null, u(N.value, (e, r) => (c(), n("button", {
62
- key: r,
138
+ }, p(e), 1)), 64))]),
139
+ r("div", {
140
+ ref_key: "gridEl",
141
+ ref: P,
142
+ class: "k-cal__grid",
143
+ role: "grid",
144
+ onKeydown: K
145
+ }, [(l(!0), n(e, null, d(R.value, (r, a) => (l(), n("div", {
146
+ key: a,
147
+ role: "row",
148
+ class: "k-cal__row"
149
+ }, [(l(!0), n(e, null, d(r, (e) => (l(), n("button", {
150
+ key: e.getTime(),
63
151
  type: "button",
64
- class: s(["k-cal__cell", {
65
- "k-cal__cell--muted": e.getMonth() !== A.value.m,
66
- "k-cal__cell--today": P(e, p(O)),
67
- "k-cal__cell--selected": P(e, D.value)
152
+ role: "gridcell",
153
+ class: c(["k-cal__cell", {
154
+ "k-cal__cell--muted": e.getMonth() !== M.value.m,
155
+ "k-cal__cell--today": V(e, m(k)),
156
+ "k-cal__cell--selected": V(e, O.value)
68
157
  }]),
69
- onClick: (t) => I(e)
70
- }, [d(t.$slots, "default", {
158
+ "data-ts": e.getTime(),
159
+ tabindex: V(e, N.value) ? 0 : -1,
160
+ "aria-selected": V(e, O.value),
161
+ "aria-label": z(e),
162
+ onClick: (t) => U(e)
163
+ }, [f(t.$slots, "default", {
71
164
  date: e,
72
- isCurrentMonth: e.getMonth() === A.value.m
73
- }, () => [i(f(e.getDate()), 1)], !0)], 10, S))), 128))])
165
+ isCurrentMonth: e.getMonth() === M.value.m
166
+ }, () => [i(p(e.getDate()), 1)], !0)], 10, C))), 128))]))), 128))], 544)
74
167
  ]));
75
168
  }
76
169
  });
77
170
  //#endregion
78
- export { C as default };
171
+ export { w as default };
@@ -13,12 +13,14 @@ type __VLS_Props = {
13
13
  separator?: string;
14
14
  /** 允许选中非叶子节点 */
15
15
  changeOnSelect?: boolean;
16
+ size?: 'tiny' | 'xs' | 'small' | 'sm' | 'medium' | 'md' | 'large' | 'lg';
16
17
  };
17
18
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
18
19
  "update:modelValue": (v: string | number | null) => any;
19
20
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
20
21
  "onUpdate:modelValue"?: ((v: string | number | null) => any) | undefined;
21
22
  }>, {
23
+ size: "tiny" | "xs" | "small" | "sm" | "medium" | "md" | "large" | "lg";
22
24
  disabled: boolean;
23
25
  placeholder: string;
24
26
  clearable: boolean;
@@ -3,6 +3,6 @@ import t from "./KCascader.vue_vue_type_script_setup_true_lang.js";
3
3
  /* empty css */
4
4
  /* empty css */
5
5
  //#region components/KCascader.vue
6
- var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-04959f22"]]);
6
+ var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-5e6a0c6e"]]);
7
7
  //#endregion
8
8
  export { n as default };
@@ -21,41 +21,42 @@ var C = ["disabled"], w = { class: "k-casc-field__text" }, T = ["disabled", "onC
21
21
  changeOnSelect: {
22
22
  type: Boolean,
23
23
  default: !1
24
- }
24
+ },
25
+ size: { default: "md" }
25
26
  },
26
27
  emits: ["update:modelValue"],
27
28
  setup(s, { emit: D }) {
28
- let O = s, k = D, A = d(!1), j = d([]);
29
- function M(e, t, n = []) {
29
+ let O = s, k = D, A = d(!1), j = d([]), M = t(() => O.size === "tiny" || O.size === "xs" || O.size === "small" || O.size === "sm" ? "sm" : O.size === "large" || O.size === "lg" ? "lg" : "md");
30
+ function N(e, t, n = []) {
30
31
  for (let r of e) {
31
32
  let e = [...n, r];
32
33
  if (r.value === t) return e;
33
34
  if (r.children) {
34
- let n = M(r.children, t, e);
35
+ let n = N(r.children, t, e);
35
36
  if (n) return n;
36
37
  }
37
38
  }
38
39
  return null;
39
40
  }
40
- let N = t(() => O.modelValue == null ? [] : M(O.options, O.modelValue) ?? []), P = t(() => N.value.map((e) => e.label).join(O.separator));
41
+ let P = t(() => O.modelValue == null ? [] : N(O.options, O.modelValue) ?? []), F = t(() => P.value.map((e) => e.label).join(O.separator));
41
42
  h(A, (e) => {
42
- e && (j.value = N.value.slice());
43
+ e && (j.value = P.value.slice());
43
44
  });
44
- let F = t(() => {
45
+ let I = t(() => {
45
46
  let e = [O.options];
46
47
  for (let t of j.value) if (t.children?.length) e.push(t.children);
47
48
  else break;
48
49
  return e;
49
50
  });
50
- function I(e, t) {
51
+ function L(e, t) {
51
52
  return j.value[e]?.value === t.value;
52
53
  }
53
- function L(e, t) {
54
+ function R(e, t) {
54
55
  if (t.disabled) return;
55
56
  let n = j.value.slice(0, e);
56
57
  n[e] = t, j.value = n, t.children?.length ? O.changeOnSelect && k("update:modelValue", t.value) : (k("update:modelValue", t.value), A.value = !1);
57
58
  }
58
- function R(e) {
59
+ function z(e) {
59
60
  e.stopPropagation(), k("update:modelValue", null);
60
61
  }
61
62
  return (t, d) => (u(), n(m(x), {
@@ -68,16 +69,16 @@ var C = ["disabled"], w = { class: "k-casc-field__text" }, T = ["disabled", "onC
68
69
  }, {
69
70
  default: g(() => [a("button", c(t.$attrs, {
70
71
  type: "button",
71
- class: ["k-casc-field", {
72
+ class: ["k-casc-field", [`k-casc-field--${M.value}`, {
72
73
  "k-casc-field--disabled": s.disabled,
73
- "k-casc-field--placeholder": !P.value
74
- }],
74
+ "k-casc-field--placeholder": !F.value
75
+ }]],
75
76
  disabled: s.disabled
76
- }), [a("span", w, p(P.value || s.placeholder), 1), s.clearable && P.value && !s.disabled ? (u(), n(m(v), {
77
+ }), [a("span", w, p(F.value || s.placeholder), 1), s.clearable && F.value && !s.disabled ? (u(), n(m(v), {
77
78
  key: 0,
78
79
  size: 14,
79
80
  class: "k-casc-field__clear",
80
- onClick: R
81
+ onClick: z
81
82
  })) : r("", !0)], 16, C)]),
82
83
  _: 1
83
84
  }, 8, ["disabled"]), o(m(b), null, {
@@ -86,18 +87,18 @@ var C = ["disabled"], w = { class: "k-casc-field__text" }, T = ["disabled", "onC
86
87
  "side-offset": 6,
87
88
  align: "start"
88
89
  }, {
89
- default: g(() => [(u(!0), i(e, null, f(F.value, (t, o) => (u(), i("div", {
90
+ default: g(() => [(u(!0), i(e, null, f(I.value, (t, o) => (u(), i("div", {
90
91
  key: o,
91
92
  class: "k-casc-col"
92
93
  }, [(u(!0), i(e, null, f(t, (e) => (u(), i("button", {
93
94
  key: e.value,
94
95
  type: "button",
95
96
  class: l(["k-casc-item", {
96
- "k-casc-item--active": I(o, e),
97
+ "k-casc-item--active": L(o, e),
97
98
  "k-casc-item--disabled": e.disabled
98
99
  }]),
99
100
  disabled: e.disabled,
100
- onClick: (t) => L(o, e)
101
+ onClick: (t) => R(o, e)
101
102
  }, [a("span", E, p(e.label), 1), e.children?.length ? (u(), n(m(_), {
102
103
  key: 0,
103
104
  size: 14,
@@ -1,12 +1,15 @@
1
1
  type __VLS_Props = {
2
2
  modelValue?: boolean;
3
+ /** 半选态: 视觉上显示为减号, 优先于 modelValue (常用于"全选"框的部分选中) */
4
+ indeterminate?: boolean;
3
5
  value?: string | number;
4
6
  disabled?: boolean;
5
7
  label?: string;
8
+ size?: 'small' | 'sm' | 'medium' | 'md' | 'large' | 'lg';
6
9
  };
7
- declare var __VLS_20: {};
10
+ declare var __VLS_25: {};
8
11
  type __VLS_Slots = {} & {
9
- default?: (props: typeof __VLS_20) => any;
12
+ default?: (props: typeof __VLS_25) => any;
10
13
  };
11
14
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
12
15
  "update:modelValue": (v: boolean) => any;
@@ -15,6 +18,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
15
18
  }>, {
16
19
  disabled: boolean;
17
20
  modelValue: boolean;
21
+ indeterminate: boolean;
18
22
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
23
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
20
24
  declare const _default: typeof __VLS_export;
@@ -2,6 +2,6 @@ import e from "../_virtual/_plugin-vue_export-helper.js";
2
2
  import t from "./KCheckbox.vue_vue_type_script_setup_true_lang.js";
3
3
  /* empty css */
4
4
  //#region components/KCheckbox.vue
5
- var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-17c1bf53"]]);
5
+ var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-f571e0fd"]]);
6
6
  //#endregion
7
7
  export { n as default };
@@ -1,39 +1,59 @@
1
- import { computed as e, createCommentVNode as t, createElementBlock as n, createTextVNode as r, createVNode as i, defineComponent as a, normalizeClass as o, openBlock as s, renderSlot as c, toDisplayString as l, unref as u, withCtx as d } from "vue";
2
- import { Check as f } from "lucide-vue-next";
3
- import { CheckboxIndicator as p, CheckboxRoot as m } from "reka-ui";
1
+ import { CHECKBOX_GROUP_KEY as e } from "./checkbox-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, 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 { Check as _, Minus as v } from "lucide-vue-next";
4
+ import { CheckboxIndicator as y, CheckboxRoot as b } from "reka-ui";
4
5
  //#region components/KCheckbox.vue?vue&type=script&setup=true&lang.ts
5
- var h = {
6
+ var x = {
6
7
  key: 0,
7
8
  class: "k-cb__label"
8
- }, g = /* @__PURE__ */ a({
9
+ }, S = /* @__PURE__ */ s({
9
10
  __name: "KCheckbox",
10
11
  props: {
11
12
  modelValue: {
12
13
  type: Boolean,
13
14
  default: !1
14
15
  },
16
+ indeterminate: {
17
+ type: Boolean,
18
+ default: !1
19
+ },
15
20
  value: {},
16
21
  disabled: {
17
22
  type: Boolean,
18
23
  default: !1
19
24
  },
20
- label: {}
25
+ label: {},
26
+ size: {}
21
27
  },
22
28
  emits: ["update:modelValue"],
23
- setup(a) {
24
- let g = a, _ = e(() => g.value === void 0 ? void 0 : String(g.value));
25
- return (e, g) => (s(), n("label", { class: o(["k-cb-wrap", { "k-cb-wrap--disabled": a.disabled }]) }, [i(u(m), {
26
- "model-value": a.modelValue,
27
- value: _.value,
28
- disabled: a.disabled,
29
+ setup(s) {
30
+ let S = s, C = t(() => S.indeterminate ? "indeterminate" : S.modelValue), w = c(e, null), T = t(() => S.value === void 0 ? void 0 : String(S.value));
31
+ h(() => S.value, (e, t) => {
32
+ w && (t !== void 0 && t !== e && w.unregister(t), e !== void 0 && w.register(e));
33
+ }, { immediate: !0 }), u(() => {
34
+ w && S.value !== void 0 && w.unregister(S.value);
35
+ });
36
+ let E = t(() => S.size ?? w?.size?.value ?? "md"), D = t(() => {
37
+ let e = E.value;
38
+ return e === "small" || e === "sm" ? "sm" : e === "large" || e === "lg" ? "lg" : "md";
39
+ });
40
+ return (e, t) => (d(), i("label", { class: l(["k-cb-wrap", [`k-cb-wrap--${D.value}`, { "k-cb-wrap--disabled": s.disabled }]]) }, [o(m(b), {
41
+ "model-value": C.value,
42
+ value: T.value,
43
+ disabled: s.disabled,
29
44
  class: "k-cb",
30
- "onUpdate:modelValue": g[0] ||= (t) => e.$emit("update:modelValue", !!t)
45
+ "onUpdate:modelValue": t[0] ||= (t) => e.$emit("update:modelValue", !!t)
31
46
  }, {
32
- default: d(() => [i(u(p), { class: "k-cb__indicator" }, {
33
- default: d(() => [i(u(f), {
47
+ default: g(() => [o(m(y), { class: "k-cb__indicator" }, {
48
+ default: g(() => [s.indeterminate ? (d(), n(m(v), {
49
+ key: 0,
50
+ size: 11,
51
+ "stroke-width": 3
52
+ })) : (d(), n(m(_), {
53
+ key: 1,
34
54
  size: 11,
35
55
  "stroke-width": 3
36
- })]),
56
+ }))]),
37
57
  _: 1
38
58
  })]),
39
59
  _: 1
@@ -41,8 +61,8 @@ var h = {
41
61
  "model-value",
42
62
  "value",
43
63
  "disabled"
44
- ]), a.label || e.$slots.default ? (s(), n("span", h, [c(e.$slots, "default", {}, () => [r(l(a.label), 1)], !0)])) : t("", !0)], 2));
64
+ ]), s.label || e.$slots.default ? (d(), i("span", x, [f(e.$slots, "default", {}, () => [a(p(s.label), 1)], !0)])) : r("", !0)], 2));
45
65
  }
46
66
  });
47
67
  //#endregion
48
- export { g as default };
68
+ export { S as default };
@@ -3,6 +3,8 @@ type __VLS_Props = {
3
3
  modelValue?: Val[];
4
4
  disabled?: boolean;
5
5
  direction?: 'horizontal' | 'vertical';
6
+ /** 组级尺寸,下发给未单独设置 size 的 KCheckbox */
7
+ size?: 'small' | 'sm' | 'medium' | 'md' | 'large' | 'lg';
6
8
  };
7
9
  declare var __VLS_10: {};
8
10
  type __VLS_Slots = {} & {
@@ -2,6 +2,6 @@ import e from "../_virtual/_plugin-vue_export-helper.js";
2
2
  import t from "./KCheckboxGroup.vue_vue_type_script_setup_true_lang.js";
3
3
  /* empty css */
4
4
  //#region components/KCheckboxGroup.vue
5
- var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-0188db2b"]]);
5
+ var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-6f7dd148"]]);
6
6
  //#endregion
7
7
  export { n as default };