@guoyg578/k-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 (139) hide show
  1. package/README.md +66 -22
  2. package/dist/components/KAlert.vue.d.ts +1 -1
  3. package/dist/components/{KAlert.js → KAlert.vue.js} +2 -2
  4. package/dist/components/KAlert.vue_vue_type_script_setup_true_lang.js +35 -32
  5. package/dist/components/{KAvatar.js → KAvatar.vue.js} +1 -1
  6. package/dist/components/{KAvatarGroup.js → KAvatarGroup.vue.js} +1 -1
  7. package/dist/components/KBreadcrumb.vue.d.ts +30 -1
  8. package/dist/components/{KBreadcrumb.js → KBreadcrumb.vue.js} +2 -2
  9. package/dist/components/KBreadcrumb.vue_vue_type_script_setup_true_lang.js +36 -21
  10. package/dist/components/KButton.vue.d.ts +17 -2
  11. package/dist/components/{KButton.js → KButton.vue.js} +2 -2
  12. package/dist/components/KButton.vue_vue_type_script_setup_true_lang.js +51 -17
  13. package/dist/components/KCard.vue.d.ts +5 -3
  14. package/dist/components/{KCard.js → KCard.vue.js} +2 -2
  15. package/dist/components/KCard.vue_vue_type_script_setup_true_lang.js +2 -2
  16. package/dist/components/{KCarousel.js → KCarousel.vue.js} +1 -1
  17. package/dist/components/{KCheckbox.js → KCheckbox.vue.js} +1 -1
  18. package/dist/components/{KCheckboxGroup.js → KCheckboxGroup.vue.js} +1 -1
  19. package/dist/components/KColorPicker.vue.d.ts +40 -0
  20. package/dist/components/KColorPicker.vue.js +7 -0
  21. package/dist/components/KColorPicker.vue_vue_type_script_setup_true_lang.js +96 -0
  22. package/dist/components/{KCombobox.js → KCombobox.vue.js} +2 -2
  23. package/dist/components/{KCommandPalette.js → KCommandPalette.vue.js} +1 -1
  24. package/dist/components/KConfigProvider.vue.d.ts +26 -0
  25. package/dist/components/KConfigProvider.vue.js +5 -0
  26. package/dist/components/KConfigProvider.vue_vue_type_script_setup_true_lang.js +17 -0
  27. package/dist/components/{KConfirmDialog.js → KConfirmDialog.vue.js} +1 -1
  28. package/dist/components/KDataTable.vue.d.ts +33 -10
  29. package/dist/components/{KDataTable.js → KDataTable.vue.js} +2 -2
  30. package/dist/components/KDataTable.vue_vue_type_script_setup_true_lang.js +128 -30
  31. package/dist/components/{KDatePicker.js → KDatePicker.vue.js} +1 -1
  32. package/dist/components/KDatePicker.vue_vue_type_script_setup_true_lang.js +1 -1
  33. package/dist/components/KDescriptions.vue.d.ts +30 -0
  34. package/dist/components/KDescriptions.vue.js +6 -0
  35. package/dist/components/KDescriptions.vue_vue_type_script_setup_true_lang.js +30 -0
  36. package/dist/components/KDescriptionsItem.vue.d.ts +17 -0
  37. package/dist/components/KDescriptionsItem.vue.js +5 -0
  38. package/dist/components/KDescriptionsItem.vue_vue_type_script_setup_true_lang.js +17 -0
  39. package/dist/components/KDialog.vue.d.ts +1 -0
  40. package/dist/components/{KDialog.js → KDialog.vue.js} +2 -2
  41. package/dist/components/KDialog.vue_vue_type_script_setup_true_lang.js +45 -38
  42. package/dist/components/{KDiff.js → KDiff.vue.js} +1 -1
  43. package/dist/components/KDrawer.vue.d.ts +7 -3
  44. package/dist/components/{KDrawer.js → KDrawer.vue.js} +2 -2
  45. package/dist/components/KDrawer.vue_vue_type_script_setup_true_lang.js +41 -29
  46. package/dist/components/KDropdown.vue.d.ts +7 -4
  47. package/dist/components/{KDropdown.js → KDropdown.vue.js} +2 -2
  48. package/dist/components/KDropdown.vue_vue_type_script_setup_true_lang.js +40 -38
  49. package/dist/components/KEmpty.vue.d.ts +8 -4
  50. package/dist/components/KEmpty.vue_vue_type_script_setup_true_lang.js +17 -14
  51. package/dist/components/KForm.vue.d.ts +12 -6
  52. package/dist/components/{KForm.js → KForm.vue.js} +2 -2
  53. package/dist/components/KForm.vue_vue_type_script_setup_true_lang.js +31 -15
  54. package/dist/components/KFormField.vue.d.ts +3 -2
  55. package/dist/components/{KFormField.js → KFormField.vue.js} +2 -2
  56. package/dist/components/KFormField.vue_vue_type_script_setup_true_lang.js +41 -28
  57. package/dist/components/KIcon.vue.d.ts +22 -0
  58. package/dist/components/KIcon.vue.js +7 -0
  59. package/dist/components/KIcon.vue_vue_type_script_setup_true_lang.js +31 -0
  60. package/dist/components/KImage.vue.d.ts +3 -3
  61. package/dist/components/{KImage.js → KImage.vue.js} +1 -1
  62. package/dist/components/KImage.vue_vue_type_script_setup_true_lang.js +1 -1
  63. package/dist/components/{KImageViewer.js → KImageViewer.vue.js} +1 -1
  64. package/dist/components/KInput.vue.d.ts +11 -5
  65. package/dist/components/{KInput.js → KInput.vue.js} +2 -2
  66. package/dist/components/KInput.vue_vue_type_script_setup_true_lang.js +62 -38
  67. package/dist/components/KInputNumber.vue.d.ts +18 -4
  68. package/dist/components/{KInputNumber.js → KInputNumber.vue.js} +2 -2
  69. package/dist/components/KInputNumber.vue_vue_type_script_setup_true_lang.js +80 -62
  70. package/dist/components/{KLoadingOverlay.js → KLoadingOverlay.vue.js} +1 -1
  71. package/dist/components/KMessage.js +1 -1
  72. package/dist/components/{KMessageContainer.js → KMessageContainer.vue.js} +1 -1
  73. package/dist/components/KNotification.d.ts +36 -0
  74. package/dist/components/KNotification.js +55 -0
  75. package/dist/components/KNotificationContainer.vue.d.ts +20 -0
  76. package/dist/components/KNotificationContainer.vue.js +7 -0
  77. package/dist/components/KNotificationContainer.vue_vue_type_script_setup_true_lang.js +63 -0
  78. package/dist/components/KNotificationProvider.vue.d.ts +13 -0
  79. package/dist/components/KNotificationProvider.vue.js +10 -0
  80. package/dist/components/{KPagination.js → KPagination.vue.js} +1 -1
  81. package/dist/components/KPopconfirm.vue.d.ts +46 -0
  82. package/dist/components/KPopconfirm.vue.js +6 -0
  83. package/dist/components/KPopconfirm.vue_vue_type_script_setup_true_lang.js +81 -0
  84. package/dist/components/{KPopover.js → KPopover.vue.js} +1 -1
  85. package/dist/components/KProgress.vue.d.ts +3 -2
  86. package/dist/components/{KProgress.js → KProgress.vue.js} +2 -2
  87. package/dist/components/KProgress.vue_vue_type_script_setup_true_lang.js +23 -20
  88. package/dist/components/{KRadio.js → KRadio.vue.js} +1 -1
  89. package/dist/components/{KRadioGroup.js → KRadioGroup.vue.js} +1 -1
  90. package/dist/components/{KResizablePanel.js → KResizablePanel.vue.js} +1 -1
  91. package/dist/components/{KResult.js → KResult.vue.js} +1 -1
  92. package/dist/components/KSelect.vue.d.ts +10 -3
  93. package/dist/components/{KSelect.js → KSelect.vue.js} +4 -4
  94. package/dist/components/KSelect.vue_vue_type_script_setup_true_lang.js +89 -48
  95. package/dist/components/{KSkeleton.js → KSkeleton.vue.js} +1 -1
  96. package/dist/components/KSlider.vue.d.ts +24 -0
  97. package/dist/components/KSlider.vue.js +7 -0
  98. package/dist/components/KSlider.vue_vue_type_script_setup_true_lang.js +82 -0
  99. package/dist/components/KSpin.vue.d.ts +23 -0
  100. package/dist/components/KSpin.vue.js +7 -0
  101. package/dist/components/KSpin.vue_vue_type_script_setup_true_lang.js +35 -0
  102. package/dist/components/KSteps.vue.d.ts +1 -1
  103. package/dist/components/{KSteps.js → KSteps.vue.js} +1 -1
  104. package/dist/components/KSwitch.vue.d.ts +2 -2
  105. package/dist/components/{KSwitch.js → KSwitch.vue.js} +2 -2
  106. package/dist/components/KSwitch.vue_vue_type_script_setup_true_lang.js +12 -11
  107. package/dist/components/KTabs.vue.d.ts +10 -5
  108. package/dist/components/{KTabs.js → KTabs.vue.js} +2 -2
  109. package/dist/components/KTabs.vue_vue_type_script_setup_true_lang.js +31 -21
  110. package/dist/components/KTag.vue.d.ts +3 -3
  111. package/dist/components/{KTag.js → KTag.vue.js} +2 -2
  112. package/dist/components/KTag.vue_vue_type_script_setup_true_lang.js +14 -13
  113. package/dist/components/KTextarea.vue.d.ts +17 -2
  114. package/dist/components/{KTextarea.js → KTextarea.vue.js} +2 -2
  115. package/dist/components/KTextarea.vue_vue_type_script_setup_true_lang.js +51 -22
  116. package/dist/components/{KThemeToggleButton.js → KThemeToggleButton.vue.js} +1 -1
  117. package/dist/components/{KTooltip.js → KTooltip.vue.js} +1 -1
  118. package/dist/components/{KTreeNode.js → KTreeNode.vue.js} +1 -1
  119. package/dist/components/{KTreeView.js → KTreeView.vue.js} +1 -1
  120. package/dist/components/KTreeView.vue_vue_type_script_setup_true_lang.js +1 -1
  121. package/dist/components/KUpload.vue.d.ts +100 -4
  122. package/dist/components/{KUpload.js → KUpload.vue.js} +2 -2
  123. package/dist/components/KUpload.vue_vue_type_script_setup_true_lang.js +189 -94
  124. package/dist/components/KUploadDragger.vue.d.ts +13 -0
  125. package/dist/components/KUploadDragger.vue.js +7 -0
  126. package/dist/components/KUploadDragger.vue_vue_type_script_setup_true_lang.js +12 -0
  127. package/dist/components/{KVirtualList.js → KVirtualList.vue.js} +1 -1
  128. package/dist/components/form-context.d.ts +7 -3
  129. package/dist/components/upload-context.d.ts +6 -0
  130. package/dist/components/upload-context.js +4 -0
  131. package/dist/index.d.ts +17 -3
  132. package/dist/index.js +66 -55
  133. package/dist/k-ui.css +1 -1
  134. package/package.json +6 -12
  135. /package/dist/components/{KEmpty.js → KEmpty.vue.js} +0 -0
  136. /package/dist/components/{KGridSkeleton.js → KGridSkeleton.vue.js} +0 -0
  137. /package/dist/components/{KListSkeleton.js → KListSkeleton.vue.js} +0 -0
  138. /package/dist/components/{KRefetchOverlay.js → KRefetchOverlay.vue.js} +0 -0
  139. /package/dist/components/{KSearchBar.js → KSearchBar.vue.js} +0 -0
