@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
@@ -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-1578d394"]]);
6
+ var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-5e6a0c6e"]]);
7
7
  //#endregion
8
8
  export { n as default };
@@ -1,8 +1,9 @@
1
- import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createVNode as o, defineComponent as s, normalizeClass as c, openBlock as l, ref as u, renderList as d, toDisplayString as f, unref as p, watch as m, withCtx as h } from "vue";
2
- import { ChevronRight as g, X as _ } from "lucide-vue-next";
3
- import { PopoverContent as v, PopoverPortal as y, PopoverRoot as b, PopoverTrigger as x } from "reka-ui";
1
+ import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createVNode as o, defineComponent as s, mergeProps as c, normalizeClass as l, openBlock as u, ref as d, renderList as f, toDisplayString as p, unref as m, watch as h, withCtx as g } from "vue";
2
+ import { ChevronRight as _, X as v } from "lucide-vue-next";
3
+ import { PopoverContent as y, PopoverPortal as b, PopoverRoot as x, PopoverTrigger as S } from "reka-ui";
4
4
  //#region components/KCascader.vue?vue&type=script&setup=true&lang.ts
5
- var S = ["disabled"], C = { class: "k-casc-field__text" }, w = ["disabled", "onClick"], T = { class: "k-casc-item__label" }, E = /* @__PURE__ */ s({
5
+ var C = ["disabled"], w = { class: "k-casc-field__text" }, T = ["disabled", "onClick"], E = { class: "k-casc-item__label" }, D = /* @__PURE__ */ s({
6
+ inheritAttrs: !1,
6
7
  __name: "KCascader",
7
8
  props: {
8
9
  modelValue: {},
@@ -20,88 +21,89 @@ var S = ["disabled"], C = { class: "k-casc-field__text" }, w = ["disabled", "onC
20
21
  changeOnSelect: {
21
22
  type: Boolean,
22
23
  default: !1
23
- }
24
+ },
25
+ size: { default: "md" }
24
26
  },
25
27
  emits: ["update:modelValue"],
26
- setup(s, { emit: E }) {
27
- let D = s, O = E, k = u(!1), A = u([]);
28
- function j(e, t, n = []) {
28
+ setup(s, { emit: D }) {
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 = []) {
29
31
  for (let r of e) {
30
32
  let e = [...n, r];
31
33
  if (r.value === t) return e;
32
34
  if (r.children) {
33
- let n = j(r.children, t, e);
35
+ let n = N(r.children, t, e);
34
36
  if (n) return n;
35
37
  }
36
38
  }
37
39
  return null;
38
40
  }
39
- let M = t(() => D.modelValue == null ? [] : j(D.options, D.modelValue) ?? []), N = t(() => M.value.map((e) => e.label).join(D.separator));
40
- m(k, (e) => {
41
- e && (A.value = M.value.slice());
41
+ let P = t(() => O.modelValue == null ? [] : N(O.options, O.modelValue) ?? []), F = t(() => P.value.map((e) => e.label).join(O.separator));
42
+ h(A, (e) => {
43
+ e && (j.value = P.value.slice());
42
44
  });
43
- let P = t(() => {
44
- let e = [D.options];
45
- for (let t of A.value) if (t.children?.length) e.push(t.children);
45
+ let I = t(() => {
46
+ let e = [O.options];
47
+ for (let t of j.value) if (t.children?.length) e.push(t.children);
46
48
  else break;
47
49
  return e;
48
50
  });
49
- function F(e, t) {
50
- return A.value[e]?.value === t.value;
51
+ function L(e, t) {
52
+ return j.value[e]?.value === t.value;
51
53
  }
52
- function I(e, t) {
54
+ function R(e, t) {
53
55
  if (t.disabled) return;
54
- let n = A.value.slice(0, e);
55
- n[e] = t, A.value = n, t.children?.length ? D.changeOnSelect && O("update:modelValue", t.value) : (O("update:modelValue", t.value), k.value = !1);
56
+ let n = j.value.slice(0, e);
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);
56
58
  }
57
- function L(e) {
58
- e.stopPropagation(), O("update:modelValue", null);
59
+ function z(e) {
60
+ e.stopPropagation(), k("update:modelValue", null);
59
61
  }
60
- return (t, u) => (l(), n(p(b), {
61
- open: k.value,
62
- "onUpdate:open": u[0] ||= (e) => k.value = e
62
+ return (t, d) => (u(), n(m(x), {
63
+ open: A.value,
64
+ "onUpdate:open": d[0] ||= (e) => A.value = e
63
65
  }, {
64
- default: h(() => [o(p(x), {
66
+ default: g(() => [o(m(S), {
65
67
  "as-child": "",
66
68
  disabled: s.disabled
67
69
  }, {
68
- default: h(() => [a("button", {
70
+ default: g(() => [a("button", c(t.$attrs, {
69
71
  type: "button",
70
- class: c(["k-casc-field", {
72
+ class: ["k-casc-field", [`k-casc-field--${M.value}`, {
71
73
  "k-casc-field--disabled": s.disabled,
72
- "k-casc-field--placeholder": !N.value
73
- }]),
74
+ "k-casc-field--placeholder": !F.value
75
+ }]],
74
76
  disabled: s.disabled
75
- }, [a("span", C, f(N.value || s.placeholder), 1), s.clearable && N.value && !s.disabled ? (l(), n(p(_), {
77
+ }), [a("span", w, p(F.value || s.placeholder), 1), s.clearable && F.value && !s.disabled ? (u(), n(m(v), {
76
78
  key: 0,
77
79
  size: 14,
78
80
  class: "k-casc-field__clear",
79
- onClick: L
80
- })) : r("", !0)], 10, S)]),
81
+ onClick: z
82
+ })) : r("", !0)], 16, C)]),
81
83
  _: 1
82
- }, 8, ["disabled"]), o(p(y), null, {
83
- default: h(() => [o(p(v), {
84
+ }, 8, ["disabled"]), o(m(b), null, {
85
+ default: g(() => [o(m(y), {
84
86
  class: "k-menu-surface k-casc-panel",
85
87
  "side-offset": 6,
86
88
  align: "start"
87
89
  }, {
88
- default: h(() => [(l(!0), i(e, null, d(P.value, (t, o) => (l(), i("div", {
90
+ default: g(() => [(u(!0), i(e, null, f(I.value, (t, o) => (u(), i("div", {
89
91
  key: o,
90
92
  class: "k-casc-col"
91
- }, [(l(!0), i(e, null, d(t, (e) => (l(), i("button", {
93
+ }, [(u(!0), i(e, null, f(t, (e) => (u(), i("button", {
92
94
  key: e.value,
93
95
  type: "button",
94
- class: c(["k-casc-item", {
95
- "k-casc-item--active": F(o, e),
96
+ class: l(["k-casc-item", {
97
+ "k-casc-item--active": L(o, e),
96
98
  "k-casc-item--disabled": e.disabled
97
99
  }]),
98
100
  disabled: e.disabled,
99
- onClick: (t) => I(o, e)
100
- }, [a("span", T, f(e.label), 1), e.children?.length ? (l(), n(p(g), {
101
+ onClick: (t) => R(o, e)
102
+ }, [a("span", E, p(e.label), 1), e.children?.length ? (u(), n(m(_), {
101
103
  key: 0,
102
104
  size: 14,
103
105
  class: "k-casc-item__arrow"
104
- })) : r("", !0)], 10, w))), 128))]))), 128))]),
106
+ })) : r("", !0)], 10, T))), 128))]))), 128))]),
105
107
  _: 1
106
108
  })]),
107
109
  _: 1
@@ -111,4 +113,4 @@ var S = ["disabled"], C = { class: "k-casc-field__text" }, w = ["disabled", "onC
111
113
  }
112
114
  });
113
115
  //#endregion
114
- export { E as default };
116
+ export { D as default };
@@ -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 };