@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.
- package/README.md +66 -22
- package/dist/components/KAlert.vue.d.ts +1 -1
- package/dist/components/{KAlert.js → KAlert.vue.js} +2 -2
- package/dist/components/KAlert.vue_vue_type_script_setup_true_lang.js +35 -32
- package/dist/components/{KAvatar.js → KAvatar.vue.js} +1 -1
- package/dist/components/{KAvatarGroup.js → KAvatarGroup.vue.js} +1 -1
- package/dist/components/KBreadcrumb.vue.d.ts +30 -1
- package/dist/components/{KBreadcrumb.js → KBreadcrumb.vue.js} +2 -2
- package/dist/components/KBreadcrumb.vue_vue_type_script_setup_true_lang.js +36 -21
- package/dist/components/KButton.vue.d.ts +17 -2
- package/dist/components/{KButton.js → KButton.vue.js} +2 -2
- package/dist/components/KButton.vue_vue_type_script_setup_true_lang.js +51 -17
- package/dist/components/KCard.vue.d.ts +5 -3
- package/dist/components/{KCard.js → KCard.vue.js} +2 -2
- package/dist/components/KCard.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/{KCarousel.js → KCarousel.vue.js} +1 -1
- package/dist/components/{KCheckbox.js → KCheckbox.vue.js} +1 -1
- package/dist/components/{KCheckboxGroup.js → KCheckboxGroup.vue.js} +1 -1
- package/dist/components/KColorPicker.vue.d.ts +40 -0
- package/dist/components/KColorPicker.vue.js +7 -0
- package/dist/components/KColorPicker.vue_vue_type_script_setup_true_lang.js +96 -0
- package/dist/components/{KCombobox.js → KCombobox.vue.js} +2 -2
- package/dist/components/{KCommandPalette.js → KCommandPalette.vue.js} +1 -1
- package/dist/components/KConfigProvider.vue.d.ts +26 -0
- package/dist/components/KConfigProvider.vue.js +5 -0
- package/dist/components/KConfigProvider.vue_vue_type_script_setup_true_lang.js +17 -0
- package/dist/components/{KConfirmDialog.js → KConfirmDialog.vue.js} +1 -1
- package/dist/components/KDataTable.vue.d.ts +33 -10
- package/dist/components/{KDataTable.js → KDataTable.vue.js} +2 -2
- package/dist/components/KDataTable.vue_vue_type_script_setup_true_lang.js +128 -30
- package/dist/components/{KDatePicker.js → KDatePicker.vue.js} +1 -1
- package/dist/components/KDatePicker.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/KDescriptions.vue.d.ts +30 -0
- package/dist/components/KDescriptions.vue.js +6 -0
- package/dist/components/KDescriptions.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/components/KDescriptionsItem.vue.d.ts +17 -0
- package/dist/components/KDescriptionsItem.vue.js +5 -0
- package/dist/components/KDescriptionsItem.vue_vue_type_script_setup_true_lang.js +17 -0
- package/dist/components/KDialog.vue.d.ts +1 -0
- package/dist/components/{KDialog.js → KDialog.vue.js} +2 -2
- package/dist/components/KDialog.vue_vue_type_script_setup_true_lang.js +45 -38
- package/dist/components/{KDiff.js → KDiff.vue.js} +1 -1
- package/dist/components/KDrawer.vue.d.ts +7 -3
- package/dist/components/{KDrawer.js → KDrawer.vue.js} +2 -2
- package/dist/components/KDrawer.vue_vue_type_script_setup_true_lang.js +41 -29
- package/dist/components/KDropdown.vue.d.ts +7 -4
- package/dist/components/{KDropdown.js → KDropdown.vue.js} +2 -2
- package/dist/components/KDropdown.vue_vue_type_script_setup_true_lang.js +40 -38
- package/dist/components/KEmpty.vue.d.ts +8 -4
- package/dist/components/KEmpty.vue_vue_type_script_setup_true_lang.js +17 -14
- package/dist/components/KForm.vue.d.ts +12 -6
- package/dist/components/{KForm.js → KForm.vue.js} +2 -2
- package/dist/components/KForm.vue_vue_type_script_setup_true_lang.js +31 -15
- package/dist/components/KFormField.vue.d.ts +3 -2
- package/dist/components/{KFormField.js → KFormField.vue.js} +2 -2
- package/dist/components/KFormField.vue_vue_type_script_setup_true_lang.js +41 -28
- package/dist/components/KIcon.vue.d.ts +22 -0
- package/dist/components/KIcon.vue.js +7 -0
- package/dist/components/KIcon.vue_vue_type_script_setup_true_lang.js +31 -0
- package/dist/components/KImage.vue.d.ts +3 -3
- package/dist/components/{KImage.js → KImage.vue.js} +1 -1
- package/dist/components/KImage.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/{KImageViewer.js → KImageViewer.vue.js} +1 -1
- package/dist/components/KInput.vue.d.ts +11 -5
- package/dist/components/{KInput.js → KInput.vue.js} +2 -2
- package/dist/components/KInput.vue_vue_type_script_setup_true_lang.js +62 -38
- package/dist/components/KInputNumber.vue.d.ts +18 -4
- package/dist/components/{KInputNumber.js → KInputNumber.vue.js} +2 -2
- package/dist/components/KInputNumber.vue_vue_type_script_setup_true_lang.js +80 -62
- package/dist/components/{KLoadingOverlay.js → KLoadingOverlay.vue.js} +1 -1
- package/dist/components/KMessage.js +1 -1
- package/dist/components/{KMessageContainer.js → KMessageContainer.vue.js} +1 -1
- package/dist/components/KNotification.d.ts +36 -0
- package/dist/components/KNotification.js +55 -0
- package/dist/components/KNotificationContainer.vue.d.ts +20 -0
- package/dist/components/KNotificationContainer.vue.js +7 -0
- package/dist/components/KNotificationContainer.vue_vue_type_script_setup_true_lang.js +63 -0
- package/dist/components/KNotificationProvider.vue.d.ts +13 -0
- package/dist/components/KNotificationProvider.vue.js +10 -0
- package/dist/components/{KPagination.js → KPagination.vue.js} +1 -1
- package/dist/components/KPopconfirm.vue.d.ts +46 -0
- package/dist/components/KPopconfirm.vue.js +6 -0
- package/dist/components/KPopconfirm.vue_vue_type_script_setup_true_lang.js +81 -0
- package/dist/components/{KPopover.js → KPopover.vue.js} +1 -1
- package/dist/components/KProgress.vue.d.ts +3 -2
- package/dist/components/{KProgress.js → KProgress.vue.js} +2 -2
- package/dist/components/KProgress.vue_vue_type_script_setup_true_lang.js +23 -20
- package/dist/components/{KRadio.js → KRadio.vue.js} +1 -1
- package/dist/components/{KRadioGroup.js → KRadioGroup.vue.js} +1 -1
- package/dist/components/{KResizablePanel.js → KResizablePanel.vue.js} +1 -1
- package/dist/components/{KResult.js → KResult.vue.js} +1 -1
- package/dist/components/KSelect.vue.d.ts +10 -3
- package/dist/components/{KSelect.js → KSelect.vue.js} +4 -4
- package/dist/components/KSelect.vue_vue_type_script_setup_true_lang.js +89 -48
- package/dist/components/{KSkeleton.js → KSkeleton.vue.js} +1 -1
- package/dist/components/KSlider.vue.d.ts +24 -0
- package/dist/components/KSlider.vue.js +7 -0
- package/dist/components/KSlider.vue_vue_type_script_setup_true_lang.js +82 -0
- package/dist/components/KSpin.vue.d.ts +23 -0
- package/dist/components/KSpin.vue.js +7 -0
- package/dist/components/KSpin.vue_vue_type_script_setup_true_lang.js +35 -0
- package/dist/components/KSteps.vue.d.ts +1 -1
- package/dist/components/{KSteps.js → KSteps.vue.js} +1 -1
- package/dist/components/KSwitch.vue.d.ts +2 -2
- package/dist/components/{KSwitch.js → KSwitch.vue.js} +2 -2
- package/dist/components/KSwitch.vue_vue_type_script_setup_true_lang.js +12 -11
- package/dist/components/KTabs.vue.d.ts +10 -5
- package/dist/components/{KTabs.js → KTabs.vue.js} +2 -2
- package/dist/components/KTabs.vue_vue_type_script_setup_true_lang.js +31 -21
- package/dist/components/KTag.vue.d.ts +3 -3
- package/dist/components/{KTag.js → KTag.vue.js} +2 -2
- package/dist/components/KTag.vue_vue_type_script_setup_true_lang.js +14 -13
- package/dist/components/KTextarea.vue.d.ts +17 -2
- package/dist/components/{KTextarea.js → KTextarea.vue.js} +2 -2
- package/dist/components/KTextarea.vue_vue_type_script_setup_true_lang.js +51 -22
- package/dist/components/{KThemeToggleButton.js → KThemeToggleButton.vue.js} +1 -1
- package/dist/components/{KTooltip.js → KTooltip.vue.js} +1 -1
- package/dist/components/{KTreeNode.js → KTreeNode.vue.js} +1 -1
- package/dist/components/{KTreeView.js → KTreeView.vue.js} +1 -1
- package/dist/components/KTreeView.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/KUpload.vue.d.ts +100 -4
- package/dist/components/{KUpload.js → KUpload.vue.js} +2 -2
- package/dist/components/KUpload.vue_vue_type_script_setup_true_lang.js +189 -94
- package/dist/components/KUploadDragger.vue.d.ts +13 -0
- package/dist/components/KUploadDragger.vue.js +7 -0
- package/dist/components/KUploadDragger.vue_vue_type_script_setup_true_lang.js +12 -0
- package/dist/components/{KVirtualList.js → KVirtualList.vue.js} +1 -1
- package/dist/components/form-context.d.ts +7 -3
- package/dist/components/upload-context.d.ts +6 -0
- package/dist/components/upload-context.js +4 -0
- package/dist/index.d.ts +17 -3
- package/dist/index.js +66 -55
- package/dist/k-ui.css +1 -1
- package/package.json +6 -12
- /package/dist/components/{KEmpty.js → KEmpty.vue.js} +0 -0
- /package/dist/components/{KGridSkeleton.js → KGridSkeleton.vue.js} +0 -0
- /package/dist/components/{KListSkeleton.js → KListSkeleton.vue.js} +0 -0
- /package/dist/components/{KRefetchOverlay.js → KRefetchOverlay.vue.js} +0 -0
- /package/dist/components/{KSearchBar.js → KSearchBar.vue.js} +0 -0
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { uploadContextKey as e } from "./upload-context.js";
|
|
2
|
+
import { Fragment as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, normalizeClass as l, normalizeStyle as u, openBlock as d, provide as f, ref as p, renderList as m, renderSlot as h, toDisplayString as g, unref as _, withModifiers as v } from "vue";
|
|
3
|
+
import { AlertCircle as y, CheckCircle2 as b, FileText as x, Loader2 as S, Upload as C, X as w } from "lucide-vue-next";
|
|
3
4
|
//#region components/KUpload.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
-
var
|
|
5
|
+
var T = { class: "k-upload__hint" }, E = {
|
|
5
6
|
key: 0,
|
|
6
7
|
class: "k-upload__meta"
|
|
7
|
-
},
|
|
8
|
+
}, D = { key: 0 }, O = { key: 1 }, k = { key: 2 }, A = ["disabled"], j = ["multiple", "accept"], M = {
|
|
8
9
|
key: 2,
|
|
9
10
|
class: "k-upload__list"
|
|
10
|
-
},
|
|
11
|
+
}, N = { class: "k-upload__file-info" }, P = { class: "k-upload__file-name" }, F = { class: "k-upload__file-meta" }, I = {
|
|
11
12
|
key: 0,
|
|
12
13
|
class: "k-upload__error-text"
|
|
13
|
-
},
|
|
14
|
+
}, L = {
|
|
14
15
|
key: 0,
|
|
15
16
|
class: "k-upload__progress"
|
|
16
|
-
},
|
|
17
|
+
}, R = { class: "k-upload__file-status" }, z = ["onClick"], B = /* @__PURE__ */ c({
|
|
17
18
|
__name: "KUpload",
|
|
18
19
|
props: {
|
|
19
20
|
multiple: {
|
|
@@ -23,159 +24,253 @@ var S = { class: "k-upload" }, C = { class: "k-upload__hint" }, w = {
|
|
|
23
24
|
accept: {},
|
|
24
25
|
maxSize: {},
|
|
25
26
|
uploader: {},
|
|
27
|
+
customRequest: {},
|
|
28
|
+
beforeUpload: {},
|
|
29
|
+
onBeforeUpload: {},
|
|
30
|
+
autoUpload: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: !0
|
|
33
|
+
},
|
|
34
|
+
defaultUpload: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: !0
|
|
37
|
+
},
|
|
38
|
+
showList: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: !0
|
|
41
|
+
},
|
|
42
|
+
showFileList: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: !0
|
|
45
|
+
},
|
|
46
|
+
buttonText: { default: "选择文件" },
|
|
26
47
|
drag: {
|
|
27
48
|
type: Boolean,
|
|
28
49
|
default: !0
|
|
50
|
+
},
|
|
51
|
+
disabled: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: !1
|
|
29
54
|
}
|
|
30
55
|
},
|
|
31
56
|
emits: [
|
|
32
57
|
"change",
|
|
58
|
+
"select",
|
|
33
59
|
"success",
|
|
34
60
|
"error"
|
|
35
61
|
],
|
|
36
|
-
setup(
|
|
37
|
-
let
|
|
38
|
-
|
|
62
|
+
setup(c, { expose: B, emit: V }) {
|
|
63
|
+
let H = c, U = V, W = p([]), G = p(!1), K = p(null);
|
|
64
|
+
f(e, {
|
|
65
|
+
open: Z,
|
|
66
|
+
isDragOver: G
|
|
67
|
+
});
|
|
68
|
+
function q(e) {
|
|
39
69
|
return e < 1024 ? e + " B" : e < 1024 * 1024 ? (e / 1024).toFixed(1) + " KB" : (e / 1024 / 1024).toFixed(2) + " MB";
|
|
40
70
|
}
|
|
41
|
-
let
|
|
42
|
-
|
|
71
|
+
let J = 0;
|
|
72
|
+
function Y(e, t) {
|
|
73
|
+
return {
|
|
74
|
+
id: e.id,
|
|
75
|
+
name: e.name,
|
|
76
|
+
status: e.status,
|
|
77
|
+
percentage: e.progress,
|
|
78
|
+
file: t ?? e.raw,
|
|
79
|
+
url: e.url
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
async function X(e) {
|
|
83
|
+
if (H.disabled) return;
|
|
43
84
|
let t = Array.from(e);
|
|
44
|
-
!
|
|
85
|
+
!H.multiple && t.length > 1 && (t = t.slice(0, 1));
|
|
45
86
|
let n = [];
|
|
46
87
|
for (let e of t) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
88
|
+
let t = {
|
|
89
|
+
id: String(++J),
|
|
90
|
+
name: e.name,
|
|
91
|
+
size: e.size,
|
|
92
|
+
status: "pending",
|
|
93
|
+
progress: 0,
|
|
94
|
+
raw: e,
|
|
95
|
+
file: e
|
|
96
|
+
}, r = !0;
|
|
97
|
+
H.beforeUpload && (r = await H.beforeUpload({ file: Y(t, e) })), r !== !1 && H.onBeforeUpload && (r = await H.onBeforeUpload({ file: Y(t, e) })), r !== !1 && n.push(e);
|
|
98
|
+
}
|
|
99
|
+
if (t = n, t.length === 0) return;
|
|
100
|
+
U("select", t);
|
|
101
|
+
let r = [];
|
|
102
|
+
for (let e of t) {
|
|
103
|
+
if (H.maxSize && e.size > H.maxSize) {
|
|
104
|
+
W.value.push({
|
|
105
|
+
id: String(++J),
|
|
50
106
|
name: e.name,
|
|
51
107
|
size: e.size,
|
|
52
108
|
status: "error",
|
|
53
109
|
progress: 0,
|
|
54
|
-
error: `超过最大 ${
|
|
110
|
+
error: `超过最大 ${q(H.maxSize)}`
|
|
55
111
|
});
|
|
56
112
|
continue;
|
|
57
113
|
}
|
|
58
114
|
let t = {
|
|
59
|
-
id: String(++
|
|
115
|
+
id: String(++J),
|
|
60
116
|
name: e.name,
|
|
61
117
|
size: e.size,
|
|
62
118
|
status: "pending",
|
|
63
119
|
progress: 0,
|
|
64
|
-
raw: e
|
|
120
|
+
raw: e,
|
|
121
|
+
file: e
|
|
65
122
|
};
|
|
66
|
-
|
|
123
|
+
W.value.push(t), r.push({
|
|
67
124
|
uf: t,
|
|
68
125
|
raw: e
|
|
69
126
|
});
|
|
70
127
|
}
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
128
|
+
if (U("change", W.value), !(!H.autoUpload || !H.defaultUpload)) {
|
|
129
|
+
if (H.customRequest) {
|
|
130
|
+
await Promise.all(r.map(async ({ uf: e, raw: t }) => {
|
|
131
|
+
e.status = "uploading", await new Promise((n) => {
|
|
132
|
+
H.customRequest?.({
|
|
133
|
+
file: Y(e, t),
|
|
134
|
+
onProgress: ({ percent: t }) => {
|
|
135
|
+
e.progress = Math.max(0, Math.min(100, t));
|
|
136
|
+
},
|
|
137
|
+
onFinish: () => {
|
|
138
|
+
if (!W.value.includes(e)) return n();
|
|
139
|
+
e.status = "success", e.progress = 100, U("success", e), U("change", W.value), n();
|
|
140
|
+
},
|
|
141
|
+
onError: (t) => {
|
|
142
|
+
if (!W.value.includes(e)) return n();
|
|
143
|
+
e.status = "error", e.error = t?.message || "上传失败", U("error", e, t), U("change", W.value), n();
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
}));
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (H.uploader) {
|
|
151
|
+
let e = H.uploader;
|
|
152
|
+
await Promise.all(r.map(async ({ uf: t, raw: n }) => {
|
|
153
|
+
t.status = "uploading";
|
|
154
|
+
try {
|
|
155
|
+
let r = await e(n, (e) => t.progress = e);
|
|
156
|
+
if (!W.value.includes(t)) return;
|
|
157
|
+
t.status = "success", t.progress = 100, t.url = r?.url, U("success", t);
|
|
158
|
+
} catch (e) {
|
|
159
|
+
if (!W.value.includes(t)) return;
|
|
160
|
+
t.status = "error", t.error = e?.message || "上传失败", U("error", t, e);
|
|
161
|
+
}
|
|
162
|
+
}));
|
|
163
|
+
} else r.forEach(({ uf: e }) => {
|
|
164
|
+
e.status = "success", e.progress = 100;
|
|
165
|
+
});
|
|
166
|
+
U("change", W.value);
|
|
167
|
+
}
|
|
87
168
|
}
|
|
88
|
-
function
|
|
89
|
-
|
|
169
|
+
function Z() {
|
|
170
|
+
H.disabled || K.value?.click();
|
|
90
171
|
}
|
|
91
|
-
function
|
|
172
|
+
function Q(e) {
|
|
92
173
|
let t = e.target;
|
|
93
|
-
t.files &&
|
|
174
|
+
t.files && X(t.files), t.value = "";
|
|
94
175
|
}
|
|
95
|
-
function
|
|
96
|
-
|
|
176
|
+
function ee(e) {
|
|
177
|
+
G.value = !1, !H.disabled && e.dataTransfer?.files && X(e.dataTransfer.files);
|
|
97
178
|
}
|
|
98
|
-
function
|
|
99
|
-
|
|
179
|
+
function $(e) {
|
|
180
|
+
W.value = W.value.filter((t) => t.id !== e), U("change", W.value);
|
|
100
181
|
}
|
|
101
|
-
return
|
|
102
|
-
files:
|
|
103
|
-
remove:
|
|
104
|
-
addFiles:
|
|
105
|
-
|
|
106
|
-
|
|
182
|
+
return B({
|
|
183
|
+
files: W,
|
|
184
|
+
remove: $,
|
|
185
|
+
addFiles: X,
|
|
186
|
+
open: Z
|
|
187
|
+
}), (e, f) => (d(), i("div", { class: l(["k-upload", { "k-upload--disabled": c.disabled }]) }, [
|
|
188
|
+
c.drag ? (d(), i("div", {
|
|
107
189
|
key: 0,
|
|
108
|
-
class:
|
|
109
|
-
onClick:
|
|
110
|
-
onDragover:
|
|
111
|
-
onDragleave:
|
|
112
|
-
onDrop:
|
|
113
|
-
}, [
|
|
190
|
+
class: l(["k-upload__zone", { "k-upload__zone--over": G.value }]),
|
|
191
|
+
onClick: Z,
|
|
192
|
+
onDragover: f[0] ||= v((e) => G.value = !0, ["prevent"]),
|
|
193
|
+
onDragleave: f[1] ||= v((e) => G.value = !1, ["prevent"]),
|
|
194
|
+
onDrop: v(ee, ["prevent"])
|
|
195
|
+
}, [h(e.$slots, "trigger", {
|
|
196
|
+
isDragOver: G.value,
|
|
197
|
+
open: Z
|
|
198
|
+
}, () => [h(e.$slots, "default", {
|
|
199
|
+
isDragOver: G.value,
|
|
200
|
+
open: Z
|
|
201
|
+
}, () => [s(_(C), {
|
|
114
202
|
size: 28,
|
|
115
203
|
class: "k-upload__icon"
|
|
116
|
-
}),
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
])) :
|
|
126
|
-
])], 34)) : (
|
|
204
|
+
}), a("div", T, [
|
|
205
|
+
f[2] ||= a("strong", null, "点击选择", -1),
|
|
206
|
+
f[3] ||= o(" 或 ", -1),
|
|
207
|
+
f[4] ||= a("strong", null, "拖拽文件", -1),
|
|
208
|
+
f[5] ||= o(" 到此处 ", -1),
|
|
209
|
+
c.accept || c.maxSize ? (d(), i("div", E, [
|
|
210
|
+
c.accept ? (d(), i("span", D, "支持: " + g(c.accept), 1)) : r("", !0),
|
|
211
|
+
c.accept && c.maxSize ? (d(), i("span", O, " · ")) : r("", !0),
|
|
212
|
+
c.maxSize ? (d(), i("span", k, "最大: " + g(q(c.maxSize)), 1)) : r("", !0)
|
|
213
|
+
])) : r("", !0)
|
|
214
|
+
])], !0)], !0)], 34)) : (d(), i("button", {
|
|
127
215
|
key: 1,
|
|
128
216
|
type: "button",
|
|
129
217
|
class: "k-upload__btn",
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
218
|
+
disabled: c.disabled,
|
|
219
|
+
onClick: Z
|
|
220
|
+
}, [h(e.$slots, "trigger", {
|
|
221
|
+
isDragOver: !1,
|
|
222
|
+
open: Z
|
|
223
|
+
}, () => [h(e.$slots, "default", {
|
|
224
|
+
isDragOver: !1,
|
|
225
|
+
open: Z
|
|
226
|
+
}, () => [s(_(C), { size: 14 }), o(" " + g(c.buttonText), 1)], !0)], !0)], 8, A)),
|
|
227
|
+
a("input", {
|
|
133
228
|
ref_key: "fileInputRef",
|
|
134
|
-
ref:
|
|
229
|
+
ref: K,
|
|
135
230
|
type: "file",
|
|
136
|
-
multiple:
|
|
137
|
-
accept:
|
|
231
|
+
multiple: c.multiple,
|
|
232
|
+
accept: c.accept,
|
|
138
233
|
class: "k-upload__input",
|
|
139
|
-
onChange:
|
|
140
|
-
}, null, 40,
|
|
141
|
-
|
|
234
|
+
onChange: Q
|
|
235
|
+
}, null, 40, j),
|
|
236
|
+
c.showList && c.showFileList && W.value.length > 0 ? (d(), i("ul", M, [(d(!0), i(t, null, m(W.value, (e) => (d(), i("li", {
|
|
142
237
|
key: e.id,
|
|
143
|
-
class:
|
|
238
|
+
class: l(["k-upload__item", `k-upload__item--${e.status}`])
|
|
144
239
|
}, [
|
|
145
|
-
|
|
240
|
+
s(_(x), {
|
|
146
241
|
size: 14,
|
|
147
242
|
class: "k-upload__file-icon"
|
|
148
243
|
}),
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
e.status === "uploading" ? (
|
|
244
|
+
a("div", N, [
|
|
245
|
+
a("div", P, g(e.name), 1),
|
|
246
|
+
a("div", F, [o(g(q(e.size)) + " ", 1), e.error ? (d(), i("span", I, "· " + g(e.error), 1)) : r("", !0)]),
|
|
247
|
+
e.status === "uploading" ? (d(), i("div", L, [a("div", {
|
|
153
248
|
class: "k-upload__progress-bar",
|
|
154
|
-
style:
|
|
155
|
-
}, null, 4)])) :
|
|
249
|
+
style: u({ width: e.progress + "%" })
|
|
250
|
+
}, null, 4)])) : r("", !0)
|
|
156
251
|
]),
|
|
157
|
-
|
|
252
|
+
a("div", R, [e.status === "uploading" ? (d(), n(_(S), {
|
|
158
253
|
key: 0,
|
|
159
254
|
size: 14,
|
|
160
255
|
class: "k-upload__spin"
|
|
161
|
-
})) : e.status === "success" ? (
|
|
256
|
+
})) : e.status === "success" ? (d(), n(_(b), {
|
|
162
257
|
key: 1,
|
|
163
258
|
size: 14,
|
|
164
259
|
style: { color: "#10b981" }
|
|
165
|
-
})) : e.status === "error" ? (
|
|
260
|
+
})) : e.status === "error" ? (d(), n(_(y), {
|
|
166
261
|
key: 2,
|
|
167
262
|
size: 14,
|
|
168
263
|
style: { color: "#dc2626" }
|
|
169
|
-
})) :
|
|
170
|
-
|
|
264
|
+
})) : r("", !0)]),
|
|
265
|
+
a("button", {
|
|
171
266
|
type: "button",
|
|
172
267
|
class: "k-upload__remove",
|
|
173
268
|
"aria-label": "移除",
|
|
174
|
-
onClick: (t) =>
|
|
175
|
-
}, [
|
|
176
|
-
], 2))), 128))])) :
|
|
177
|
-
]));
|
|
269
|
+
onClick: (t) => $(e.id)
|
|
270
|
+
}, [s(_(w), { size: 12 })], 8, z)
|
|
271
|
+
], 2))), 128))])) : r("", !0)
|
|
272
|
+
], 2));
|
|
178
273
|
}
|
|
179
274
|
});
|
|
180
275
|
//#endregion
|
|
181
|
-
export {
|
|
276
|
+
export { B as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare var __VLS_1: {};
|
|
2
|
+
type __VLS_Slots = {} & {
|
|
3
|
+
default?: (props: typeof __VLS_1) => any;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
6
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
9
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
10
|
+
new (): {
|
|
11
|
+
$slots: S;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e from "../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "./KUploadDragger.vue_vue_type_script_setup_true_lang.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
//#region components/KUploadDragger.vue
|
|
5
|
+
var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-cce48397"]]);
|
|
6
|
+
//#endregion
|
|
7
|
+
export { n as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { uploadContextKey as e } from "./upload-context.js";
|
|
2
|
+
import { computed as t, createElementBlock as n, defineComponent as r, inject as i, normalizeClass as a, openBlock as o, renderSlot as s } from "vue";
|
|
3
|
+
//#region components/KUploadDragger.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var c = /* @__PURE__ */ r({
|
|
5
|
+
__name: "KUploadDragger",
|
|
6
|
+
setup(r) {
|
|
7
|
+
let c = i(e, null), l = t(() => !!c?.isDragOver.value);
|
|
8
|
+
return (e, t) => (o(), n("div", { class: a(["k-upload-dragger", { "k-upload-dragger--over": l.value }]) }, [s(e.$slots, "default", {}, void 0, !0)], 2));
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
//#endregion
|
|
12
|
+
export { c as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import e from "../_virtual/_plugin-vue_export-helper.js";
|
|
2
2
|
import t from "./KVirtualList.vue_vue_type_script_setup_true_lang.js";
|
|
3
|
-
/* empty css
|
|
3
|
+
/* empty css */
|
|
4
4
|
//#region components/KVirtualList.vue
|
|
5
5
|
var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-9e845dfb"]]);
|
|
6
6
|
//#endregion
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import type { InjectionKey } from 'vue';
|
|
2
2
|
export interface FormRule {
|
|
3
3
|
required?: boolean;
|
|
4
|
+
type?: 'string' | 'number' | 'array' | string;
|
|
4
5
|
min?: number;
|
|
5
6
|
max?: number;
|
|
7
|
+
len?: number;
|
|
6
8
|
pattern?: RegExp;
|
|
7
|
-
validator?: (value: any) => boolean | string | Promise<boolean | string
|
|
9
|
+
validator?: ((rule: FormRule, value: any) => boolean | string | Error | void | Promise<boolean | string | Error | void>) | ((value: any) => boolean | string | Error | void | Promise<boolean | string | Error | void>);
|
|
8
10
|
message?: string;
|
|
9
|
-
trigger?:
|
|
11
|
+
trigger?: string | string[];
|
|
10
12
|
}
|
|
13
|
+
export type FormRules = Record<string, FormRule | FormRule[]>;
|
|
11
14
|
export interface FormFieldRef {
|
|
12
15
|
validate: () => Promise<boolean>;
|
|
13
16
|
reset: () => void;
|
|
@@ -15,10 +18,11 @@ export interface FormFieldRef {
|
|
|
15
18
|
}
|
|
16
19
|
export interface FormContext {
|
|
17
20
|
model: Record<string, any>;
|
|
18
|
-
rules?:
|
|
21
|
+
rules?: FormRules;
|
|
19
22
|
labelWidth: string;
|
|
20
23
|
labelPosition: 'top' | 'left';
|
|
21
24
|
size: 'sm' | 'md' | 'lg';
|
|
25
|
+
disabled: boolean;
|
|
22
26
|
registerField: (name: string, field: FormFieldRef) => void;
|
|
23
27
|
unregisterField: (name: string) => void;
|
|
24
28
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
export { default as KConfigProvider } from './components/KConfigProvider.vue';
|
|
2
|
+
export type { GlobalThemeOverrides } from './components/KConfigProvider.vue';
|
|
1
3
|
export { default as KButton } from './components/KButton.vue';
|
|
2
4
|
export { default as KInput } from './components/KInput.vue';
|
|
3
5
|
export { default as KTextarea } from './components/KTextarea.vue';
|
|
4
6
|
export { default as KInputNumber } from './components/KInputNumber.vue';
|
|
5
7
|
export { default as KSearchBar } from './components/KSearchBar.vue';
|
|
6
8
|
export { default as KTag } from './components/KTag.vue';
|
|
9
|
+
export { default as KIcon } from './components/KIcon.vue';
|
|
10
|
+
export { default as KSlider } from './components/KSlider.vue';
|
|
11
|
+
export { default as KColorPicker } from './components/KColorPicker.vue';
|
|
7
12
|
export { default as KSelect } from './components/KSelect.vue';
|
|
8
13
|
export { default as KCombobox } from './components/KCombobox.vue';
|
|
9
14
|
export { default as KDatePicker } from './components/KDatePicker.vue';
|
|
@@ -14,26 +19,31 @@ export { default as KRadio } from './components/KRadio.vue';
|
|
|
14
19
|
export { default as KRadioGroup } from './components/KRadioGroup.vue';
|
|
15
20
|
export { default as KForm } from './components/KForm.vue';
|
|
16
21
|
export { default as KFormField } from './components/KFormField.vue';
|
|
17
|
-
export type { FormRule, FormFieldRef } from './components/form-context';
|
|
22
|
+
export type { FormRule, FormRules, FormFieldRef } from './components/form-context';
|
|
18
23
|
export { default as KConfirmDialog } from './components/KConfirmDialog.vue';
|
|
19
24
|
export { default as KDialog } from './components/KDialog.vue';
|
|
20
25
|
export { default as KDrawer } from './components/KDrawer.vue';
|
|
21
26
|
export { default as KTooltip } from './components/KTooltip.vue';
|
|
22
27
|
export { default as KPopover } from './components/KPopover.vue';
|
|
28
|
+
export { default as KPopconfirm } from './components/KPopconfirm.vue';
|
|
23
29
|
export { default as KDropdown } from './components/KDropdown.vue';
|
|
24
30
|
export type { DropdownItem } from './components/KDropdown.vue';
|
|
25
31
|
export { default as KAlert } from './components/KAlert.vue';
|
|
26
32
|
export { KMessage } from './components/KMessage';
|
|
27
33
|
export type { MessageOptions } from './components/KMessage';
|
|
34
|
+
export { KNotification, useNotification } from './components/KNotification';
|
|
35
|
+
export type { NotificationOptions, NotificationReactive } from './components/KNotification';
|
|
36
|
+
export { default as KNotificationProvider } from './components/KNotificationProvider.vue';
|
|
28
37
|
export { useConfirm } from './composables/useConfirm';
|
|
29
38
|
export type { ConfirmOptions } from './composables/useConfirm';
|
|
30
39
|
export { default as KDataTable } from './components/KDataTable.vue';
|
|
31
|
-
export type { Column } from './components/KDataTable.vue';
|
|
40
|
+
export type { Column, DataTableColumn, DataTableColumns } from './components/KDataTable.vue';
|
|
32
41
|
export { default as KPagination } from './components/KPagination.vue';
|
|
33
42
|
export { default as KEmpty } from './components/KEmpty.vue';
|
|
34
43
|
export { default as KLoadingOverlay } from './components/KLoadingOverlay.vue';
|
|
35
44
|
export { default as KRefetchOverlay } from './components/KRefetchOverlay.vue';
|
|
36
45
|
export { default as KProgress } from './components/KProgress.vue';
|
|
46
|
+
export { default as KSpin } from './components/KSpin.vue';
|
|
37
47
|
export { default as KAvatar } from './components/KAvatar.vue';
|
|
38
48
|
export { default as KAvatarGroup } from './components/KAvatarGroup.vue';
|
|
39
49
|
export { default as KSkeleton } from './components/KSkeleton.vue';
|
|
@@ -42,6 +52,9 @@ export { default as KGridSkeleton } from './components/KGridSkeleton.vue';
|
|
|
42
52
|
export { default as KTabs } from './components/KTabs.vue';
|
|
43
53
|
export { default as KBreadcrumb } from './components/KBreadcrumb.vue';
|
|
44
54
|
export { default as KCard } from './components/KCard.vue';
|
|
55
|
+
export { default as KDescriptions } from './components/KDescriptions.vue';
|
|
56
|
+
export { default as KDescriptionsItem } from './components/KDescriptionsItem.vue';
|
|
57
|
+
export type { DescriptionItem } from './components/KDescriptions.vue';
|
|
45
58
|
export { default as KResult } from './components/KResult.vue';
|
|
46
59
|
export { default as KSteps } from './components/KSteps.vue';
|
|
47
60
|
export { default as KImage } from './components/KImage.vue';
|
|
@@ -49,7 +62,8 @@ export { default as KImageViewer } from './components/KImageViewer.vue';
|
|
|
49
62
|
export { default as KCarousel } from './components/KCarousel.vue';
|
|
50
63
|
export type { CarouselItem } from './components/KCarousel.vue';
|
|
51
64
|
export { default as KUpload } from './components/KUpload.vue';
|
|
52
|
-
export
|
|
65
|
+
export { default as KUploadDragger } from './components/KUploadDragger.vue';
|
|
66
|
+
export type { UploadFile, UploadFileInfo, UploadCustomRequestOptions } from './components/KUpload.vue';
|
|
53
67
|
export { default as KCommandPalette } from './components/KCommandPalette.vue';
|
|
54
68
|
export type { CmdItem } from './components/KCommandPalette.vue';
|
|
55
69
|
export { default as KVirtualList } from './components/KVirtualList.vue';
|