@kernel4632/kima 0.0.0-stage → 0.6.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/LICENSE +21 -0
- package/README.md +209 -2
- package/dist/THIRD_PARTY_NOTICES.txt +2676 -0
- package/dist/kima-elements-core.js +53209 -0
- package/dist/kima-elements.js +126371 -0
- package/dist/kima-theme.js +1583 -0
- package/dist/kima.js +141 -0
- package/dist/style.css +2 -0
- package/dist/vue/_virtual/_plugin-vue_export-helper.js +7 -0
- package/dist/vue/components/advanced-input/calendar.ce.js +216 -0
- package/dist/vue/components/advanced-input/date-range-picker.ce.js +224 -0
- package/dist/vue/components/advanced-input/editable.ce.js +160 -0
- package/dist/vue/components/advanced-input/mention.ce.js +181 -0
- package/dist/vue/components/advanced-input/range-slider.ce.js +111 -0
- package/dist/vue/components/advanced-input/time-range-picker.ce.js +120 -0
- package/dist/vue/components/advanced-input/transfer.ce.js +192 -0
- package/dist/vue/components/content/chart.ce.js +282 -0
- package/dist/vue/components/content/code-editor.ce.js +309 -0
- package/dist/vue/components/content/equation.ce.js +69 -0
- package/dist/vue/components/content/heatmap.ce.js +148 -0
- package/dist/vue/components/content/rich-text-editor.ce.js +319 -0
- package/dist/vue/components/core/badge.ce.js +66 -0
- package/dist/vue/components/core/button-group.ce.js +142 -0
- package/dist/vue/components/core/button.ce.js +73 -0
- package/dist/vue/components/core/card.ce.js +73 -0
- package/dist/vue/components/core/cascader.ce.js +329 -0
- package/dist/vue/components/core/checkbox.ce.js +116 -0
- package/dist/vue/components/core/code-block.ce.js +108 -0
- package/dist/vue/components/core/combobox.ce.js +354 -0
- package/dist/vue/components/core/date-picker.ce.js +433 -0
- package/dist/vue/components/core/dialog.ce.js +118 -0
- package/dist/vue/components/core/divider.ce.js +49 -0
- package/dist/vue/components/core/drawer.ce.js +235 -0
- package/dist/vue/components/core/empty-state.ce.js +58 -0
- package/dist/vue/components/core/icon-button.ce.js +93 -0
- package/dist/vue/components/core/icon.ce.js +42 -0
- package/dist/vue/components/core/layout.ce.js +68 -0
- package/dist/vue/components/core/menu.ce.js +178 -0
- package/dist/vue/components/core/notification.ce.js +158 -0
- package/dist/vue/components/core/pagination.ce.js +158 -0
- package/dist/vue/components/core/progress.ce.js +49 -0
- package/dist/vue/components/core/select.ce.js +325 -0
- package/dist/vue/components/core/slider.ce.js +116 -0
- package/dist/vue/components/core/switch.ce.js +100 -0
- package/dist/vue/components/core/tabs.ce.js +193 -0
- package/dist/vue/components/core/text-field.ce.js +194 -0
- package/dist/vue/components/core/time-picker.ce.js +486 -0
- package/dist/vue/components/core/tooltip.ce.js +125 -0
- package/dist/vue/components/core/tree.ce.js +248 -0
- package/dist/vue/components/core/virtual-scroll.ce.js +176 -0
- package/dist/vue/components/data/copy-button.ce.js +75 -0
- package/dist/vue/components/data/image-preview.ce.js +226 -0
- package/dist/vue/components/data/infinite-scroll.ce.js +126 -0
- package/dist/vue/components/data/long-text.ce.js +70 -0
- package/dist/vue/components/data/relative-time.ce.js +77 -0
- package/dist/vue/components/data/ring-progress.ce.js +87 -0
- package/dist/vue/components/data/table.ce.js +491 -0
- package/dist/vue/components/data/virtual-table.ce.js +178 -0
- package/dist/vue/components/data/virtual-tree.ce.js +213 -0
- package/dist/vue/components/display/alert.ce.js +101 -0
- package/dist/vue/components/display/avatar-group.ce.js +65 -0
- package/dist/vue/components/display/avatar.ce.js +84 -0
- package/dist/vue/components/display/blockquote.ce.js +44 -0
- package/dist/vue/components/display/countdown.ce.js +77 -0
- package/dist/vue/components/display/descriptions.ce.js +43 -0
- package/dist/vue/components/display/highlight.ce.js +48 -0
- package/dist/vue/components/display/image.ce.js +146 -0
- package/dist/vue/components/display/list.ce.js +68 -0
- package/dist/vue/components/display/result.ce.js +57 -0
- package/dist/vue/components/display/skeleton.ce.js +67 -0
- package/dist/vue/components/display/spinner.ce.js +42 -0
- package/dist/vue/components/display/statistic.ce.js +71 -0
- package/dist/vue/components/display/timeline.ce.js +59 -0
- package/dist/vue/components/form-completion/angle-slider.ce.js +103 -0
- package/dist/vue/components/form-completion/color-picker.ce.js +286 -0
- package/dist/vue/components/form-completion/date-field.ce.js +131 -0
- package/dist/vue/components/form-completion/dynamic-input.ce.js +158 -0
- package/dist/vue/components/form-completion/form.ce.js +248 -0
- package/dist/vue/components/form-completion/json-input.ce.js +114 -0
- package/dist/vue/components/form-completion/masked-input.ce.js +88 -0
- package/dist/vue/components/form-completion/period-picker.ce.js +147 -0
- package/dist/vue/components/form-completion/time-field.ce.js +120 -0
- package/dist/vue/components/form-completion/upload-manager.ce.js +223 -0
- package/dist/vue/components/foundation/banner.ce.js +106 -0
- package/dist/vue/components/foundation/error-state.ce.js +108 -0
- package/dist/vue/components/foundation/field-group.ce.js +146 -0
- package/dist/vue/components/foundation/flex.ce.js +60 -0
- package/dist/vue/components/foundation/grid.ce.js +52 -0
- package/dist/vue/components/foundation/input-group.ce.js +34 -0
- package/dist/vue/components/foundation/page-header.ce.js +55 -0
- package/dist/vue/components/foundation/time-display.ce.js +129 -0
- package/dist/vue/components/foundation/typography.ce.js +71 -0
- package/dist/vue/components/input/checkbox-group.ce.js +93 -0
- package/dist/vue/components/input/field.ce.js +74 -0
- package/dist/vue/components/input/file-upload.ce.js +142 -0
- package/dist/vue/components/input/number-field.ce.js +103 -0
- package/dist/vue/components/input/pin-input.ce.js +112 -0
- package/dist/vue/components/input/radio-group.ce.js +96 -0
- package/dist/vue/components/input/rating.ce.js +115 -0
- package/dist/vue/components/input/tags-input.ce.js +153 -0
- package/dist/vue/components/input/textarea.ce.js +180 -0
- package/dist/vue/components/input/toggle.ce.js +58 -0
- package/dist/vue/components/interaction/chip.ce.js +95 -0
- package/dist/vue/components/interaction/command.ce.js +161 -0
- package/dist/vue/components/interaction/context-menu.ce.js +113 -0
- package/dist/vue/components/interaction/hover-card.ce.js +92 -0
- package/dist/vue/components/interaction/loading-overlay.ce.js +70 -0
- package/dist/vue/components/interaction/menubar.ce.js +134 -0
- package/dist/vue/components/interaction/multi-select.ce.js +264 -0
- package/dist/vue/components/interaction/popconfirm.ce.js +95 -0
- package/dist/vue/components/interaction/popover.ce.js +83 -0
- package/dist/vue/components/interaction/tree-select.ce.js +195 -0
- package/dist/vue/components/navigation/accordion.ce.js +114 -0
- package/dist/vue/components/navigation/anchor.ce.js +125 -0
- package/dist/vue/components/navigation/back-top.ce.js +67 -0
- package/dist/vue/components/navigation/breadcrumb.ce.js +48 -0
- package/dist/vue/components/navigation/carousel.ce.js +114 -0
- package/dist/vue/components/navigation/collapsible.ce.js +57 -0
- package/dist/vue/components/navigation/link.ce.js +62 -0
- package/dist/vue/components/navigation/navigation-menu.ce.js +91 -0
- package/dist/vue/components/navigation/overflow-list.ce.js +67 -0
- package/dist/vue/components/navigation/scroll-area.ce.js +47 -0
- package/dist/vue/components/navigation/splitter.ce.js +131 -0
- package/dist/vue/components/navigation/stepper.ce.js +74 -0
- package/dist/vue/components/navigation/toolbar.ce.js +93 -0
- package/dist/vue/components/navigation/visually-hidden.ce.js +16 -0
- package/dist/vue/components/shell/app-shell.ce.js +87 -0
- package/dist/vue/components/shell/config-provider.ce.js +110 -0
- package/dist/vue/components/shell/marquee.ce.js +92 -0
- package/dist/vue/components/shell/masonry.ce.js +50 -0
- package/dist/vue/components/shell/sidebar.ce.js +125 -0
- package/dist/vue/components/utility/affix.ce.js +64 -0
- package/dist/vue/components/utility/alert-dialog.ce.js +124 -0
- package/dist/vue/components/utility/animated-number.ce.js +66 -0
- package/dist/vue/components/utility/float-button.ce.js +104 -0
- package/dist/vue/components/utility/listbox.ce.js +81 -0
- package/dist/vue/components/utility/loading-bar.ce.js +85 -0
- package/dist/vue/components/utility/log-viewer.ce.js +124 -0
- package/dist/vue/components/utility/notification-queue.ce.js +109 -0
- package/dist/vue/components/utility/progress-group.ce.js +59 -0
- package/dist/vue/components/utility/qr-code.ce.js +62 -0
- package/dist/vue/components/utility/tag-group.ce.js +124 -0
- package/dist/vue/components/utility/tour.ce.js +214 -0
- package/dist/vue/components/utility/virtual-select.ce.js +207 -0
- package/dist/vue/components/utility/watermark.ce.js +44 -0
- package/dist/vue/internal/menu-items.js +184 -0
- package/dist/vue/internal/navigation-items.js +110 -0
- package/dist/vue/utils/code-highlight.js +142 -0
- package/dist/vue/utils/config.js +47 -0
- package/dist/vue/utils/content-motion.js +37 -0
- package/dist/vue/utils/content.js +83 -0
- package/dist/vue/utils/display-status.js +31 -0
- package/dist/vue/utils/foundation.js +65 -0
- package/dist/vue/utils/input-state.js +38 -0
- package/dist/vue/utils/interaction.js +103 -0
- package/dist/vue/utils/local-date.js +48 -0
- package/dist/vue/utils/motion.js +80 -0
- package/dist/vue/utils/native-slots.js +30 -0
- package/dist/vue/utils/navigation.js +44 -0
- package/dist/vue/utils/notifications.js +60 -0
- package/dist/vue/utils/qr.js +20 -0
- package/dist/vue/utils/remote-options.js +65 -0
- package/dist/vue/utils/ripple.js +20 -0
- package/dist/vue/utils/scoped-slots.js +22 -0
- package/dist/vue/utils/shell.js +43 -0
- package/dist/vue/utils/theme.js +50 -0
- package/dist/vue/utils/utility-choice.js +56 -0
- package/package.json +105 -4
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import e from "../../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { Fragment as t, createElementBlock as n, createElementVNode as r, nextTick as i, onBeforeUnmount as a, onMounted as o, openBlock as s, ref as c, renderList as l, watch as u } from "vue";
|
|
4
|
+
// src/components/form-completion/time-field.ce.vue
|
|
5
|
+
var d = ["aria-label", "aria-disabled"], f = [
|
|
6
|
+
"value",
|
|
7
|
+
"placeholder",
|
|
8
|
+
"aria-label",
|
|
9
|
+
"disabled",
|
|
10
|
+
"readonly",
|
|
11
|
+
"onInput",
|
|
12
|
+
"onKeydown",
|
|
13
|
+
"onCompositionend"
|
|
14
|
+
], p = [
|
|
15
|
+
"name",
|
|
16
|
+
"required",
|
|
17
|
+
"disabled",
|
|
18
|
+
"value",
|
|
19
|
+
"aria-label"
|
|
20
|
+
], m = /*#__PURE__*/ e({
|
|
21
|
+
__name: "time-field.ce",
|
|
22
|
+
props: {
|
|
23
|
+
modelValue: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: ""
|
|
26
|
+
},
|
|
27
|
+
name: String,
|
|
28
|
+
label: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: "时间"
|
|
31
|
+
},
|
|
32
|
+
required: Boolean,
|
|
33
|
+
disabled: Boolean,
|
|
34
|
+
readonly: Boolean,
|
|
35
|
+
seconds: Boolean,
|
|
36
|
+
min: String,
|
|
37
|
+
max: String
|
|
38
|
+
},
|
|
39
|
+
emits: ["update:modelValue", "change"],
|
|
40
|
+
setup(e, { emit: m }) {
|
|
41
|
+
let h = e, g = m, _ = c(Array(h.seconds ? 3 : 2).fill("")), v = c([]), y = c(null), b = c(!1), x = () => h.seconds ? 3 : 2;
|
|
42
|
+
function S(e) {
|
|
43
|
+
let t = /^(\d{2}):(\d{2})(?::(\d{2}))?$/.exec(e || "");
|
|
44
|
+
return t ? [
|
|
45
|
+
t[1],
|
|
46
|
+
t[2],
|
|
47
|
+
t[3] || "00"
|
|
48
|
+
].slice(0, x()) : Array(x()).fill("");
|
|
49
|
+
}
|
|
50
|
+
function C(e) {
|
|
51
|
+
return !!((h.seconds ? /^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$/.exec(e || "") : /^(?:[01]\d|2[0-3]):[0-5]\d$/.exec(e || "")) && (!h.min || e >= h.min) && (!h.max || e <= h.max));
|
|
52
|
+
}
|
|
53
|
+
function w() {
|
|
54
|
+
let e = _.value.some(Boolean);
|
|
55
|
+
y.value?.setCustomValidity(!e && !h.required || b.value ? "" : "请输入完整且在范围内的时间");
|
|
56
|
+
}
|
|
57
|
+
u(() => [h.modelValue, h.seconds], () => {
|
|
58
|
+
_.value = S(h.modelValue), b.value = C(h.modelValue), w();
|
|
59
|
+
}, { immediate: !0 });
|
|
60
|
+
function T(e, t = !0) {
|
|
61
|
+
b.value = C(e), b.value ? (g("update:modelValue", e), t && g("change", e)) : g("update:modelValue", ""), w();
|
|
62
|
+
}
|
|
63
|
+
function E(e, t) {
|
|
64
|
+
let n = t.target.value.replace(/\D/g, "").slice(0, 2), r = e === 0 ? 23 : 59;
|
|
65
|
+
_.value[e] = n, t.target.value = n, n.length === 2 && Number(n) <= r ? (e < x() - 1 && i(() => v.value[e + 1]?.focus()), _.value.every((e) => e.length === 2) ? T(_.value.join(":")) : (b.value = !1, w())) : (b.value = !1, w(), g("update:modelValue", ""));
|
|
66
|
+
}
|
|
67
|
+
function D(e, t) {
|
|
68
|
+
if (!t.isComposing) {
|
|
69
|
+
if (["ArrowUp", "ArrowDown"].includes(t.key)) {
|
|
70
|
+
t.preventDefault();
|
|
71
|
+
let n = v.value[e], r = e === 0 ? 23 : 59, i = (Number(n.value || 0) + (t.key === "ArrowUp" ? 1 : -1) + r + 1) % (r + 1);
|
|
72
|
+
n.value = String(i).padStart(2, "0"), E(e, { target: n });
|
|
73
|
+
} else t.key === "ArrowLeft" && t.target.selectionStart === 0 ? v.value[e - 1]?.focus() : t.key === "ArrowRight" && t.target.selectionStart === t.target.value.length && v.value[e + 1]?.focus();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
let O, k, A;
|
|
77
|
+
function j(e) {
|
|
78
|
+
e.target === O && queueMicrotask(() => {
|
|
79
|
+
e.defaultPrevented || (_.value = S(A), b.value = C(A), w(), g("update:modelValue", A));
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return o(() => {
|
|
83
|
+
A = h.modelValue, O = y.value?.form, k = y.value?.ownerDocument, w(), k?.addEventListener("reset", j, !0);
|
|
84
|
+
}), a(() => k?.removeEventListener("reset", j, !0)), (i, a) => (s(), n("div", {
|
|
85
|
+
class: "kima-time-field",
|
|
86
|
+
role: "group",
|
|
87
|
+
"aria-label": e.label,
|
|
88
|
+
"aria-disabled": e.disabled || void 0
|
|
89
|
+
}, [(s(!0), n(t, null, l(_.value, (t, r) => (s(), n("input", {
|
|
90
|
+
key: r,
|
|
91
|
+
ref_for: !0,
|
|
92
|
+
ref: (e) => v.value[r] = e,
|
|
93
|
+
class: "kima-time-field__segment",
|
|
94
|
+
type: "text",
|
|
95
|
+
value: t,
|
|
96
|
+
placeholder: r === 0 ? "HH" : r === 1 ? "MM" : "SS",
|
|
97
|
+
"aria-label": `${e.label} ${r === 0 ? "时" : r === 1 ? "分" : "秒"}`,
|
|
98
|
+
inputmode: "numeric",
|
|
99
|
+
maxlength: "2",
|
|
100
|
+
disabled: e.disabled,
|
|
101
|
+
readonly: e.readonly,
|
|
102
|
+
onInput: (e) => E(r, e),
|
|
103
|
+
onKeydown: (e) => D(r, e),
|
|
104
|
+
onCompositionend: (e) => E(r, e)
|
|
105
|
+
}, null, 40, f))), 128)), r("input", {
|
|
106
|
+
ref_key: "hidden",
|
|
107
|
+
ref: y,
|
|
108
|
+
class: "kima-time-field__native",
|
|
109
|
+
type: "text",
|
|
110
|
+
name: e.name,
|
|
111
|
+
required: e.required,
|
|
112
|
+
disabled: e.disabled,
|
|
113
|
+
value: b.value ? _.value.join(":") : "",
|
|
114
|
+
"aria-label": e.label,
|
|
115
|
+
tabindex: "-1",
|
|
116
|
+
"aria-hidden": "true"
|
|
117
|
+
}, null, 8, p)], 8, d));
|
|
118
|
+
}
|
|
119
|
+
}, [["__scopeId", "data-v-b6533524"]]);
|
|
120
|
+
export { m as default };
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import e from "../../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "../core/button.ce.js";
|
|
3
|
+
import { presenceTransition as n } from "../../utils/motion.js";
|
|
4
|
+
import r from "../input/file-upload.ce.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import { Fragment as i, TransitionGroup as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, createVNode as f, mergeProps as p, onBeforeUnmount as m, openBlock as h, ref as g, renderList as _, toDisplayString as v, unref as y, watch as b, withCtx as x } from "vue";
|
|
7
|
+
// src/components/form-completion/upload-manager.ce.vue
|
|
8
|
+
var S = ["aria-disabled"], C = { class: "kima-upload-manager__info" }, w = ["value", "aria-label"], T = { role: "status" }, E = { class: "kima-upload-manager__actions" }, D = /*#__PURE__*/ e({
|
|
9
|
+
__name: "upload-manager.ce",
|
|
10
|
+
props: {
|
|
11
|
+
modelValue: {
|
|
12
|
+
type: Array,
|
|
13
|
+
default: () => []
|
|
14
|
+
},
|
|
15
|
+
upload: {
|
|
16
|
+
type: Function,
|
|
17
|
+
default: null
|
|
18
|
+
},
|
|
19
|
+
concurrency: {
|
|
20
|
+
type: Number,
|
|
21
|
+
default: 2
|
|
22
|
+
},
|
|
23
|
+
accept: String,
|
|
24
|
+
multiple: Boolean,
|
|
25
|
+
disabled: Boolean,
|
|
26
|
+
label: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: "添加上传文件"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
emits: [
|
|
32
|
+
"update:modelValue",
|
|
33
|
+
"change",
|
|
34
|
+
"progress",
|
|
35
|
+
"success",
|
|
36
|
+
"error",
|
|
37
|
+
"cancel"
|
|
38
|
+
],
|
|
39
|
+
setup(e, { expose: D, emit: O }) {
|
|
40
|
+
let k = e, A = O, j = 0, M = g([]), N = /* @__PURE__ */ new Map(), P = o(() => M.value.filter((e) => e.status === "queued"));
|
|
41
|
+
function F(e) {
|
|
42
|
+
let t = [...e].map((e) => ({
|
|
43
|
+
id: ++j,
|
|
44
|
+
file: e,
|
|
45
|
+
status: "queued",
|
|
46
|
+
progress: 0,
|
|
47
|
+
error: "",
|
|
48
|
+
result: null
|
|
49
|
+
}));
|
|
50
|
+
M.value = [...M.value, ...t], I(), R();
|
|
51
|
+
}
|
|
52
|
+
function I() {
|
|
53
|
+
let e = M.value.map(({ id: e, file: t, status: n, progress: r, error: i, result: a }) => ({
|
|
54
|
+
id: e,
|
|
55
|
+
file: t,
|
|
56
|
+
status: n,
|
|
57
|
+
progress: r,
|
|
58
|
+
error: i,
|
|
59
|
+
result: a
|
|
60
|
+
}));
|
|
61
|
+
A("update:modelValue", e), A("change", e);
|
|
62
|
+
}
|
|
63
|
+
function L(e, t) {
|
|
64
|
+
Object.assign(e, t), I();
|
|
65
|
+
}
|
|
66
|
+
function R() {
|
|
67
|
+
for (; N.size < Math.max(1, Math.floor(k.concurrency)) && P.value.length;) {
|
|
68
|
+
let e = P.value[0];
|
|
69
|
+
z(e);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
async function z(e) {
|
|
73
|
+
if (typeof k.upload != "function") {
|
|
74
|
+
L(e, {
|
|
75
|
+
status: "error",
|
|
76
|
+
error: "缺少 upload(file, { signal, onProgress }) 宿主处理函数"
|
|
77
|
+
}), A("error", {
|
|
78
|
+
task: e,
|
|
79
|
+
error: Error(e.error)
|
|
80
|
+
});
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
let t = new AbortController();
|
|
84
|
+
N.set(e.id, t), L(e, {
|
|
85
|
+
status: "uploading",
|
|
86
|
+
error: "",
|
|
87
|
+
progress: 0
|
|
88
|
+
});
|
|
89
|
+
try {
|
|
90
|
+
let n = await k.upload(e.file, {
|
|
91
|
+
signal: t.signal,
|
|
92
|
+
onProgress: (n) => {
|
|
93
|
+
if (N.get(e.id) !== t) return;
|
|
94
|
+
let r = Math.max(0, Math.min(100, Number(n) || 0));
|
|
95
|
+
e.progress = r, A("progress", {
|
|
96
|
+
task: e,
|
|
97
|
+
file: e.file,
|
|
98
|
+
progress: r
|
|
99
|
+
}), I();
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
if (N.get(e.id) !== t) return;
|
|
103
|
+
L(e, {
|
|
104
|
+
status: "success",
|
|
105
|
+
progress: 100,
|
|
106
|
+
result: n
|
|
107
|
+
}), A("success", {
|
|
108
|
+
task: e,
|
|
109
|
+
result: n
|
|
110
|
+
});
|
|
111
|
+
} catch (n) {
|
|
112
|
+
if (N.get(e.id) !== t) return;
|
|
113
|
+
t.signal.aborted ? (L(e, { status: "cancelled" }), A("cancel", e)) : (L(e, {
|
|
114
|
+
status: "error",
|
|
115
|
+
error: n?.message || String(n)
|
|
116
|
+
}), A("error", {
|
|
117
|
+
task: e,
|
|
118
|
+
error: n
|
|
119
|
+
}));
|
|
120
|
+
} finally {
|
|
121
|
+
N.get(e.id) === t && N.delete(e.id), R();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function B(e) {
|
|
125
|
+
if (e.status === "queued") L(e, { status: "cancelled" }), A("cancel", e);
|
|
126
|
+
else if (e.status === "uploading") {
|
|
127
|
+
let t = N.get(e.id);
|
|
128
|
+
if (!t) return;
|
|
129
|
+
N.delete(e.id), t.abort(), L(e, { status: "cancelled" }), A("cancel", e), R();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function V(e) {
|
|
133
|
+
(e.status === "error" || e.status === "cancelled") && (L(e, {
|
|
134
|
+
status: "queued",
|
|
135
|
+
progress: 0,
|
|
136
|
+
error: "",
|
|
137
|
+
result: null
|
|
138
|
+
}), R());
|
|
139
|
+
}
|
|
140
|
+
function H(e) {
|
|
141
|
+
B(e), M.value = M.value.filter((t) => t.id !== e.id), I();
|
|
142
|
+
}
|
|
143
|
+
return b(() => k.modelValue, (e) => {
|
|
144
|
+
Array.isArray(e) && e.length && !M.value.length && (M.value = e.map((e) => ({
|
|
145
|
+
...e,
|
|
146
|
+
id: e.id || ++j
|
|
147
|
+
})));
|
|
148
|
+
}), m(() => {
|
|
149
|
+
for (let e of N.values()) e.abort();
|
|
150
|
+
N.clear();
|
|
151
|
+
}), D({
|
|
152
|
+
add: F,
|
|
153
|
+
cancel: B,
|
|
154
|
+
retry: V,
|
|
155
|
+
remove: H,
|
|
156
|
+
tasks: M,
|
|
157
|
+
pump: R
|
|
158
|
+
}), (o, m) => (h(), l("section", {
|
|
159
|
+
class: "kima-upload-manager",
|
|
160
|
+
"aria-disabled": e.disabled || void 0
|
|
161
|
+
}, [f(r, {
|
|
162
|
+
"model-value": M.value.map((e) => e.file),
|
|
163
|
+
label: e.label,
|
|
164
|
+
accept: e.accept,
|
|
165
|
+
multiple: e.multiple,
|
|
166
|
+
disabled: e.disabled,
|
|
167
|
+
"onUpdate:modelValue": m[0] ||= (e) => F(e.slice(M.value.filter((e) => e.status !== "cancelled").length))
|
|
168
|
+
}, null, 8, [
|
|
169
|
+
"model-value",
|
|
170
|
+
"label",
|
|
171
|
+
"accept",
|
|
172
|
+
"multiple",
|
|
173
|
+
"disabled"
|
|
174
|
+
]), f(a, p({
|
|
175
|
+
tag: "ul",
|
|
176
|
+
name: "kima-list"
|
|
177
|
+
}, y(n), { class: "kima-upload-manager__list" }), {
|
|
178
|
+
default: x(() => [(h(!0), l(i, null, _(M.value, (n) => (h(), l("li", { key: n.id }, [u("div", C, [
|
|
179
|
+
u("strong", null, v(n.file.name), 1),
|
|
180
|
+
u("progress", {
|
|
181
|
+
max: "100",
|
|
182
|
+
value: n.progress,
|
|
183
|
+
"aria-label": `${n.file.name}上传进度`
|
|
184
|
+
}, null, 8, w),
|
|
185
|
+
u("span", T, v(n.status === "queued" ? "等待中" : n.status === "uploading" ? `${n.progress}%` : n.status === "success" ? "已完成" : n.status === "cancelled" ? "已取消" : n.error), 1)
|
|
186
|
+
]), u("div", E, [
|
|
187
|
+
n.status === "uploading" || n.status === "queued" ? (h(), s(t, {
|
|
188
|
+
key: 0,
|
|
189
|
+
variant: "text",
|
|
190
|
+
disabled: e.disabled,
|
|
191
|
+
onClick: (e) => B(n)
|
|
192
|
+
}, {
|
|
193
|
+
default: x(() => [...m[1] ||= [d("取消", -1)]]),
|
|
194
|
+
_: 1
|
|
195
|
+
}, 8, ["disabled", "onClick"])) : c("", !0),
|
|
196
|
+
n.status === "error" || n.status === "cancelled" ? (h(), s(t, {
|
|
197
|
+
key: 1,
|
|
198
|
+
variant: "text",
|
|
199
|
+
disabled: e.disabled,
|
|
200
|
+
onClick: (e) => V(n)
|
|
201
|
+
}, {
|
|
202
|
+
default: x(() => [...m[2] ||= [d("重试", -1)]]),
|
|
203
|
+
_: 1
|
|
204
|
+
}, 8, ["disabled", "onClick"])) : c("", !0),
|
|
205
|
+
f(t, {
|
|
206
|
+
variant: "text",
|
|
207
|
+
disabled: e.disabled,
|
|
208
|
+
"aria-label": `移除 ${n.file.name}`,
|
|
209
|
+
onClick: (e) => H(n)
|
|
210
|
+
}, {
|
|
211
|
+
default: x(() => [...m[3] ||= [d("移除", -1)]]),
|
|
212
|
+
_: 1
|
|
213
|
+
}, 8, [
|
|
214
|
+
"disabled",
|
|
215
|
+
"aria-label",
|
|
216
|
+
"onClick"
|
|
217
|
+
])
|
|
218
|
+
])]))), 128))]),
|
|
219
|
+
_: 1
|
|
220
|
+
}, 16)], 8, S));
|
|
221
|
+
}
|
|
222
|
+
}, [["__scopeId", "data-v-5d214e0f"]]);
|
|
223
|
+
export { D as default };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { useNativeSlots as e } from "../../utils/native-slots.js";
|
|
2
|
+
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
3
|
+
import n from "../core/button.ce.js";
|
|
4
|
+
import r from "../core/icon.ce.js";
|
|
5
|
+
import { collapseTransition as i } from "../../utils/motion.js";
|
|
6
|
+
import { displayStatus as a } from "../../utils/display-status.js";
|
|
7
|
+
/* empty css */
|
|
8
|
+
import { Transition as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, mergeProps as m, openBlock as h, ref as g, renderSlot as _, toDisplayString as v, unref as y, vShow as b, watch as x, withCtx as S, withDirectives as C } from "vue";
|
|
9
|
+
import { Cancel01Icon as w } from "@hugeicons/core-free-icons";
|
|
10
|
+
// src/components/foundation/banner.ce.vue
|
|
11
|
+
var T = ["inert", "aria-hidden"], E = ["data-variant", "role"], D = ["aria-label"], O = { class: "kima-banner__body" }, k = {
|
|
12
|
+
key: 0,
|
|
13
|
+
class: "kima-banner__heading"
|
|
14
|
+
}, A = { class: "kima-banner__content" }, j = {
|
|
15
|
+
key: 1,
|
|
16
|
+
class: "kima-banner__action"
|
|
17
|
+
}, M = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
18
|
+
__name: "banner.ce",
|
|
19
|
+
props: {
|
|
20
|
+
open: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: !0
|
|
23
|
+
},
|
|
24
|
+
variant: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: "info"
|
|
27
|
+
},
|
|
28
|
+
heading: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: ""
|
|
31
|
+
},
|
|
32
|
+
description: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: ""
|
|
35
|
+
},
|
|
36
|
+
closable: Boolean,
|
|
37
|
+
dismissLabel: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: "关闭横幅"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
emits: [
|
|
43
|
+
"update:open",
|
|
44
|
+
"dismiss",
|
|
45
|
+
"restore"
|
|
46
|
+
],
|
|
47
|
+
setup(t, { expose: M, emit: N }) {
|
|
48
|
+
let P = t, F = N, I = g(null), { hasNativeSlot: L, isCustomElement: R } = e(I), z = g(P.open);
|
|
49
|
+
x(() => P.open, (e) => {
|
|
50
|
+
z.value = e;
|
|
51
|
+
});
|
|
52
|
+
let B = s(() => a(P.variant));
|
|
53
|
+
function V() {
|
|
54
|
+
z.value && (z.value = !1, F("update:open", !1), F("dismiss"));
|
|
55
|
+
}
|
|
56
|
+
function H() {
|
|
57
|
+
z.value || (z.value = !0, F("update:open", !0), F("restore"));
|
|
58
|
+
}
|
|
59
|
+
return M({
|
|
60
|
+
dismiss: V,
|
|
61
|
+
restore: H
|
|
62
|
+
}), (e, a) => (h(), c(o, m({ css: !1 }, y(i)), {
|
|
63
|
+
default: S(() => [C(d("div", {
|
|
64
|
+
class: "kima-banner__clip",
|
|
65
|
+
inert: !z.value,
|
|
66
|
+
"aria-hidden": !z.value || void 0
|
|
67
|
+
}, [d("section", {
|
|
68
|
+
ref_key: "root",
|
|
69
|
+
ref: I,
|
|
70
|
+
class: "kima-banner",
|
|
71
|
+
"data-variant": B.value.variant,
|
|
72
|
+
role: ["danger", "warning"].includes(B.value.variant) ? "alert" : "status"
|
|
73
|
+
}, [
|
|
74
|
+
d("span", {
|
|
75
|
+
class: "kima-banner__icon",
|
|
76
|
+
role: "img",
|
|
77
|
+
"aria-label": B.value.label
|
|
78
|
+
}, [p(r, {
|
|
79
|
+
icon: B.value.icon,
|
|
80
|
+
size: 24
|
|
81
|
+
}, null, 8, ["icon"])], 8, D),
|
|
82
|
+
d("div", O, [
|
|
83
|
+
t.heading ? (h(), u("strong", k, v(t.heading), 1)) : l("", !0),
|
|
84
|
+
d("div", A, [_(e.$slots, "default", {}, () => [f(v(t.description), 1)], !0)]),
|
|
85
|
+
e.$slots.action || y(L)("action") || y(R) ? (h(), u("div", j, [_(e.$slots, "action", {}, void 0, !0)])) : l("", !0)
|
|
86
|
+
]),
|
|
87
|
+
t.closable ? (h(), c(n, {
|
|
88
|
+
key: 0,
|
|
89
|
+
variant: "text",
|
|
90
|
+
class: "kima-banner__close",
|
|
91
|
+
"aria-label": t.dismissLabel,
|
|
92
|
+
onClick: V
|
|
93
|
+
}, {
|
|
94
|
+
default: S(() => [p(r, {
|
|
95
|
+
icon: y(w),
|
|
96
|
+
size: 20,
|
|
97
|
+
"aria-hidden": "true"
|
|
98
|
+
}, null, 8, ["icon"])]),
|
|
99
|
+
_: 1
|
|
100
|
+
}, 8, ["aria-label"])) : l("", !0)
|
|
101
|
+
], 8, E)], 8, T), [[b, z.value]])]),
|
|
102
|
+
_: 3
|
|
103
|
+
}, 16));
|
|
104
|
+
}
|
|
105
|
+
}), [["__scopeId", "data-v-57ba332a"]]);
|
|
106
|
+
export { M as default };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import e from "../../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "../core/button.ce.js";
|
|
3
|
+
import n from "../core/icon.ce.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, normalizeClass as u, openBlock as d, ref as f, renderSlot as p, toDisplayString as m, unref as h, watch as g, withCtx as _ } from "vue";
|
|
6
|
+
import { AlertCircleIcon as v } from "@hugeicons/core-free-icons";
|
|
7
|
+
// src/components/foundation/error-state.ce.vue
|
|
8
|
+
var y = {
|
|
9
|
+
class: "kima-error-state__icon",
|
|
10
|
+
role: "img",
|
|
11
|
+
"aria-label": "错误"
|
|
12
|
+
}, b = {
|
|
13
|
+
key: 0,
|
|
14
|
+
class: "kima-error-state__code"
|
|
15
|
+
}, x = { class: "kima-error-state__heading" }, S = { class: "kima-error-state__description" }, C = {
|
|
16
|
+
key: 1,
|
|
17
|
+
class: "kima-error-state__failure",
|
|
18
|
+
role: "status"
|
|
19
|
+
}, w = {
|
|
20
|
+
key: 2,
|
|
21
|
+
class: "kima-error-state__attempts",
|
|
22
|
+
role: "status"
|
|
23
|
+
}, T = { class: "kima-error-state__actions" }, E = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
24
|
+
__name: "error-state.ce",
|
|
25
|
+
props: {
|
|
26
|
+
heading: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: "页面暂时无法加载"
|
|
29
|
+
},
|
|
30
|
+
description: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: "请检查连接后重试,或返回上一页。"
|
|
33
|
+
},
|
|
34
|
+
code: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: ""
|
|
37
|
+
},
|
|
38
|
+
retryLabel: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: "重试"
|
|
41
|
+
},
|
|
42
|
+
retryHandler: Function,
|
|
43
|
+
resetKey: {
|
|
44
|
+
type: [String, Number],
|
|
45
|
+
default: ""
|
|
46
|
+
},
|
|
47
|
+
compact: Boolean
|
|
48
|
+
},
|
|
49
|
+
emits: [
|
|
50
|
+
"retry",
|
|
51
|
+
"recovered",
|
|
52
|
+
"error",
|
|
53
|
+
"reset"
|
|
54
|
+
],
|
|
55
|
+
setup(e, { expose: E, emit: D }) {
|
|
56
|
+
let O = e, k = D, A = f(!1), j = f(0), M = f(""), N = r(() => typeof O.retryHandler == "function"), P = 0;
|
|
57
|
+
async function F() {
|
|
58
|
+
if (A.value) return;
|
|
59
|
+
let e = ++P;
|
|
60
|
+
A.value = !0, M.value = "", j.value += 1, k("retry", j.value);
|
|
61
|
+
try {
|
|
62
|
+
if (N.value && await O.retryHandler(j.value), e !== P) return;
|
|
63
|
+
k("recovered", j.value);
|
|
64
|
+
} catch (t) {
|
|
65
|
+
if (e !== P) return;
|
|
66
|
+
M.value = t instanceof Error ? t.message : String(t || "重试失败"), k("error", t);
|
|
67
|
+
} finally {
|
|
68
|
+
e === P && (A.value = !1);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function I() {
|
|
72
|
+
P += 1, A.value = !1, j.value = 0, M.value = "", k("reset");
|
|
73
|
+
}
|
|
74
|
+
return g(() => O.resetKey, I), E({
|
|
75
|
+
retry: F,
|
|
76
|
+
reset: I
|
|
77
|
+
}), (r, f) => (d(), o("section", {
|
|
78
|
+
class: u(["kima-error-state", { "kima-error-state--compact": e.compact }]),
|
|
79
|
+
role: "alert",
|
|
80
|
+
"aria-live": "assertive"
|
|
81
|
+
}, [
|
|
82
|
+
s("span", y, [l(n, {
|
|
83
|
+
icon: h(v),
|
|
84
|
+
size: 40
|
|
85
|
+
}, null, 8, ["icon"])]),
|
|
86
|
+
e.code ? (d(), o("code", b, m(e.code), 1)) : a("", !0),
|
|
87
|
+
s("h2", x, [p(r.$slots, "heading", {}, () => [c(m(e.heading), 1)], !0)]),
|
|
88
|
+
s("p", S, [p(r.$slots, "fallback", {}, () => [c(m(e.description), 1)], !0)]),
|
|
89
|
+
M.value ? (d(), o("p", C, "重试失败:" + m(M.value), 1)) : j.value ? (d(), o("p", w, "已尝试 " + m(j.value) + " 次", 1)) : a("", !0),
|
|
90
|
+
s("div", T, [p(r.$slots, "actions", {}, () => [N.value ? (d(), i(t, {
|
|
91
|
+
key: 0,
|
|
92
|
+
loading: A.value,
|
|
93
|
+
onClick: F
|
|
94
|
+
}, {
|
|
95
|
+
default: _(() => [c(m(e.retryLabel), 1)]),
|
|
96
|
+
_: 1
|
|
97
|
+
}, 8, ["loading"])) : (d(), i(t, {
|
|
98
|
+
key: 1,
|
|
99
|
+
variant: "tonal",
|
|
100
|
+
onClick: F
|
|
101
|
+
}, {
|
|
102
|
+
default: _(() => [c(m(e.retryLabel), 1)]),
|
|
103
|
+
_: 1
|
|
104
|
+
}))], !0)])
|
|
105
|
+
], 2));
|
|
106
|
+
}
|
|
107
|
+
}), [["__scopeId", "data-v-20c2aa5d"]]);
|
|
108
|
+
export { E as default };
|