@@ -0,0 +1,40 @@
1
+ type __VLS_Props = {
2
+ modelValue?: string;
3
+ /** naive-ui alias for v-model:value */
4
+ value?: string;
5
+ disabled?: boolean;
6
+ showInput?: boolean;
7
+ /** accepted for migration; native color input is opaque hex-only */
8
+ showAlpha?: boolean;
9
+ size?: 'small' | 'sm' | 'medium' | 'md' | 'large' | 'lg';
10
+ presets?: string[];
11
+ };
12
+ declare function openPicker(): void;
13
+ declare var __VLS_1: {
14
+ value: string;
15
+ onClick: typeof openPicker;
16
+ };
17
+ type __VLS_Slots = {} & {
18
+ trigger?: (props: typeof __VLS_1) => any;
19
+ };
20
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
21
+ "update:modelValue": (v: string) => any;
22
+ "update:value": (v: string) => any;
23
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
24
+ "onUpdate:modelValue"?: ((v: string) => any) | undefined;
25
+ "onUpdate:value"?: ((v: string) => any) | undefined;
26
+ }>, {
27
+ size: "small" | "sm" | "medium" | "md" | "large" | "lg";
28
+ disabled: boolean;
29
+ showInput: boolean;
30
+ showAlpha: boolean;
31
+ presets: string[];
32
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
34
+ declare const _default: typeof __VLS_export;
35
+ export default _default;
36
+ type __VLS_WithSlots<T, S> = T & {
37
+ new (): {
38
+ $slots: S;
39
+ };
40
+ };
@@ -0,0 +1,7 @@
1
+ import e from "../_virtual/_plugin-vue_export-helper.js";
2
+ import t from "./KColorPicker.vue_vue_type_script_setup_true_lang.js";
3
+ /* empty css */
4
+ //#region components/KColorPicker.vue
5
+ var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-cc1b7b9f"]]);
6
+ //#endregion
7
+ export { n as default };
@@ -0,0 +1,96 @@
1
+ import { Fragment as e, computed as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, defineComponent as a, normalizeClass as o, normalizeStyle as s, openBlock as c, ref as l, renderList as u, renderSlot as d, vModelText as f, watch as p, withDirectives as m, withKeys as h } from "vue";
2
+ //#region components/KColorPicker.vue?vue&type=script&setup=true&lang.ts
3
+ var g = ["value", "disabled"], _ = ["disabled"], v = ["disabled"], y = {
4
+ key: 1,
5
+ class: "k-color__presets"
6
+ }, b = [
7
+ "disabled",
8
+ "aria-label",
9
+ "onClick"
10
+ ], x = /* @__PURE__ */ a({
11
+ __name: "KColorPicker",
12
+ props: {
13
+ modelValue: {},
14
+ value: {},
15
+ disabled: {
16
+ type: Boolean,
17
+ default: !1
18
+ },
19
+ showInput: {
20
+ type: Boolean,
21
+ default: !0
22
+ },
23
+ showAlpha: {
24
+ type: Boolean,
25
+ default: !1
26
+ },
27
+ size: { default: "md" },
28
+ presets: { default: () => [
29
+ "#0c78e4",
30
+ "#10b981",
31
+ "#f59e0b",
32
+ "#f43f5e",
33
+ "#64748b",
34
+ "#111827"
35
+ ] }
36
+ },
37
+ emits: ["update:modelValue", "update:value"],
38
+ setup(a, { emit: x }) {
39
+ let S = a, C = x, w = l(null), T = t(() => S.value ?? S.modelValue ?? "#0c78e4"), E = l(T.value);
40
+ p(T, (e) => E.value = e || "#000000");
41
+ let D = t(() => /^#[0-9a-fA-F]{6}$/.test(E.value) ? E.value : "#000000"), O = t(() => S.size === "small" || S.size === "sm" ? "sm" : S.size === "large" || S.size === "lg" ? "lg" : "md");
42
+ function k() {
43
+ S.disabled || w.value?.click();
44
+ }
45
+ function A(e) {
46
+ E.value = e, C("update:modelValue", e), C("update:value", e);
47
+ }
48
+ function j() {
49
+ if (/^#[0-9a-fA-F]{3}$/.test(E.value)) {
50
+ let [, e, t, n] = E.value;
51
+ A(`#${e}${e}${t}${t}${n}${n}`);
52
+ } else /^#[0-9a-fA-F]{6}$/.test(E.value) ? A(E.value) : E.value = T.value || "#000000";
53
+ }
54
+ return (t, l) => (c(), r("div", { class: o(["k-color", [`k-color--${O.value}`, { "k-color--disabled": a.disabled }]]) }, [
55
+ i("input", {
56
+ ref_key: "inputRef",
57
+ ref: w,
58
+ type: "color",
59
+ value: D.value,
60
+ disabled: a.disabled,
61
+ class: "k-color__native",
62
+ onInput: l[0] ||= (e) => A(e.target.value)
63
+ }, null, 40, g),
64
+ d(t.$slots, "trigger", {
65
+ value: T.value,
66
+ onClick: k
67
+ }, () => [i("button", {
68
+ type: "button",
69
+ class: "k-color__swatch",
70
+ style: s({ backgroundColor: D.value }),
71
+ disabled: a.disabled,
72
+ onClick: k
73
+ }, null, 12, _)], !0),
74
+ a.showInput ? m((c(), r("input", {
75
+ key: 0,
76
+ "onUpdate:modelValue": l[1] ||= (e) => E.value = e,
77
+ class: "k-color__input",
78
+ disabled: a.disabled,
79
+ spellcheck: "false",
80
+ onBlur: j,
81
+ onKeydown: h(j, ["enter"])
82
+ }, null, 40, v)), [[f, E.value]]) : n("", !0),
83
+ a.presets.length ? (c(), r("div", y, [(c(!0), r(e, null, u(a.presets, (e) => (c(), r("button", {
84
+ key: e,
85
+ type: "button",
86
+ class: o(["k-color__preset", { "k-color__preset--active": e.toLowerCase() === T.value?.toLowerCase() }]),
87
+ style: s({ backgroundColor: e }),
88
+ disabled: a.disabled,
89
+ "aria-label": e,
90
+ onClick: (t) => A(e)
91
+ }, null, 14, b))), 128))])) : n("", !0)
92
+ ], 2));
93
+ }
94
+ });
95
+ //#endregion
96
+ export { x as default };
@@ -1,7 +1,7 @@
1
1
  import e from "../_virtual/_plugin-vue_export-helper.js";
2
2
  import t from "./KCombobox.vue_vue_type_script_setup_true_lang.js";
3
- /* empty css */
4
- /* empty css */
3
+ /* empty css */
4
+ /* empty css */
5
5
  //#region components/KCombobox.vue
6
6
  var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-55b7732f"]]);
7
7
  //#endregion
@@ -1,6 +1,6 @@
1
1
  import e from "../_virtual/_plugin-vue_export-helper.js";
2
2
  import t from "./KCommandPalette.vue_vue_type_script_setup_true_lang.js";
3
- /* empty css */
3
+ /* empty css */
4
4
  //#region components/KCommandPalette.vue
5
5
  var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-546dc9a8"]]);
6
6
  //#endregion
@@ -0,0 +1,26 @@
1
+ export interface GlobalThemeOverrides {
2
+ common?: Record<string, string | number>;
3
+ [key: string]: any;
4
+ }
5
+ declare const _default: typeof __VLS_export;
6
+ export default _default;
7
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
8
+ theme?: unknown;
9
+ themeOverrides?: GlobalThemeOverrides;
10
+ inlineThemeDisabled?: boolean;
11
+ abstract?: boolean;
12
+ clsPrefix?: string;
13
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
14
+ theme?: unknown;
15
+ themeOverrides?: GlobalThemeOverrides;
16
+ inlineThemeDisabled?: boolean;
17
+ abstract?: boolean;
18
+ clsPrefix?: string;
19
+ }> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
20
+ default?: (props: {}) => any;
21
+ }>;
22
+ type __VLS_WithSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
25
+ };
26
+ };
@@ -0,0 +1,5 @@
1
+ import e from "./KConfigProvider.vue_vue_type_script_setup_true_lang.js";
2
+ //#region components/KConfigProvider.vue
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
@@ -0,0 +1,17 @@
1
+ import { defineComponent as e, renderSlot as t } from "vue";
2
+ //#region components/KConfigProvider.vue?vue&type=script&setup=true&lang.ts
3
+ var n = /* @__PURE__ */ e({
4
+ __name: "KConfigProvider",
5
+ props: {
6
+ theme: {},
7
+ themeOverrides: {},
8
+ inlineThemeDisabled: { type: Boolean },
9
+ abstract: { type: Boolean },
10
+ clsPrefix: {}
11
+ },
12
+ setup(e) {
13
+ return (e, n) => t(e.$slots, "default");
14
+ }
15
+ });
16
+ //#endregion
17
+ export { n as default };
@@ -1,5 +1,5 @@
1
1
  import e from "./KConfirmDialog.vue_vue_type_script_setup_true_lang.js";
