@kernel4632/kima 0.8.5 → 0.8.7
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/dist/components/advanced-input/editable.ce.vue_vue_type_style_index_0_scoped_82c96de0_lang.css +1 -0
- package/dist/components/core/{text-field.ce.vue_vue_type_style_index_0_scoped_7334ab60_lang.css → text-field.ce.vue_vue_type_style_index_0_scoped_f22e5c02_lang.css} +1 -1
- package/dist/components/data/table.ce.vue_vue_type_style_index_0_scoped_c1ac8a33_lang.css +1 -0
- package/dist/components/display/list.ce.vue_vue_type_style_index_0_scoped_df3ec98f_lang.css +1 -0
- package/dist/components/display/skeleton.ce.vue_vue_type_style_index_0_scoped_92807af5_lang.css +1 -0
- package/dist/components/display/timeline.ce.vue_vue_type_style_index_0_scoped_72323605_lang.css +1 -0
- package/dist/components/form-completion/dynamic-input.ce.vue_vue_type_style_index_0_scoped_6a5bc26a_lang.css +1 -0
- package/dist/components/form-completion/upload-manager.ce.vue_vue_type_style_index_0_scoped_fe810c3a_lang.css +1 -0
- package/dist/components/input/field.ce.vue_vue_type_style_index_0_scoped_a01eded5_lang.css +1 -0
- package/dist/components/input/{file-upload.ce.vue_vue_type_style_index_0_scoped_1568bdab_lang.css → file-upload.ce.vue_vue_type_style_index_0_scoped_8fd77a68_lang.css} +1 -1
- package/dist/components/input/tags-input.ce.vue_vue_type_style_index_0_scoped_b46618b2_lang.css +1 -0
- package/dist/components/input/textarea.ce.vue_vue_type_style_index_0_scoped_60d0751b_lang.css +1 -0
- package/dist/components/interaction/multi-select.ce.vue_vue_type_style_index_0_scoped_cf70a212_lang.css +1 -0
- package/dist/components/navigation/carousel.ce.vue_vue_type_style_index_0_scoped_03e729d7_lang.css +1 -0
- package/dist/components/utility/progress-group.ce.vue_vue_type_style_index_0_scoped_d4453504_lang.css +1 -0
- package/dist/components/utility/tag-group.ce.vue_vue_type_style_index_0_scoped_892954ad_lang.css +1 -0
- package/dist/kima-elements-core.js +9739 -9684
- package/dist/kima-elements.js +11180 -11079
- package/dist/style.css +16 -16
- package/dist/styles/carousel.css +1 -1
- package/dist/styles/core.css +5 -5
- package/dist/styles/dynamic-input.css +1 -1
- package/dist/styles/editable.css +1 -1
- package/dist/styles/field.css +1 -1
- package/dist/styles/file-upload.css +1 -1
- package/dist/styles/list.css +1 -1
- package/dist/styles/multi-select.css +1 -1
- package/dist/styles/progress-group.css +1 -1
- package/dist/styles/skeleton.css +1 -1
- package/dist/styles/table.css +1 -1
- package/dist/styles/tag-group.css +1 -1
- package/dist/styles/tags-input.css +1 -1
- package/dist/styles/text-field.css +1 -1
- package/dist/styles/textarea.css +1 -1
- package/dist/styles/timeline.css +1 -1
- package/dist/styles/upload-manager.css +2 -2
- package/dist/vue/components/advanced-input/editable.ce.js +70 -69
- package/dist/vue/components/core/text-field.ce.js +66 -65
- package/dist/vue/components/data/table.ce.js +230 -232
- package/dist/vue/components/display/list.ce.js +28 -22
- package/dist/vue/components/display/skeleton.ce.js +27 -20
- package/dist/vue/components/display/timeline.ce.js +33 -25
- package/dist/vue/components/form-completion/dynamic-input.ce.js +75 -68
- package/dist/vue/components/form-completion/upload-manager.ce.js +91 -82
- package/dist/vue/components/input/field.ce.js +25 -23
- package/dist/vue/components/input/file-upload.ce.js +70 -64
- package/dist/vue/components/input/tags-input.ce.js +62 -56
- package/dist/vue/components/input/textarea.ce.js +36 -35
- package/dist/vue/components/interaction/multi-select.ce.js +95 -90
- package/dist/vue/components/navigation/carousel.ce.js +1 -1
- package/dist/vue/components/utility/progress-group.ce.js +26 -22
- package/dist/vue/components/utility/tag-group.ce.js +51 -45
- package/dist/vue/utils/content-motion.js +63 -28
- package/dist/vue/utils/motion.js +32 -17
- package/package.json +1 -1
- package/dist/components/advanced-input/editable.ce.vue_vue_type_style_index_0_scoped_91cd5b33_lang.css +0 -1
- package/dist/components/data/table.ce.vue_vue_type_style_index_0_scoped_44836eb1_lang.css +0 -1
- package/dist/components/display/list.ce.vue_vue_type_style_index_0_scoped_1c170b37_lang.css +0 -1
- package/dist/components/display/skeleton.ce.vue_vue_type_style_index_0_scoped_d9a7d212_lang.css +0 -1
- package/dist/components/display/timeline.ce.vue_vue_type_style_index_0_scoped_ff6a1726_lang.css +0 -1
- package/dist/components/form-completion/dynamic-input.ce.vue_vue_type_style_index_0_scoped_5913d05a_lang.css +0 -1
- package/dist/components/form-completion/upload-manager.ce.vue_vue_type_style_index_0_scoped_5d214e0f_lang.css +0 -1
- package/dist/components/input/field.ce.vue_vue_type_style_index_0_scoped_f2ce3fc2_lang.css +0 -1
- package/dist/components/input/tags-input.ce.vue_vue_type_style_index_0_scoped_7a178bc6_lang.css +0 -1
- package/dist/components/input/textarea.ce.vue_vue_type_style_index_0_scoped_c0cc3612_lang.css +0 -1
- package/dist/components/interaction/multi-select.ce.vue_vue_type_style_index_0_scoped_b5be8e98_lang.css +0 -1
- package/dist/components/navigation/carousel.ce.vue_vue_type_style_index_0_scoped_6a7ca57f_lang.css +0 -1
- package/dist/components/utility/progress-group.ce.vue_vue_type_style_index_0_scoped_681cf67d_lang.css +0 -1
- package/dist/components/utility/tag-group.ce.vue_vue_type_style_index_0_scoped_3d44ac1c_lang.css +0 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import e from "../../_virtual/_plugin-vue_export-helper.js";
|
|
2
2
|
import t from "../core/button.ce.js";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
3
|
+
import { freezeLeaveLayout as n, presenceTransition as r } from "../../utils/motion.js";
|
|
4
|
+
import { useContentMotion as i } from "../../utils/content-motion.js";
|
|
5
|
+
import a from "../input/file-upload.ce.js";
|
|
5
6
|
/* empty css */
|
|
6
|
-
import { Fragment as
|
|
7
|
+
import { Fragment as o, TransitionGroup as s, computed as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createTextVNode as p, createVNode as m, mergeProps as h, onBeforeUnmount as g, openBlock as _, ref as v, renderList as y, toDisplayString as b, unref as x, watch as S, withCtx as C } from "vue";
|
|
7
8
|
// src/components/form-completion/upload-manager.ce.vue
|
|
8
|
-
var
|
|
9
|
+
var w = ["aria-disabled"], T = { class: "kima-upload-manager__info" }, E = ["value", "aria-label"], D = { role: "status" }, O = { class: "kima-upload-manager__actions" }, k = /*#__PURE__*/ e({
|
|
9
10
|
__name: "upload-manager.ce",
|
|
10
11
|
props: {
|
|
11
12
|
modelValue: {
|
|
@@ -36,21 +37,24 @@ var S = ["aria-disabled"], C = { class: "kima-upload-manager__info" }, w = ["val
|
|
|
36
37
|
"error",
|
|
37
38
|
"cancel"
|
|
38
39
|
],
|
|
39
|
-
setup(e, { expose:
|
|
40
|
-
let
|
|
41
|
-
|
|
40
|
+
setup(e, { expose: k, emit: A }) {
|
|
41
|
+
let j = e, M = A, N = 0, P = v([]), F = /* @__PURE__ */ new Map();
|
|
42
|
+
v(null);
|
|
43
|
+
let I = v(null), L = c(() => P.value.filter((e) => e.status === "queued"));
|
|
44
|
+
i(I, () => P.value);
|
|
45
|
+
function R(e) {
|
|
42
46
|
let t = [...e].map((e) => ({
|
|
43
|
-
id: ++
|
|
47
|
+
id: ++N,
|
|
44
48
|
file: e,
|
|
45
49
|
status: "queued",
|
|
46
50
|
progress: 0,
|
|
47
51
|
error: "",
|
|
48
52
|
result: null
|
|
49
53
|
}));
|
|
50
|
-
|
|
54
|
+
P.value = [...P.value, ...t], z(), V();
|
|
51
55
|
}
|
|
52
|
-
function
|
|
53
|
-
let e =
|
|
56
|
+
function z() {
|
|
57
|
+
let e = P.value.map(({ id: e, file: t, status: n, progress: r, error: i, result: a }) => ({
|
|
54
58
|
id: e,
|
|
55
59
|
file: t,
|
|
56
60
|
status: n,
|
|
@@ -58,157 +62,162 @@ var S = ["aria-disabled"], C = { class: "kima-upload-manager__info" }, w = ["val
|
|
|
58
62
|
error: i,
|
|
59
63
|
result: a
|
|
60
64
|
}));
|
|
61
|
-
|
|
65
|
+
M("update:modelValue", e), M("change", e);
|
|
62
66
|
}
|
|
63
|
-
function
|
|
64
|
-
Object.assign(e, t),
|
|
67
|
+
function B(e, t) {
|
|
68
|
+
Object.assign(e, t), z();
|
|
65
69
|
}
|
|
66
|
-
function
|
|
67
|
-
for (;
|
|
68
|
-
let e =
|
|
69
|
-
|
|
70
|
+
function V() {
|
|
71
|
+
for (; F.size < Math.max(1, Math.floor(j.concurrency)) && L.value.length;) {
|
|
72
|
+
let e = L.value[0];
|
|
73
|
+
H(e);
|
|
70
74
|
}
|
|
71
75
|
}
|
|
72
|
-
async function
|
|
73
|
-
if (typeof
|
|
74
|
-
|
|
76
|
+
async function H(e) {
|
|
77
|
+
if (typeof j.upload != "function") {
|
|
78
|
+
B(e, {
|
|
75
79
|
status: "error",
|
|
76
80
|
error: "缺少 upload(file, { signal, onProgress }) 宿主处理函数"
|
|
77
|
-
}),
|
|
81
|
+
}), M("error", {
|
|
78
82
|
task: e,
|
|
79
83
|
error: Error(e.error)
|
|
80
84
|
});
|
|
81
85
|
return;
|
|
82
86
|
}
|
|
83
87
|
let t = new AbortController();
|
|
84
|
-
|
|
88
|
+
F.set(e.id, t), B(e, {
|
|
85
89
|
status: "uploading",
|
|
86
90
|
error: "",
|
|
87
91
|
progress: 0
|
|
88
92
|
});
|
|
89
93
|
try {
|
|
90
|
-
let n = await
|
|
94
|
+
let n = await j.upload(e.file, {
|
|
91
95
|
signal: t.signal,
|
|
92
96
|
onProgress: (n) => {
|
|
93
|
-
if (
|
|
97
|
+
if (F.get(e.id) !== t) return;
|
|
94
98
|
let r = Math.max(0, Math.min(100, Number(n) || 0));
|
|
95
|
-
e.progress = r,
|
|
99
|
+
e.progress = r, M("progress", {
|
|
96
100
|
task: e,
|
|
97
101
|
file: e.file,
|
|
98
102
|
progress: r
|
|
99
|
-
}),
|
|
103
|
+
}), z();
|
|
100
104
|
}
|
|
101
105
|
});
|
|
102
|
-
if (
|
|
103
|
-
|
|
106
|
+
if (F.get(e.id) !== t) return;
|
|
107
|
+
B(e, {
|
|
104
108
|
status: "success",
|
|
105
109
|
progress: 100,
|
|
106
110
|
result: n
|
|
107
|
-
}),
|
|
111
|
+
}), M("success", {
|
|
108
112
|
task: e,
|
|
109
113
|
result: n
|
|
110
114
|
});
|
|
111
115
|
} catch (n) {
|
|
112
|
-
if (
|
|
113
|
-
t.signal.aborted ? (
|
|
116
|
+
if (F.get(e.id) !== t) return;
|
|
117
|
+
t.signal.aborted ? (B(e, { status: "cancelled" }), M("cancel", e)) : (B(e, {
|
|
114
118
|
status: "error",
|
|
115
119
|
error: n?.message || String(n)
|
|
116
|
-
}),
|
|
120
|
+
}), M("error", {
|
|
117
121
|
task: e,
|
|
118
122
|
error: n
|
|
119
123
|
}));
|
|
120
124
|
} finally {
|
|
121
|
-
|
|
125
|
+
F.get(e.id) === t && F.delete(e.id), V();
|
|
122
126
|
}
|
|
123
127
|
}
|
|
124
|
-
function
|
|
125
|
-
if (e.status === "queued")
|
|
128
|
+
function U(e) {
|
|
129
|
+
if (e.status === "queued") B(e, { status: "cancelled" }), M("cancel", e);
|
|
126
130
|
else if (e.status === "uploading") {
|
|
127
|
-
let t =
|
|
131
|
+
let t = F.get(e.id);
|
|
128
132
|
if (!t) return;
|
|
129
|
-
|
|
133
|
+
F.delete(e.id), t.abort(), B(e, { status: "cancelled" }), M("cancel", e), V();
|
|
130
134
|
}
|
|
131
135
|
}
|
|
132
|
-
function
|
|
133
|
-
(e.status === "error" || e.status === "cancelled") && (
|
|
136
|
+
function W(e) {
|
|
137
|
+
(e.status === "error" || e.status === "cancelled") && (B(e, {
|
|
134
138
|
status: "queued",
|
|
135
139
|
progress: 0,
|
|
136
140
|
error: "",
|
|
137
141
|
result: null
|
|
138
|
-
}),
|
|
142
|
+
}), V());
|
|
139
143
|
}
|
|
140
|
-
function
|
|
141
|
-
|
|
144
|
+
function G(e) {
|
|
145
|
+
U(e), P.value = P.value.filter((t) => t.id !== e.id), z();
|
|
142
146
|
}
|
|
143
|
-
return
|
|
144
|
-
Array.isArray(e) && e.length && !
|
|
147
|
+
return S(() => j.modelValue, (e) => {
|
|
148
|
+
Array.isArray(e) && e.length && !P.value.length && (P.value = e.map((e) => ({
|
|
145
149
|
...e,
|
|
146
|
-
id: e.id || ++
|
|
150
|
+
id: e.id || ++N
|
|
147
151
|
})));
|
|
148
|
-
}),
|
|
149
|
-
for (let e of
|
|
150
|
-
|
|
151
|
-
}),
|
|
152
|
-
add:
|
|
153
|
-
cancel:
|
|
154
|
-
retry:
|
|
155
|
-
remove:
|
|
156
|
-
tasks:
|
|
157
|
-
pump:
|
|
158
|
-
}), (
|
|
152
|
+
}), g(() => {
|
|
153
|
+
for (let e of F.values()) e.abort();
|
|
154
|
+
F.clear();
|
|
155
|
+
}), k({
|
|
156
|
+
add: R,
|
|
157
|
+
cancel: U,
|
|
158
|
+
retry: W,
|
|
159
|
+
remove: G,
|
|
160
|
+
tasks: P,
|
|
161
|
+
pump: V
|
|
162
|
+
}), (i, c) => (_(), d("section", {
|
|
163
|
+
ref_key: "root",
|
|
164
|
+
ref: I,
|
|
159
165
|
class: "kima-upload-manager",
|
|
160
166
|
"aria-disabled": e.disabled || void 0
|
|
161
|
-
}, [
|
|
162
|
-
"model-value":
|
|
167
|
+
}, [m(a, {
|
|
168
|
+
"model-value": P.value.map((e) => e.file),
|
|
163
169
|
label: e.label,
|
|
164
170
|
accept: e.accept,
|
|
165
171
|
multiple: e.multiple,
|
|
166
172
|
disabled: e.disabled,
|
|
167
|
-
"onUpdate:modelValue":
|
|
173
|
+
"onUpdate:modelValue": c[0] ||= (e) => R(e.slice(P.value.filter((e) => e.status !== "cancelled").length))
|
|
168
174
|
}, null, 8, [
|
|
169
175
|
"model-value",
|
|
170
176
|
"label",
|
|
171
177
|
"accept",
|
|
172
178
|
"multiple",
|
|
173
179
|
"disabled"
|
|
174
|
-
]),
|
|
180
|
+
]), m(s, h({
|
|
175
181
|
tag: "ul",
|
|
176
182
|
name: "kima-list"
|
|
177
|
-
},
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
183
|
+
}, {
|
|
184
|
+
...x(r),
|
|
185
|
+
onBeforeLeave: x(n)
|
|
186
|
+
}, { class: "kima-upload-manager__list" }), {
|
|
187
|
+
default: C(() => [(_(!0), d(o, null, y(P.value, (n) => (_(), d("li", { key: n.id }, [f("div", T, [
|
|
188
|
+
f("strong", null, b(n.file.name), 1),
|
|
189
|
+
f("progress", {
|
|
181
190
|
max: "100",
|
|
182
191
|
value: n.progress,
|
|
183
192
|
"aria-label": `${n.file.name}上传进度`
|
|
184
|
-
}, null, 8,
|
|
185
|
-
|
|
186
|
-
]),
|
|
187
|
-
n.status === "uploading" || n.status === "queued" ? (
|
|
193
|
+
}, null, 8, E),
|
|
194
|
+
f("span", D, b(n.status === "queued" ? "等待中" : n.status === "uploading" ? `${n.progress}%` : n.status === "success" ? "已完成" : n.status === "cancelled" ? "已取消" : n.error), 1)
|
|
195
|
+
]), f("div", O, [
|
|
196
|
+
n.status === "uploading" || n.status === "queued" ? (_(), l(t, {
|
|
188
197
|
key: 0,
|
|
189
198
|
variant: "text",
|
|
190
199
|
disabled: e.disabled,
|
|
191
|
-
onClick: (e) =>
|
|
200
|
+
onClick: (e) => U(n)
|
|
192
201
|
}, {
|
|
193
|
-
default:
|
|
202
|
+
default: C(() => [...c[1] ||= [p("取消", -1)]]),
|
|
194
203
|
_: 1
|
|
195
|
-
}, 8, ["disabled", "onClick"])) :
|
|
196
|
-
n.status === "error" || n.status === "cancelled" ? (
|
|
204
|
+
}, 8, ["disabled", "onClick"])) : u("", !0),
|
|
205
|
+
n.status === "error" || n.status === "cancelled" ? (_(), l(t, {
|
|
197
206
|
key: 1,
|
|
198
207
|
variant: "text",
|
|
199
208
|
disabled: e.disabled,
|
|
200
|
-
onClick: (e) =>
|
|
209
|
+
onClick: (e) => W(n)
|
|
201
210
|
}, {
|
|
202
|
-
default:
|
|
211
|
+
default: C(() => [...c[2] ||= [p("重试", -1)]]),
|
|
203
212
|
_: 1
|
|
204
|
-
}, 8, ["disabled", "onClick"])) :
|
|
205
|
-
|
|
213
|
+
}, 8, ["disabled", "onClick"])) : u("", !0),
|
|
214
|
+
m(t, {
|
|
206
215
|
variant: "text",
|
|
207
216
|
disabled: e.disabled,
|
|
208
217
|
"aria-label": `移除 ${n.file.name}`,
|
|
209
|
-
onClick: (e) =>
|
|
218
|
+
onClick: (e) => G(n)
|
|
210
219
|
}, {
|
|
211
|
-
default:
|
|
220
|
+
default: C(() => [...c[3] ||= [p("移除", -1)]]),
|
|
212
221
|
_: 1
|
|
213
222
|
}, 8, [
|
|
214
223
|
"disabled",
|
|
@@ -217,7 +226,7 @@ var S = ["aria-disabled"], C = { class: "kima-upload-manager__info" }, w = ["val
|
|
|
217
226
|
])
|
|
218
227
|
])]))), 128))]),
|
|
219
228
|
_: 1
|
|
220
|
-
}, 16)], 8,
|
|
229
|
+
}, 16)], 8, w));
|
|
221
230
|
}
|
|
222
|
-
}, [["__scopeId", "data-v-
|
|
223
|
-
export {
|
|
231
|
+
}, [["__scopeId", "data-v-fe810c3a"]]);
|
|
232
|
+
export { k as default };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useNativeSlots as e } from "../../utils/native-slots.js";
|
|
2
2
|
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
3
|
-
import { collapseTransition as n
|
|
3
|
+
import { collapseTransition as n } from "../../utils/motion.js";
|
|
4
|
+
import { useContentMotion as r } from "../../utils/content-motion.js";
|
|
4
5
|
/* empty css */
|
|
5
6
|
import { Transition as i, computed as a, createElementBlock as o, createElementVNode as s, createVNode as c, mergeProps as l, onBeforeUnmount as u, onMounted as d, openBlock as f, ref as p, renderSlot as m, toDisplayString as h, unref as g, useId as _, vShow as v, watch as y, withCtx as b, withDirectives as x } from "vue";
|
|
6
7
|
// src/components/input/field.ce.vue
|
|
@@ -19,56 +20,57 @@ var S = ["inert", "aria-hidden"], C = ["role"], w = /*#__PURE__*/ t({
|
|
|
19
20
|
setup(t) {
|
|
20
21
|
let w = t, T = p(null);
|
|
21
22
|
e(T);
|
|
22
|
-
let E = `kima-field-${_()}`, D = a(() => w.error || w.hint), O = p(
|
|
23
|
+
let E = `kima-field-${_()}`, D = a(() => w.error || w.hint), O = p(null);
|
|
24
|
+
r(O, () => [D.value, !!w.error]);
|
|
25
|
+
let k = p(D.value), A = p(!!w.error);
|
|
23
26
|
y([D, () => w.error], ([e, t]) => {
|
|
24
|
-
e && (
|
|
27
|
+
e && (k.value = e, A.value = !!t);
|
|
25
28
|
});
|
|
26
|
-
let
|
|
27
|
-
function
|
|
29
|
+
let j = /* @__PURE__ */ new Set(), M = /* @__PURE__ */ new Set(), N;
|
|
30
|
+
function P() {
|
|
28
31
|
return [...T.value.querySelectorAll("input:not([type=\"hidden\"]),textarea,select,button[role=\"combobox\"],[role=\"radiogroup\"]")].filter((e) => e.closest(".kima-field") === T.value);
|
|
29
32
|
}
|
|
30
|
-
function
|
|
31
|
-
if (T.value) for (let e of
|
|
33
|
+
function F() {
|
|
34
|
+
if (T.value) for (let e of P()) {
|
|
32
35
|
let t = (e.getAttribute("aria-describedby") || "").split(/\s+/).filter(Boolean).filter((e) => e !== E);
|
|
33
|
-
D.value && (t.push(E),
|
|
36
|
+
D.value && (t.push(E), M.add(e));
|
|
34
37
|
let n = t.join(" ");
|
|
35
|
-
(e.getAttribute("aria-describedby") || "") !== n && (n ? e.setAttribute("aria-describedby", n) : e.removeAttribute("aria-describedby")), w.error && !e.hasAttribute("aria-invalid") && (e.setAttribute("aria-invalid", "true"),
|
|
38
|
+
(e.getAttribute("aria-describedby") || "") !== n && (n ? e.setAttribute("aria-describedby", n) : e.removeAttribute("aria-describedby")), w.error && !e.hasAttribute("aria-invalid") && (e.setAttribute("aria-invalid", "true"), j.add(e)), !w.error && j.has(e) && (e.removeAttribute("aria-invalid"), j.delete(e));
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
|
-
return y(D,
|
|
39
|
-
|
|
41
|
+
return y(D, F, { flush: "post" }), y(() => w.error, F, { flush: "post" }), d(() => {
|
|
42
|
+
F(), N = new MutationObserver(F), N.observe(T.value, {
|
|
40
43
|
childList: !0,
|
|
41
44
|
subtree: !0,
|
|
42
45
|
attributes: !0,
|
|
43
46
|
attributeFilter: ["aria-describedby", "aria-invalid"]
|
|
44
47
|
});
|
|
45
48
|
}), u(() => {
|
|
46
|
-
|
|
47
|
-
for (let e of
|
|
49
|
+
N?.disconnect();
|
|
50
|
+
for (let e of M) {
|
|
48
51
|
let t = (e.getAttribute("aria-describedby") || "").split(/\s+/).filter((e) => e && e !== E);
|
|
49
52
|
t.length ? e.setAttribute("aria-describedby", t.join(" ")) : e.removeAttribute("aria-describedby");
|
|
50
53
|
}
|
|
51
|
-
for (let e of
|
|
54
|
+
for (let e of j) e.removeAttribute("aria-invalid");
|
|
52
55
|
}), (e, t) => (f(), o("div", {
|
|
53
56
|
ref_key: "root",
|
|
54
57
|
ref: T,
|
|
55
58
|
class: "kima-field"
|
|
56
59
|
}, [m(e.$slots, "default", {}, void 0, !0), c(i, l({ css: !1 }, g(n)), {
|
|
57
60
|
default: b(() => [x(s("div", {
|
|
61
|
+
ref_key: "messageWrap",
|
|
62
|
+
ref: O,
|
|
58
63
|
id: E,
|
|
59
64
|
class: "kima-field__messages",
|
|
60
65
|
inert: !D.value,
|
|
61
66
|
"aria-hidden": !D.value || void 0
|
|
62
|
-
}, [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}, h(O.value), 9, C))]),
|
|
68
|
-
_: 1
|
|
69
|
-
}, 16)], 8, S), [[v, D.value]])]),
|
|
67
|
+
}, [(f(), o("p", {
|
|
68
|
+
key: `${A.value}:${k.value}`,
|
|
69
|
+
class: "kima-field__message",
|
|
70
|
+
role: A.value ? "alert" : void 0
|
|
71
|
+
}, h(k.value), 9, C))], 8, S), [[v, D.value]])]),
|
|
70
72
|
_: 1
|
|
71
73
|
}, 16)], 512));
|
|
72
74
|
}
|
|
73
|
-
}, [["__scopeId", "data-v-
|
|
75
|
+
}, [["__scopeId", "data-v-a01eded5"]]);
|
|
74
76
|
export { w as default };
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { useRipple as e } from "../../utils/ripple.js";
|
|
2
2
|
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
3
|
-
import { collapseTransition as n,
|
|
4
|
-
import { useInputAttrs as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
3
|
+
import { collapseTransition as n, freezeLeaveLayout as r, presenceTransition as i } from "../../utils/motion.js";
|
|
4
|
+
import { useInputAttrs as a, useInputState as o } from "../../utils/input-state.js";
|
|
5
|
+
import s from "../core/icon-button.ce.js";
|
|
6
|
+
import c from "../core/tooltip.ce.js";
|
|
7
|
+
import { useContentMotion as l } from "../../utils/content-motion.js";
|
|
7
8
|
/* empty css */
|
|
8
|
-
import { Fragment as
|
|
9
|
-
import { Cancel01Icon as
|
|
9
|
+
import { Fragment as u, Transition as d, TransitionGroup as f, createElementBlock as p, createElementVNode as m, createVNode as h, mergeProps as g, nextTick as _, normalizeClass as v, normalizeStyle as y, openBlock as b, ref as x, renderList as S, toDisplayString as C, toRaw as w, unref as T, vShow as E, watch as D, withCtx as O, withDirectives as k, withModifiers as A } from "vue";
|
|
10
|
+
import { Cancel01Icon as j } from "@hugeicons/core-free-icons";
|
|
10
11
|
// src/components/input/file-upload.ce.vue
|
|
11
|
-
var
|
|
12
|
+
var M = ["aria-disabled"], N = ["aria-disabled"], P = [
|
|
12
13
|
"aria-label",
|
|
13
14
|
"name",
|
|
14
15
|
"accept",
|
|
15
16
|
"multiple",
|
|
16
17
|
"disabled",
|
|
17
18
|
"required"
|
|
18
|
-
],
|
|
19
|
+
], F = ["inert", "aria-hidden"], I = { class: "kima-file-upload__filename" }, L = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
19
20
|
__name: "file-upload.ce",
|
|
20
21
|
props: {
|
|
21
22
|
modelValue: {
|
|
@@ -45,92 +46,97 @@ var A = ["aria-disabled"], j = ["aria-disabled"], M = [
|
|
|
45
46
|
"change",
|
|
46
47
|
"reject"
|
|
47
48
|
],
|
|
48
|
-
setup(t, { emit:
|
|
49
|
-
let
|
|
50
|
-
e(
|
|
51
|
-
function
|
|
52
|
-
if (!
|
|
49
|
+
setup(t, { emit: L }) {
|
|
50
|
+
let R = t, z = L, B = x(null), V = x(null), H = x(!1), { attrs: U, controlAttrs: W } = a(), { local: G, update: K } = o(R, z, B, (e) => Array.isArray(e) ? e : [], () => _(J)), q = x(null);
|
|
51
|
+
l(B, () => G.value), e(B);
|
|
52
|
+
function J() {
|
|
53
|
+
if (!V.value) return;
|
|
53
54
|
let e = new DataTransfer();
|
|
54
|
-
for (let t of
|
|
55
|
-
|
|
55
|
+
for (let t of G.value) t instanceof File && e.items.add(t);
|
|
56
|
+
V.value.files = e.files;
|
|
56
57
|
}
|
|
57
|
-
|
|
58
|
+
D(G, () => _(J), {
|
|
58
59
|
immediate: !0,
|
|
59
60
|
deep: !0
|
|
60
61
|
});
|
|
61
|
-
function
|
|
62
|
-
return !
|
|
62
|
+
function Y(e) {
|
|
63
|
+
return !R.accept || R.accept.split(",").some((t) => {
|
|
63
64
|
let n = t.trim().toLowerCase();
|
|
64
65
|
return n ? n.startsWith(".") ? e.name.toLowerCase().endsWith(n) : n.endsWith("/*") ? e.type.toLowerCase().startsWith(n.slice(0, -1)) : e.type.toLowerCase() === n : !1;
|
|
65
66
|
});
|
|
66
67
|
}
|
|
67
|
-
function
|
|
68
|
-
if (
|
|
69
|
-
let t = [], n = Math.max(0,
|
|
68
|
+
function X(e) {
|
|
69
|
+
if (R.disabled) return;
|
|
70
|
+
let t = [], n = Math.max(0, R.multiple ? R.maxFiles : Math.min(1, R.maxFiles));
|
|
70
71
|
for (let r of e) {
|
|
71
|
-
let e =
|
|
72
|
-
e ?
|
|
72
|
+
let e = Y(r) ? r.size > R.maxSize ? "size" : t.length >= n ? "count" : "" : "accept";
|
|
73
|
+
e ? z("reject", {
|
|
73
74
|
file: r,
|
|
74
75
|
reason: e
|
|
75
76
|
}) : t.push(r);
|
|
76
77
|
}
|
|
77
|
-
|
|
78
|
+
K(t), _(J);
|
|
78
79
|
}
|
|
79
|
-
function
|
|
80
|
-
|
|
80
|
+
function Z(e) {
|
|
81
|
+
H.value = !1, X([...e.dataTransfer.files]);
|
|
81
82
|
}
|
|
82
|
-
function
|
|
83
|
-
|
|
83
|
+
function Q(e) {
|
|
84
|
+
R.disabled || K(G.value.filter((t, n) => n !== e));
|
|
84
85
|
}
|
|
85
|
-
let
|
|
86
|
-
function
|
|
87
|
-
let n =
|
|
88
|
-
|
|
89
|
-
let r =
|
|
90
|
-
return `${
|
|
86
|
+
let $ = /* @__PURE__ */ new WeakMap(), ee = 0;
|
|
87
|
+
function te(e, t) {
|
|
88
|
+
let n = w(e);
|
|
89
|
+
$.has(n) || $.set(n, ++ee);
|
|
90
|
+
let r = G.value.slice(0, t).filter((e) => w(e) === n).length;
|
|
91
|
+
return `${$.get(n)}-${r}`;
|
|
91
92
|
}
|
|
92
|
-
return (e,
|
|
93
|
-
class: g(["kima-file-upload", C(V).class]),
|
|
94
|
-
style: _(C(V).style),
|
|
95
|
-
"aria-disabled": t.disabled || void 0
|
|
96
|
-
}, [f("div", {
|
|
93
|
+
return (e, a) => (b(), p("div", {
|
|
97
94
|
ref_key: "root",
|
|
98
|
-
ref:
|
|
99
|
-
class:
|
|
95
|
+
ref: B,
|
|
96
|
+
class: v(["kima-file-upload", T(U).class]),
|
|
97
|
+
style: y(T(U).style),
|
|
98
|
+
"aria-disabled": t.disabled || void 0
|
|
99
|
+
}, [m("div", {
|
|
100
|
+
class: v(["kima-file-upload__drop", { "kima-file-upload__drop--active": H.value && !t.disabled }]),
|
|
100
101
|
"aria-disabled": t.disabled || void 0,
|
|
101
|
-
onDragover:
|
|
102
|
-
onDragleave:
|
|
103
|
-
onDrop:
|
|
104
|
-
}, [
|
|
102
|
+
onDragover: a[2] ||= A((e) => H.value = !0, ["prevent"]),
|
|
103
|
+
onDragleave: a[3] ||= A((e) => H.value = !1, ["prevent"]),
|
|
104
|
+
onDrop: A(Z, ["prevent"])
|
|
105
|
+
}, [m("input", g({
|
|
105
106
|
ref_key: "input",
|
|
106
|
-
ref:
|
|
107
|
-
},
|
|
107
|
+
ref: V
|
|
108
|
+
}, T(W), {
|
|
108
109
|
type: "file",
|
|
109
|
-
"aria-label":
|
|
110
|
+
"aria-label": T(W)["aria-label"] || t.label,
|
|
110
111
|
name: t.name,
|
|
111
112
|
accept: t.accept,
|
|
112
113
|
multiple: t.multiple,
|
|
113
114
|
disabled: t.disabled,
|
|
114
115
|
required: t.required,
|
|
115
|
-
onInput:
|
|
116
|
-
onChange:
|
|
117
|
-
}), null, 16,
|
|
118
|
-
default:
|
|
119
|
-
inert: !
|
|
120
|
-
"aria-hidden": !
|
|
121
|
-
}, [
|
|
116
|
+
onInput: a[0] ||= A(() => {}, ["stop"]),
|
|
117
|
+
onChange: a[1] ||= A((e) => X([...e.target.files]), ["stop"])
|
|
118
|
+
}), null, 16, P), m("p", null, C(t.label), 1)], 42, N), h(d, g({ css: !1 }, T(n)), {
|
|
119
|
+
default: O(() => [k(m("div", {
|
|
120
|
+
inert: !T(G).length,
|
|
121
|
+
"aria-hidden": !T(G).length || void 0
|
|
122
|
+
}, [h(f, g({
|
|
123
|
+
ref_key: "fileList",
|
|
124
|
+
ref: q,
|
|
122
125
|
tag: "ul",
|
|
123
126
|
name: "kima-list"
|
|
124
|
-
},
|
|
125
|
-
|
|
127
|
+
}, {
|
|
128
|
+
...T(i),
|
|
129
|
+
onBeforeLeave: T(r)
|
|
130
|
+
}, { class: "kima-file-upload__files" }), {
|
|
131
|
+
default: O(() => [(b(!0), p(u, null, S(T(G), (e, n) => (b(), p("li", { key: te(e, n) }, [m("span", I, C(e.name) + " · " + C(e.size) + " B", 1), h(c, {
|
|
126
132
|
text: "移除文件",
|
|
127
133
|
position: "left"
|
|
128
134
|
}, {
|
|
129
|
-
default:
|
|
130
|
-
icon:
|
|
135
|
+
default: O(() => [h(s, {
|
|
136
|
+
icon: T(j),
|
|
131
137
|
disabled: t.disabled,
|
|
132
138
|
label: `移除 ${e.name}`,
|
|
133
|
-
onClick: (e) =>
|
|
139
|
+
onClick: (e) => Q(n)
|
|
134
140
|
}, null, 8, [
|
|
135
141
|
"icon",
|
|
136
142
|
"disabled",
|
|
@@ -140,9 +146,9 @@ var A = ["aria-disabled"], j = ["aria-disabled"], M = [
|
|
|
140
146
|
_: 2
|
|
141
147
|
}, 1024)]))), 128))]),
|
|
142
148
|
_: 1
|
|
143
|
-
}, 16)], 8,
|
|
149
|
+
}, 16)], 8, F), [[E, T(G).length]])]),
|
|
144
150
|
_: 1
|
|
145
|
-
}, 16)], 14,
|
|
151
|
+
}, 16)], 14, M));
|
|
146
152
|
}
|
|
147
|
-
}), [["__scopeId", "data-v-
|
|
148
|
-
export {
|
|
153
|
+
}), [["__scopeId", "data-v-8fd77a68"]]);
|
|
154
|
+
export { L as default };
|