2
- /* empty css */
2
+ /* empty css */
3
3
  //#region components/KConfirmDialog.vue
4
4
  var t = e;
5
5
  //#endregion
@@ -1,22 +1,44 @@
1
- export interface Column {
1
+ import type { VNodeChild } from 'vue';
2
+ export type RowClassValue = string | string[] | Record<string, boolean> | undefined;
3
+ export interface Column<T = Record<string, any>> {
2
4
  key: string;
3
- label: string;
4
- width?: string;
5
+ label?: string;
6
+ title?: string;
7
+ width?: string | number;
5
8
  align?: 'left' | 'right' | 'center';
6
9
  cellClass?: string;
10
+ className?: string;
11
+ render?: (row: T, index: number) => VNodeChild;
7
12
  }
13
+ export interface DataTablePagination {
14
+ page?: number;
15
+ pageSize?: number;
16
+ itemCount?: number;
17
+ showSizePicker?: boolean;
18
+ [key: string]: any;
19
+ }
20
+ export type DataTableColumn<T = Record<string, any>> = Column<T>;
21
+ export type DataTableColumns<T = Record<string, any>> = Column<T>[];
22
+ declare const _default: typeof __VLS_export;
23
+ export default _default;
8
24
  declare const __VLS_export: <T extends Record<string, any>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
9
25
  props: import("vue").PublicProps & __VLS_PrettifyLocal<{
10
- columns: Column[];
11
- rows: T[];
12
- rowKey?: (row: T) => string | number;
26
+ columns: Column<T>[];
27
+ rows?: T[];
28
+ /** naive-ui alias */
29
+ data?: T[];
30
+ rowKey?: string | ((row: T) => string | number);
31
+ rowClassName?: string | ((row: T, index: number) => RowClassValue);
13
32
  hoverable?: boolean;
14
33
  loading?: boolean;
15
34
  empty?: string;
16
- size?: "sm" | "md";
35
+ size?: "small" | "sm" | "medium" | "md";
17
36
  striped?: boolean;
18
37
  bordered?: boolean;
19
38
  stickyHeader?: boolean;
39
+ pagination?: false | DataTablePagination;
40
+ singleLine?: boolean;
41
+ scrollX?: string | number;
20
42
  } & {
21
43
  onRowClick?: ((row: T) => any) | undefined;
22
44
  }> & (typeof globalThis extends {
@@ -26,20 +48,21 @@ declare const __VLS_export: <T extends Record<string, any>>(__VLS_props: NonNull
26
48
  attrs: any;
27
49
  slots: {
28
50
  [x: `header-${string}`]: ((props: {
29
- col: Column;
51
+ col: Column<T>;
30
52
  }) => any) | undefined;
31
53
  } & {
32
54
  [x: `cell-${string}`]: ((props: {
33
55
  row: T;
34
56
  value: any;
57
+ index: number;
35
58
  }) => any) | undefined;
59
+ } & {
60
+ empty?: (props: {}) => any;
36
61
  };
37
62
  emit: (e: "rowClick", row: T) => void;
38
63
  }>) => import("vue").VNode & {
39
64
  __ctx?: Awaited<typeof __VLS_setup>;
40
65
  };
41
- declare const _default: typeof __VLS_export;
42
- export default _default;
43
66
  type __VLS_PrettifyLocal<T> = (T extends any ? {
44
67
  [K in keyof T]: T[K];
45
68
  } : {
@@ -1,7 +1,7 @@
1
1
  import e from "../_virtual/_plugin-vue_export-helper.js";
2
2
  import t from "./KDataTable.vue_vue_type_script_setup_true_lang.js";
3
- /* empty css */
3
+ /* empty css */
4
4
  //#region components/KDataTable.vue
5
- var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-4d42a83d"]]);
5
+ var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-cc657cc6"]]);
6
6
  //#endregion
7
7
  export { n as default };
@@ -1,13 +1,19 @@
1
- import e from "./KLoadingOverlay.js";
2
- import t from "./KEmpty.js";
3
- import { Fragment as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, createVNode as c, defineComponent as l, normalizeClass as u, normalizeStyle as d, openBlock as f, renderList as p, renderSlot as m, toDisplayString as h } from "vue";
1
+ import e from "./KLoadingOverlay.vue.js";
2
+ import t from "./KEmpty.vue.js";
3
+ import n from "./KPagination.vue.js";
4
+ import { Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, normalizeClass as f, normalizeStyle as p, openBlock as m, ref as h, renderList as g, renderSlot as _, toDisplayString as v, unref as y, watch as b } from "vue";
4
5
  //#region components/KDataTable.vue?vue&type=script&setup=true&lang.ts
5
- var g = ["onClick"], _ = /* @__PURE__ */ l({
6
+ var x = ["onClick"], S = {
7
+ key: 0,
8
+ class: "k-table-empty"
9
+ }, C = /* @__PURE__ */ d({
6
10
  __name: "KDataTable",
7
11
  props: {
8
12
  columns: {},
9
13
  rows: {},
14
+ data: {},
10
15
  rowKey: {},
16
+ rowClassName: {},
11
17
  hoverable: {
12
18
  type: Boolean,
13
19
  default: !0
@@ -29,34 +35,126 @@ var g = ["onClick"], _ = /* @__PURE__ */ l({
29
35
  stickyHeader: {
30
36
  type: Boolean,
31
37
  default: !1
32
- }
38
+ },
39
+ pagination: { type: [Boolean, Object] },
40
+ singleLine: {
41
+ type: Boolean,
42
+ default: !0
43
+ },
44
+ scrollX: {}
33
45
  },
34
46
  emits: ["rowClick"],
35
- setup(l, { emit: _ }) {
36
- let v = _;
37
- return (_, y) => (f(), a("div", { class: u(["k-table-wrap", [`k-table-wrap--${l.size}`, { "k-table-wrap--bordered": l.bordered }]]) }, [o("div", { class: u(["k-table-scroll", { "k-table-scroll--sticky": l.stickyHeader }]) }, [o("table", { class: u(["k-table", { "k-table--striped": l.striped }]) }, [o("thead", null, [o("tr", null, [(f(!0), a(n, null, p(l.columns, (e) => (f(), a("th", {
38
- key: e.key,
39
- style: d(e.width ? { width: e.width } : void 0),
40
- class: u(e.align ? `k-table__th--${e.align}` : "")
41
- }, [m(_.$slots, `header-${e.key}`, { col: e }, () => [s(h(e.label), 1)], !0)], 6))), 128))])]), o("tbody", null, [(f(!0), a(n, null, p(l.rows, (e, t) => (f(), a("tr", {
42
- key: l.rowKey ? l.rowKey(e) : t,
43
- class: u({ "k-table__row--hoverable": l.hoverable }),
44
- onClick: (t) => l.hoverable && v("rowClick", e)
45
- }, [(f(!0), a(n, null, p(l.columns, (t) => (f(), a("td", {
46
- key: t.key,
47
- class: u([t.cellClass, t.align ? `k-table__td--${t.align}` : ""])
48
- }, [m(_.$slots, `cell-${t.key}`, {
49
- row: e,
50
- value: e[t.key]
51
- }, () => [o("span", null, h(e[t.key] ?? "—"), 1)], !0)], 2))), 128))], 10, g))), 128))])], 2), !l.loading && l.rows.length === 0 ? (f(), r(t, {
52
- key: 0,
53
- title: l.empty || "暂无数据",
54
- compact: ""
55
- }, null, 8, ["title"])) : i("", !0)], 2), c(e, {
56
- show: l.loading,
57
- text: "加载中..."
58
- }, null, 8, ["show"])], 2));
47
+ setup(C, { emit: w }) {
48
+ let T = C, E = w, D = h(1), O = i(() => T.rows ?? T.data ?? []), k = i(() => T.pagination && typeof T.pagination == "object" ? T.pagination : void 0), A = i(() => {
49
+ let e = Number(k.value?.pageSize ?? 0);
50
+ return Number.isFinite(e) && e > 0 ? e : 0;
51
+ }), j = i(() => O.value.length), M = i(() => {
52
+ if (!A.value) return O.value;
53
+ let e = (D.value - 1) * A.value;
54
+ return O.value.slice(e, e + A.value);
55
+ }), N = i(() => T.size === "small" || T.size === "sm" ? "sm" : "md"), P = i(() => {
56
+ if (T.scrollX !== void 0) return { minWidth: typeof T.scrollX == "number" ? `${T.scrollX}px` : T.scrollX };
57
+ });
58
+ b(() => k.value?.page, (e) => {
59
+ typeof e == "number" && e > 0 && (D.value = e);
60
+ }, { immediate: !0 }), b([j, A], () => {
61
+ let e = A.value ? Math.max(1, Math.ceil(j.value / A.value)) : 1;
62
+ D.value > e && (D.value = e), D.value < 1 && (D.value = 1);
63
+ });
64
+ function F(e) {
65
+ return e.label ?? e.title ?? e.key;
66
+ }
67
+ function I(e) {
68
+ if (e.width !== void 0) return { width: typeof e.width == "number" ? `${e.width}px` : e.width };
69
+ }
70
+ function L(e, t) {
71
+ return e[t.key] ?? "-";
72
+ }
73
+ function R(e, t) {
74
+ return typeof T.rowKey == "function" ? T.rowKey(e) : typeof T.rowKey == "string" ? e[T.rowKey] ?? t : t;
75
+ }
76
+ function z(e, t) {
77
+ return [{ "k-table__row--hoverable": T.hoverable }, typeof T.rowClassName == "function" ? T.rowClassName(e, t) : T.rowClassName];
78
+ }
79
+ function B(e, t, n) {
80
+ return e.render ? e.render(t, n) : L(t, e);
81
+ }
82
+ let V = d({
83
+ props: {
84
+ col: {
85
+ type: Object,
86
+ required: !0
87
+ },
88
+ row: {
89
+ type: Object,
90
+ required: !0
91
+ },
92
+ index: {
93
+ type: Number,
94
+ required: !0
95
+ }
96
+ },
97
+ setup(e) {
98
+ return () => B(e.col, e.row, e.index);
99
+ }
100
+ });
101
+ return (i, d) => (m(), s("div", { class: f(["k-table-wrap", [`k-table-wrap--${N.value}`, { "k-table-wrap--bordered": C.bordered }]]) }, [
102
+ c("div", { class: f(["k-table-scroll", { "k-table-scroll--sticky": C.stickyHeader }]) }, [c("table", {
103
+ class: f(["k-table", {
104
+ "k-table--striped": C.striped,
105
+ "k-table--single-line": C.singleLine
106
+ }]),
107
+ style: p(P.value)
108
+ }, [c("thead", null, [c("tr", null, [(m(!0), s(r, null, g(C.columns, (e) => (m(), s("th", {
109
+ key: e.key,
110
+ style: p(I(e)),
111
+ class: f(e.align ? `k-table__th--${e.align}` : "")
112
+ }, [_(i.$slots, `header-${e.key}`, { col: e }, () => [l(v(F(e)), 1)], !0)], 6))), 128))])]), c("tbody", null, [(m(!0), s(r, null, g(M.value, (e, t) => (m(), s("tr", {
113
+ key: R(e, t),
114
+ class: f(z(e, t)),
115
+ onClick: (t) => C.hoverable && E("rowClick", e)
116
+ }, [(m(!0), s(r, null, g(C.columns, (n) => (m(), s("td", {
117
+ key: n.key,
118
+ class: f([
119
+ n.cellClass,
120
+ n.className,
121
+ n.align ? `k-table__td--${n.align}` : ""
122
+ ])
123
+ }, [_(i.$slots, `cell-${n.key}`, {
124
+ row: e,
125
+ value: L(e, n),
126
+ index: t
127
+ }, () => [u(y(V), {
128
+ col: n,
129
+ row: e,
130
+ index: t
131
+ }, null, 8, [
132
+ "col",
133
+ "row",
134
+ "index"
135
+ ])], !0)], 2))), 128))], 10, x))), 128))])], 6), !C.loading && O.value.length === 0 ? (m(), s("div", S, [_(i.$slots, "empty", {}, () => [u(t, {
136
+ title: C.empty || "暂无数据",
137
+ compact: ""
138
+ }, null, 8, ["title"])], !0)])) : o("", !0)], 2),
139
+ A.value > 0 ? (m(), a(n, {
140
+ key: 0,
141
+ page: D.value,
142
+ "onUpdate:page": d[0] ||= (e) => D.value = e,
143
+ class: "k-table-pagination",
144
+ "page-size": A.value,
145
+ total: j.value,
146
+ "show-summary": ""
147
+ }, null, 8, [
148
+ "page",
149
+ "page-size",
150
+ "total"
151
+ ])) : o("", !0),
152
+ u(e, {
153
+ show: C.loading,
154
+ text: "加载中..."
155
+ }, null, 8, ["show"])
156
+ ], 2));
59
157
  }
60
158
  });
61
159
  //#endregion
62
- export { _ as default };
160
+ export { C as default };
@@ -1,5 +1,5 @@
1
1
  import e from "./KDatePicker.vue_vue_type_script_setup_true_lang.js";
2
- /* empty css */
2
+ /* empty css */
3
3
  //#region components/KDatePicker.vue
4
4
  var t = e;
5
5
  //#endregion
@@ -1,4 +1,4 @@
1
- /* empty css */
1
+ /* empty css */
2
2
  import { createBlock as e, defineComponent as t, openBlock as n, unref as r } from "vue";
3
3
  import { VueDatePicker as i } from "@vuepic/vue-datepicker";
4
4
  import { zhCN as a } from "date-fns/locale";
@@ -0,0 +1,30 @@
1
+ export interface DescriptionItem {
2
+ label: string;
3
+ value?: string | number;
4
+ span?: number;
5
+ }
6
+ type __VLS_Props = {
7
+ items?: DescriptionItem[];
8
+ columns?: number;
9
+ bordered?: boolean;
10
+ labelWidth?: string;
11
+ size?: 'sm' | 'md' | 'lg';
12
+ };
13
+ declare var __VLS_1: {};
14
+ type __VLS_Slots = {} & {
15
+ default?: (props: typeof __VLS_1) => any;
16
+ };
17
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
18
+ size: "sm" | "md" | "lg";
19
+ bordered: boolean;
20
+ labelWidth: string;
21
+ columns: number;
22
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
23
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
24
+ declare const _default: typeof __VLS_export;
25
+ export default _default;
26
+ type __VLS_WithSlots<T, S> = T & {
27
+ new (): {
28
+ $slots: S;
29
+ };
30
+ };
@@ -0,0 +1,6 @@
1
+ import e from "./KDescriptions.vue_vue_type_script_setup_true_lang.js";
2
+ /* empty css */
3
+ //#region components/KDescriptions.vue
4
+ var t = e;
5
+ //#endregion
6
+ export { t as default };
@@ -0,0 +1,30 @@
1
+ import { Fragment as e, createElementBlock as t, createElementVNode as n, defineComponent as r, normalizeClass as i, normalizeStyle as a, openBlock as o, renderList as s, renderSlot as c, toDisplayString as l } from "vue";
2
+ //#region components/KDescriptions.vue?vue&type=script&setup=true&lang.ts
3
+ var u = { class: "k-desc-item__label" }, d = { class: "k-desc-item__value" }, f = /* @__PURE__ */ r({
4
+ __name: "KDescriptions",
5
+ props: {
6
+ items: {},
7
+ columns: { default: 3 },
8
+ bordered: {
9
+ type: Boolean,
10
+ default: !0
11
+ },
12
+ labelWidth: { default: "96px" },
13
+ size: { default: "md" }
14
+ },
15
+ setup(r) {
16
+ return (f, p) => (o(), t("div", {
17
+ class: i(["k-descriptions", [`k-descriptions--${r.size}`, { "k-descriptions--bordered": r.bordered }]]),
18
+ style: a({
19
+ "--k-desc-columns": r.columns,
20
+ "--k-desc-label-width": r.labelWidth
21
+ })
22
+ }, [r.items?.length ? (o(!0), t(e, { key: 0 }, s(r.items, (e) => (o(), t("div", {
23
+ key: e.label,
24
+ class: "k-desc-item",
25
+ style: a({ gridColumn: e.span ? `span ${e.span}` : void 0 })
26
+ }, [n("div", u, l(e.label), 1), n("div", d, l(e.value), 1)], 4))), 128)) : c(f.$slots, "default", { key: 1 })], 6));
27
+ }
28
+ });
29
+ //#endregion
30
+ export { f as default };
@@ -0,0 +1,17 @@
1
+ type __VLS_Props = {
2
+ label: string;
3
+ span?: number;
4
+ };
5
+ declare var __VLS_1: {};
6
+ type __VLS_Slots = {} & {
7
+ default?: (props: typeof __VLS_1) => any;
8
+ };
9
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
11
+ declare const _default: typeof __VLS_export;
12
+ export default _default;
13
+ type __VLS_WithSlots<T, S> = T & {
14
+ new (): {
15
+ $slots: S;
16
+ };
17
+ };
@@ -0,0 +1,5 @@
1
+ import e from "./KDescriptionsItem.vue_vue_type_script_setup_true_lang.js";
2
+ //#region components/KDescriptionsItem.vue
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
@@ -0,0 +1,17 @@
1
+ import { createElementBlock as e, createElementVNode as t, defineComponent as n, normalizeStyle as r, openBlock as i, renderSlot as a, toDisplayString as o } from "vue";
2
+ //#region components/KDescriptionsItem.vue?vue&type=script&setup=true&lang.ts
3
+ var s = { class: "k-desc-item__label" }, c = { class: "k-desc-item__value" }, l = /* @__PURE__ */ n({
4
+ __name: "KDescriptionsItem",
5
+ props: {
6
+ label: {},
7
+ span: {}
8
+ },
9
+ setup(n) {
10
+ return (l, u) => (i(), e("div", {
11
+ class: "k-desc-item",
12
+ style: r({ gridColumn: n.span ? `span ${n.span}` : void 0 })
13
+ }, [t("div", s, o(n.label), 1), t("div", c, [a(l.$slots, "default")])], 4));
14
+ }
15
+ });
16
+ //#endregion
17
+ export { l as default };
@@ -12,6 +12,7 @@ type __VLS_Props = {
12
12
  confirmLoading?: boolean;
13
13
  confirmType?: 'primary' | 'danger';
14
14
  hideCancel?: boolean;
15
+ width?: string | number;
15
16
  };
16
17
  declare var __VLS_13: {}, __VLS_20: {}, __VLS_22: {};
17
18
  type __VLS_Slots = {} & {
@@ -1,7 +1,7 @@
1
1
  import e from "../_virtual/_plugin-vue_export-helper.js";
2
2
  import t from "./KDialog.vue_vue_type_script_setup_true_lang.js";
3
- /* empty css */
3
+ /* empty css */
4
4
  //#region components/KDialog.vue
5
- var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-f2253276"]]);
5
+ var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-f650c062"]]);
6
6
  //#endregion
7
7
  export { n as default };