@kernel4632/kima 0.8.2 → 0.8.4
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/content/code-editor.ce.vue_vue_type_style_index_0_scoped_233308e5_lang.css +1 -0
- package/dist/components/content/{rich-text-editor.ce.vue_vue_type_style_index_0_scoped_19796b0b_lang.css → rich-text-editor.ce.vue_vue_type_style_index_0_scoped_82e3193e_lang.css} +1 -1
- package/dist/components/core/code-block.ce.vue_vue_type_style_index_0_scoped_7e6342e8_lang.css +1 -0
- package/dist/components/form-completion/dynamic-input.ce.vue_vue_type_style_index_0_scoped_5913d05a_lang.css +1 -0
- package/dist/components/input/{file-upload.ce.vue_vue_type_style_index_0_scoped_17268263_lang.css → file-upload.ce.vue_vue_type_style_index_0_scoped_1568bdab_lang.css} +1 -1
- package/dist/components/navigation/carousel.ce.vue_vue_type_style_index_0_scoped_6a7ca57f_lang.css +1 -0
- package/dist/components/shell/app-shell.ce.vue_vue_type_style_index_0_scoped_37292ba0_lang.css +1 -0
- package/dist/components/shell/sidebar.ce.vue_vue_type_style_index_0_scoped_f50127b6_lang.css +1 -0
- package/dist/components/utility/log-viewer.ce.vue_vue_type_style_index_0_scoped_f5be4658_lang.css +1 -0
- package/dist/kima-elements.js +46116 -45692
- package/dist/kima.js +114 -114
- package/dist/style.css +9 -9
- package/dist/styles/app-shell.css +3 -2
- package/dist/styles/carousel.css +4 -2
- package/dist/styles/code-block.css +4 -2
- package/dist/styles/code-editor.css +4 -2
- package/dist/styles/dynamic-input.css +4 -1
- package/dist/styles/file-upload.css +4 -2
- package/dist/styles/log-viewer.css +4 -2
- package/dist/styles/rich-text-editor.css +4 -1
- package/dist/styles/sidebar.css +4 -2
- package/dist/styles/upload-manager.css +4 -1
- package/dist/vue/components/content/code-editor.ce.js +98 -93
- package/dist/vue/components/content/rich-text-editor.ce.js +148 -121
- package/dist/vue/components/core/code-block.ce.js +72 -49
- package/dist/vue/components/form-completion/dynamic-input.ce.js +97 -91
- package/dist/vue/components/input/file-upload.ce.js +74 -68
- package/dist/vue/components/navigation/carousel.ce.js +71 -59
- package/dist/vue/components/shell/app-shell.ce.js +49 -38
- package/dist/vue/components/shell/sidebar.ce.js +63 -52
- package/dist/vue/components/utility/log-viewer.ce.js +81 -64
- package/package.json +1 -1
- package/dist/components/content/code-editor.ce.vue_vue_type_style_index_0_scoped_a61ccf64_lang.css +0 -1
- package/dist/components/core/code-block.ce.vue_vue_type_style_index_0_scoped_6ddc49c8_lang.css +0 -1
- package/dist/components/form-completion/dynamic-input.ce.vue_vue_type_style_index_0_scoped_97d6f5bf_lang.css +0 -1
- package/dist/components/navigation/carousel.ce.vue_vue_type_style_index_0_scoped_c082836f_lang.css +0 -1
- package/dist/components/shell/app-shell.ce.vue_vue_type_style_index_0_scoped_abea9686_lang.css +0 -1
- package/dist/components/shell/sidebar.ce.vue_vue_type_style_index_0_scoped_0fd95ccf_lang.css +0 -1
- package/dist/components/utility/log-viewer.ce.vue_vue_type_style_index_0_scoped_2bf26869_lang.css +0 -1
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import e from "../../_virtual/_plugin-vue_export-helper.js";
|
|
2
2
|
import t from "../core/button.ce.js";
|
|
3
3
|
import { presenceTransition as n } from "../../utils/motion.js";
|
|
4
|
+
import r from "../core/icon-button.ce.js";
|
|
5
|
+
import i from "../core/tooltip.ce.js";
|
|
4
6
|
/* empty css */
|
|
5
|
-
import { Fragment as
|
|
7
|
+
import { Fragment as a, TransitionGroup as o, computed as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, mergeProps as f, openBlock as p, ref as m, renderList as h, renderSlot as g, toDisplayString as _, unref as v, withCtx as y } from "vue";
|
|
8
|
+
import { ArrowDown01Icon as b, ArrowUp01Icon as x, Cancel01Icon as S } from "@hugeicons/core-free-icons";
|
|
6
9
|
// src/components/form-completion/dynamic-input.ce.vue
|
|
7
|
-
var
|
|
10
|
+
var C = ["aria-label"], w = { class: "kima-dynamic-input__actions" }, T = /*#__PURE__*/ e({
|
|
8
11
|
__name: "dynamic-input.ce",
|
|
9
12
|
props: {
|
|
10
13
|
modelValue: {
|
|
@@ -36,123 +39,126 @@ var v = ["aria-label"], y = { class: "kima-dynamic-input__actions" }, b = /*#__P
|
|
|
36
39
|
"remove",
|
|
37
40
|
"move"
|
|
38
41
|
],
|
|
39
|
-
setup(e, { expose:
|
|
40
|
-
let
|
|
41
|
-
function
|
|
42
|
-
return !e || typeof e != "object" ? `row-${++
|
|
42
|
+
setup(e, { expose: T, emit: E }) {
|
|
43
|
+
let D = e, O = E, k = 0, A = /* @__PURE__ */ new WeakMap();
|
|
44
|
+
function j(e) {
|
|
45
|
+
return !e || typeof e != "object" ? `row-${++k}` : (A.has(e) || A.set(e, e.id || `row-${++k}`), A.get(e));
|
|
43
46
|
}
|
|
44
|
-
let
|
|
45
|
-
function
|
|
46
|
-
|
|
47
|
+
let M = m(D.modelValue.map((e) => ({ ...e }))), N = s(() => D.disabled || M.value.length >= D.max);
|
|
48
|
+
function P(e, t, n) {
|
|
49
|
+
M.value = e, O("update:modelValue", e.map((e) => ({ ...e }))), O("change", e.map((e) => ({ ...e }))), t && O(t, n);
|
|
47
50
|
}
|
|
48
|
-
function
|
|
49
|
-
if (
|
|
51
|
+
function F() {
|
|
52
|
+
if (N.value) return;
|
|
50
53
|
let e = {
|
|
51
|
-
...
|
|
52
|
-
id: `row-${++
|
|
54
|
+
...D.create(),
|
|
55
|
+
id: `row-${++k}`
|
|
53
56
|
};
|
|
54
|
-
|
|
57
|
+
P([...M.value, e], "add", {
|
|
55
58
|
row: e,
|
|
56
|
-
index:
|
|
59
|
+
index: M.value.length
|
|
57
60
|
});
|
|
58
61
|
}
|
|
59
|
-
function
|
|
60
|
-
if (
|
|
61
|
-
let t =
|
|
62
|
-
|
|
62
|
+
function I(e) {
|
|
63
|
+
if (D.disabled || M.value.length <= D.min) return;
|
|
64
|
+
let t = M.value[e];
|
|
65
|
+
P(M.value.filter((t, n) => n !== e), "remove", {
|
|
63
66
|
row: t,
|
|
64
67
|
index: e
|
|
65
68
|
});
|
|
66
69
|
}
|
|
67
|
-
function
|
|
70
|
+
function L(e, t) {
|
|
68
71
|
let n = e + t;
|
|
69
|
-
if (
|
|
70
|
-
let r = [...
|
|
71
|
-
[r[e], r[n]] = [r[n], r[e]],
|
|
72
|
+
if (D.disabled || n < 0 || n >= M.value.length) return;
|
|
73
|
+
let r = [...M.value];
|
|
74
|
+
[r[e], r[n]] = [r[n], r[e]], P(r, "move", {
|
|
72
75
|
row: r[n],
|
|
73
76
|
from: e,
|
|
74
77
|
to: n
|
|
75
78
|
});
|
|
76
79
|
}
|
|
77
|
-
function
|
|
78
|
-
let n = [...
|
|
79
|
-
n[e] = t,
|
|
80
|
+
function R(e, t) {
|
|
81
|
+
let n = [...M.value];
|
|
82
|
+
n[e] = t, P(n);
|
|
80
83
|
}
|
|
81
|
-
function
|
|
82
|
-
return
|
|
84
|
+
function z() {
|
|
85
|
+
return M.value.every((e) => e && e.valid !== !1);
|
|
83
86
|
}
|
|
84
|
-
return
|
|
85
|
-
add:
|
|
86
|
-
remove:
|
|
87
|
-
move:
|
|
88
|
-
validate:
|
|
89
|
-
rows:
|
|
90
|
-
}), (
|
|
87
|
+
return T({
|
|
88
|
+
add: F,
|
|
89
|
+
remove: I,
|
|
90
|
+
move: L,
|
|
91
|
+
validate: z,
|
|
92
|
+
rows: M
|
|
93
|
+
}), (s, m) => (p(), c("div", {
|
|
91
94
|
class: "kima-dynamic-input",
|
|
92
95
|
role: "group",
|
|
93
96
|
"aria-label": e.label
|
|
94
|
-
}, [
|
|
97
|
+
}, [d(o, f({
|
|
95
98
|
tag: "div",
|
|
96
99
|
name: "kima-list"
|
|
97
|
-
},
|
|
98
|
-
default:
|
|
99
|
-
key:
|
|
100
|
+
}, v(n), { class: "kima-dynamic-input__rows" }), {
|
|
101
|
+
default: y(() => [(p(!0), c(a, null, h(M.value, (t, n) => (p(), c("div", {
|
|
102
|
+
key: j(t),
|
|
100
103
|
class: "kima-dynamic-input__row"
|
|
101
|
-
}, [
|
|
102
|
-
row:
|
|
103
|
-
index:
|
|
104
|
-
id:
|
|
105
|
-
update: (e) =>
|
|
106
|
-
}, () => [
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
104
|
+
}, [g(s.$slots, "default", {
|
|
105
|
+
row: t,
|
|
106
|
+
index: n,
|
|
107
|
+
id: j(t),
|
|
108
|
+
update: (e) => R(n, e)
|
|
109
|
+
}, () => [l("output", null, _(JSON.stringify(t)), 1)], !0), l("div", w, [
|
|
110
|
+
d(i, { text: "上移" }, {
|
|
111
|
+
default: y(() => [d(r, {
|
|
112
|
+
icon: v(x),
|
|
113
|
+
label: `${e.label}上移第${n + 1}项`,
|
|
114
|
+
disabled: e.disabled || n === 0,
|
|
115
|
+
onClick: (e) => L(n, -1)
|
|
116
|
+
}, null, 8, [
|
|
117
|
+
"icon",
|
|
118
|
+
"label",
|
|
119
|
+
"disabled",
|
|
120
|
+
"onClick"
|
|
121
|
+
])]),
|
|
122
|
+
_: 2
|
|
123
|
+
}, 1024),
|
|
124
|
+
d(i, { text: "下移" }, {
|
|
125
|
+
default: y(() => [d(r, {
|
|
126
|
+
icon: v(b),
|
|
127
|
+
label: `${e.label}下移第${n + 1}项`,
|
|
128
|
+
disabled: e.disabled || n === M.value.length - 1,
|
|
129
|
+
onClick: (e) => L(n, 1)
|
|
130
|
+
}, null, 8, [
|
|
131
|
+
"icon",
|
|
132
|
+
"label",
|
|
133
|
+
"disabled",
|
|
134
|
+
"onClick"
|
|
135
|
+
])]),
|
|
136
|
+
_: 2
|
|
137
|
+
}, 1024),
|
|
138
|
+
d(i, { text: "移除" }, {
|
|
139
|
+
default: y(() => [d(r, {
|
|
140
|
+
icon: v(S),
|
|
141
|
+
label: `移除第${n + 1}项`,
|
|
142
|
+
disabled: e.disabled || M.value.length <= e.min,
|
|
143
|
+
onClick: (e) => I(n)
|
|
144
|
+
}, null, 8, [
|
|
145
|
+
"icon",
|
|
146
|
+
"label",
|
|
147
|
+
"disabled",
|
|
148
|
+
"onClick"
|
|
149
|
+
])]),
|
|
150
|
+
_: 2
|
|
151
|
+
}, 1024)
|
|
146
152
|
])]))), 128))]),
|
|
147
153
|
_: 3
|
|
148
|
-
}, 16),
|
|
154
|
+
}, 16), d(t, {
|
|
149
155
|
variant: "tonal",
|
|
150
|
-
disabled:
|
|
151
|
-
onClick:
|
|
156
|
+
disabled: N.value,
|
|
157
|
+
onClick: F
|
|
152
158
|
}, {
|
|
153
|
-
default:
|
|
159
|
+
default: y(() => [...m[0] ||= [u("添加字段", -1)]]),
|
|
154
160
|
_: 1
|
|
155
|
-
}, 8, ["disabled"])], 8,
|
|
161
|
+
}, 8, ["disabled"])], 8, C));
|
|
156
162
|
}
|
|
157
|
-
}, [["__scopeId", "data-v-
|
|
158
|
-
export {
|
|
163
|
+
}, [["__scopeId", "data-v-5913d05a"]]);
|
|
164
|
+
export { T as default };
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { useRipple as e } from "../../utils/ripple.js";
|
|
2
2
|
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
3
|
-
import n from "
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
3
|
+
import { collapseTransition as n, presenceTransition as r } from "../../utils/motion.js";
|
|
4
|
+
import { useInputAttrs as i, useInputState as a } from "../../utils/input-state.js";
|
|
5
|
+
import o from "../core/icon-button.ce.js";
|
|
6
|
+
import s from "../core/tooltip.ce.js";
|
|
6
7
|
/* empty css */
|
|
7
|
-
import { Fragment as
|
|
8
|
+
import { Fragment as c, Transition as l, TransitionGroup as u, createElementBlock as d, createElementVNode as f, createVNode as p, mergeProps as m, nextTick as h, normalizeClass as g, normalizeStyle as _, openBlock as v, ref as y, renderList as b, toDisplayString as x, toRaw as S, unref as C, vShow as w, watch as T, withCtx as E, withDirectives as D, withModifiers as O } from "vue";
|
|
9
|
+
import { Cancel01Icon as k } from "@hugeicons/core-free-icons";
|
|
8
10
|
// src/components/input/file-upload.ce.vue
|
|
9
|
-
var
|
|
11
|
+
var A = ["aria-disabled"], j = ["aria-disabled"], M = [
|
|
10
12
|
"aria-label",
|
|
11
13
|
"name",
|
|
12
14
|
"accept",
|
|
13
15
|
"multiple",
|
|
14
16
|
"disabled",
|
|
15
17
|
"required"
|
|
16
|
-
],
|
|
18
|
+
], N = ["inert", "aria-hidden"], P = { class: "kima-file-upload__filename" }, F = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
17
19
|
__name: "file-upload.ce",
|
|
18
20
|
props: {
|
|
19
21
|
modelValue: {
|
|
@@ -43,100 +45,104 @@ var k = ["aria-disabled"], A = ["aria-disabled"], j = [
|
|
|
43
45
|
"change",
|
|
44
46
|
"reject"
|
|
45
47
|
],
|
|
46
|
-
setup(t, { emit:
|
|
47
|
-
let
|
|
48
|
-
e(
|
|
49
|
-
function
|
|
50
|
-
if (!
|
|
48
|
+
setup(t, { emit: F }) {
|
|
49
|
+
let I = t, L = F, R = y(null), z = y(null), B = y(!1), { attrs: V, controlAttrs: H } = i(), { local: U, update: W } = a(I, L, R, (e) => Array.isArray(e) ? e : [], () => h(G));
|
|
50
|
+
e(R);
|
|
51
|
+
function G() {
|
|
52
|
+
if (!z.value) return;
|
|
51
53
|
let e = new DataTransfer();
|
|
52
|
-
for (let t of
|
|
53
|
-
|
|
54
|
+
for (let t of U.value) t instanceof File && e.items.add(t);
|
|
55
|
+
z.value.files = e.files;
|
|
54
56
|
}
|
|
55
|
-
T(
|
|
57
|
+
T(U, () => h(G), {
|
|
56
58
|
immediate: !0,
|
|
57
59
|
deep: !0
|
|
58
60
|
});
|
|
59
|
-
function
|
|
60
|
-
return !
|
|
61
|
+
function K(e) {
|
|
62
|
+
return !I.accept || I.accept.split(",").some((t) => {
|
|
61
63
|
let n = t.trim().toLowerCase();
|
|
62
64
|
return n ? n.startsWith(".") ? e.name.toLowerCase().endsWith(n) : n.endsWith("/*") ? e.type.toLowerCase().startsWith(n.slice(0, -1)) : e.type.toLowerCase() === n : !1;
|
|
63
65
|
});
|
|
64
66
|
}
|
|
65
|
-
function
|
|
66
|
-
if (
|
|
67
|
-
let t = [], n = Math.max(0,
|
|
67
|
+
function q(e) {
|
|
68
|
+
if (I.disabled) return;
|
|
69
|
+
let t = [], n = Math.max(0, I.multiple ? I.maxFiles : Math.min(1, I.maxFiles));
|
|
68
70
|
for (let r of e) {
|
|
69
|
-
let e =
|
|
70
|
-
e ?
|
|
71
|
+
let e = K(r) ? r.size > I.maxSize ? "size" : t.length >= n ? "count" : "" : "accept";
|
|
72
|
+
e ? L("reject", {
|
|
71
73
|
file: r,
|
|
72
74
|
reason: e
|
|
73
75
|
}) : t.push(r);
|
|
74
76
|
}
|
|
75
|
-
|
|
77
|
+
W(t), h(G);
|
|
76
78
|
}
|
|
77
|
-
function
|
|
78
|
-
|
|
79
|
+
function J(e) {
|
|
80
|
+
B.value = !1, q([...e.dataTransfer.files]);
|
|
79
81
|
}
|
|
80
|
-
function
|
|
81
|
-
|
|
82
|
+
function Y(e) {
|
|
83
|
+
I.disabled || W(U.value.filter((t, n) => n !== e));
|
|
82
84
|
}
|
|
83
|
-
let
|
|
84
|
-
function
|
|
85
|
+
let X = /* @__PURE__ */ new WeakMap(), Z = 0;
|
|
86
|
+
function Q(e, t) {
|
|
85
87
|
let n = S(e);
|
|
86
|
-
|
|
87
|
-
let r =
|
|
88
|
-
return `${
|
|
88
|
+
X.has(n) || X.set(n, ++Z);
|
|
89
|
+
let r = U.value.slice(0, t).filter((e) => S(e) === n).length;
|
|
90
|
+
return `${X.get(n)}-${r}`;
|
|
89
91
|
}
|
|
90
|
-
return (e,
|
|
91
|
-
class: g(["kima-file-upload", C(
|
|
92
|
-
style: _(C(
|
|
92
|
+
return (e, i) => (v(), d("div", {
|
|
93
|
+
class: g(["kima-file-upload", C(V).class]),
|
|
94
|
+
style: _(C(V).style),
|
|
93
95
|
"aria-disabled": t.disabled || void 0
|
|
94
|
-
}, [
|
|
96
|
+
}, [f("div", {
|
|
95
97
|
ref_key: "root",
|
|
96
|
-
ref:
|
|
97
|
-
class: g(["kima-file-upload__drop", { "kima-file-upload__drop--active":
|
|
98
|
+
ref: R,
|
|
99
|
+
class: g(["kima-file-upload__drop", { "kima-file-upload__drop--active": B.value && !t.disabled }]),
|
|
98
100
|
"aria-disabled": t.disabled || void 0,
|
|
99
|
-
onDragover:
|
|
100
|
-
onDragleave:
|
|
101
|
-
onDrop: O(
|
|
102
|
-
}, [
|
|
101
|
+
onDragover: i[2] ||= O((e) => B.value = !0, ["prevent"]),
|
|
102
|
+
onDragleave: i[3] ||= O((e) => B.value = !1, ["prevent"]),
|
|
103
|
+
onDrop: O(J, ["prevent"])
|
|
104
|
+
}, [f("input", m({
|
|
103
105
|
ref_key: "input",
|
|
104
|
-
ref:
|
|
105
|
-
}, C(
|
|
106
|
+
ref: z
|
|
107
|
+
}, C(H), {
|
|
106
108
|
type: "file",
|
|
107
|
-
"aria-label": C(
|
|
109
|
+
"aria-label": C(H)["aria-label"] || t.label,
|
|
108
110
|
name: t.name,
|
|
109
111
|
accept: t.accept,
|
|
110
112
|
multiple: t.multiple,
|
|
111
113
|
disabled: t.disabled,
|
|
112
114
|
required: t.required,
|
|
113
|
-
onInput:
|
|
114
|
-
onChange:
|
|
115
|
-
}), null, 16,
|
|
116
|
-
default: E(() => [D(
|
|
117
|
-
inert: !C(
|
|
118
|
-
"aria-hidden": !C(
|
|
119
|
-
}, [p(
|
|
115
|
+
onInput: i[0] ||= O(() => {}, ["stop"]),
|
|
116
|
+
onChange: i[1] ||= O((e) => q([...e.target.files]), ["stop"])
|
|
117
|
+
}), null, 16, M), f("p", null, x(t.label), 1)], 42, j), p(l, m({ css: !1 }, C(n)), {
|
|
118
|
+
default: E(() => [D(f("div", {
|
|
119
|
+
inert: !C(U).length,
|
|
120
|
+
"aria-hidden": !C(U).length || void 0
|
|
121
|
+
}, [p(u, m({
|
|
120
122
|
tag: "ul",
|
|
121
123
|
name: "kima-list"
|
|
122
|
-
}, C(
|
|
123
|
-
default: E(() => [(v(!0),
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
"aria-label": `移除 ${e.name}`,
|
|
127
|
-
onClick: (e) => q(r)
|
|
124
|
+
}, C(r), { class: "kima-file-upload__files" }), {
|
|
125
|
+
default: E(() => [(v(!0), d(c, null, b(C(U), (e, n) => (v(), d("li", { key: Q(e, n) }, [f("span", P, x(e.name) + " · " + x(e.size) + " B", 1), p(s, {
|
|
126
|
+
text: "移除文件",
|
|
127
|
+
position: "left"
|
|
128
128
|
}, {
|
|
129
|
-
default: E(() => [
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
129
|
+
default: E(() => [p(o, {
|
|
130
|
+
icon: C(k),
|
|
131
|
+
disabled: t.disabled,
|
|
132
|
+
label: `移除 ${e.name}`,
|
|
133
|
+
onClick: (e) => Y(n)
|
|
134
|
+
}, null, 8, [
|
|
135
|
+
"icon",
|
|
136
|
+
"disabled",
|
|
137
|
+
"label",
|
|
138
|
+
"onClick"
|
|
139
|
+
])]),
|
|
140
|
+
_: 2
|
|
141
|
+
}, 1024)]))), 128))]),
|
|
136
142
|
_: 1
|
|
137
|
-
}, 16)], 8,
|
|
143
|
+
}, 16)], 8, N), [[w, C(U).length]])]),
|
|
138
144
|
_: 1
|
|
139
|
-
}, 16)], 14,
|
|
145
|
+
}, 16)], 14, A));
|
|
140
146
|
}
|
|
141
|
-
}), [["__scopeId", "data-v-
|
|
142
|
-
export {
|
|
147
|
+
}), [["__scopeId", "data-v-1568bdab"]]);
|
|
148
|
+
export { F as default };
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import e from "../../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
-
import t from "
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import { useNavigationModel as t, useNavigationRoot as n } from "../../utils/navigation.js";
|
|
3
|
+
import r from "../core/icon-button.ce.js";
|
|
4
|
+
import i from "../core/tooltip.ce.js";
|
|
5
|
+
import { useContentMotion as a } from "../../utils/content-motion.js";
|
|
5
6
|
/* empty css */
|
|
6
|
-
import { Fragment as
|
|
7
|
+
import { Fragment as o, Transition as s, computed as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createVNode as p, mergeProps as m, openBlock as h, ref as g, renderList as _, renderSlot as v, toDisplayString as y, unref as b, useId as x, vShow as S, withCtx as C, withDirectives as w } from "vue";
|
|
8
|
+
import { ArrowLeft01Icon as T, ArrowRight01Icon as E } from "@hugeicons/core-free-icons";
|
|
7
9
|
// src/components/navigation/carousel.ce.vue
|
|
8
|
-
var
|
|
10
|
+
var D = ["aria-label"], O = [
|
|
9
11
|
"aria-label",
|
|
10
12
|
"aria-hidden",
|
|
11
13
|
"inert"
|
|
12
|
-
],
|
|
14
|
+
], k = { key: 0 }, A = { key: 1 }, j = { key: 0 }, M = { class: "kima-carousel__controls" }, N = {
|
|
13
15
|
"aria-live": "polite",
|
|
14
16
|
"aria-atomic": "true"
|
|
15
|
-
},
|
|
17
|
+
}, P = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
16
18
|
__name: "carousel.ce",
|
|
17
19
|
props: {
|
|
18
20
|
modelValue: {
|
|
@@ -31,84 +33,94 @@ var T = ["aria-label"], E = [
|
|
|
31
33
|
}
|
|
32
34
|
},
|
|
33
35
|
emits: ["update:modelValue", "change"],
|
|
34
|
-
setup(e, { emit:
|
|
35
|
-
let
|
|
36
|
-
|
|
37
|
-
let
|
|
38
|
-
function
|
|
36
|
+
setup(e, { emit: P }) {
|
|
37
|
+
let F = e, I = P, { root: L, forwardedAttrs: R } = n(), [z, B] = t(F, "modelValue", I), V = `kima-carousel-${x()}`, H = g(null), U = c(() => Math.max(0, Math.min(F.items.length - 1, Math.trunc(Number(z.value) || 0))));
|
|
38
|
+
a(H, () => U.value, { opacity: !1 });
|
|
39
|
+
let W = c(() => F.disabled || F.items.length < 2 || !F.loop && U.value === 0), G = c(() => F.disabled || F.items.length < 2 || !F.loop && U.value === F.items.length - 1);
|
|
40
|
+
function K(e) {
|
|
39
41
|
return e && typeof e == "object" ? e.content ?? e.label ?? "" : e;
|
|
40
42
|
}
|
|
41
|
-
function
|
|
42
|
-
e < 0 &&
|
|
43
|
+
function q(e) {
|
|
44
|
+
e < 0 && W.value || e > 0 && G.value || B((U.value + e + F.items.length) % F.items.length);
|
|
43
45
|
}
|
|
44
|
-
function
|
|
45
|
-
if (
|
|
46
|
-
let t = getComputedStyle(
|
|
47
|
-
if (e.key === "ArrowRight")
|
|
48
|
-
else if (e.key === "ArrowLeft")
|
|
49
|
-
else if (e.key === "Home")
|
|
50
|
-
else if (e.key === "End")
|
|
46
|
+
function J(e) {
|
|
47
|
+
if (F.disabled || !F.items.length || e.altKey || e.ctrlKey || e.metaKey || e.isComposing || e.target.closest("input,textarea,select,a,[contenteditable=\"true\"]")) return;
|
|
48
|
+
let t = getComputedStyle(L.value).direction === "rtl";
|
|
49
|
+
if (e.key === "ArrowRight") q(t ? -1 : 1);
|
|
50
|
+
else if (e.key === "ArrowLeft") q(t ? 1 : -1);
|
|
51
|
+
else if (e.key === "Home") B(0);
|
|
52
|
+
else if (e.key === "End") B(F.items.length - 1);
|
|
51
53
|
else return;
|
|
52
54
|
e.preventDefault();
|
|
53
55
|
}
|
|
54
|
-
return (
|
|
56
|
+
return (t, n) => (h(), d("section", m({
|
|
55
57
|
ref_key: "root",
|
|
56
|
-
ref:
|
|
57
|
-
}, b(
|
|
58
|
+
ref: L
|
|
59
|
+
}, b(R), {
|
|
58
60
|
class: "kima-carousel",
|
|
59
61
|
role: "region",
|
|
60
62
|
"aria-roledescription": "轮播",
|
|
61
63
|
"aria-label": e.label,
|
|
62
64
|
tabindex: "0",
|
|
63
|
-
onKeydown:
|
|
65
|
+
onKeydown: J
|
|
64
66
|
}), [
|
|
65
|
-
|
|
66
|
-
id:
|
|
67
|
+
f("div", {
|
|
68
|
+
id: V,
|
|
67
69
|
ref_key: "viewport",
|
|
68
|
-
ref:
|
|
70
|
+
ref: H,
|
|
69
71
|
class: "kima-carousel__viewport"
|
|
70
|
-
}, [(h(!0),
|
|
71
|
-
key:
|
|
72
|
+
}, [(h(!0), d(o, null, _(e.items, (n, r) => (h(), l(s, {
|
|
73
|
+
key: n.value ?? r,
|
|
72
74
|
name: "kima-fade"
|
|
73
75
|
}, {
|
|
74
|
-
default: C(() => [w(
|
|
76
|
+
default: C(() => [w(f("div", {
|
|
75
77
|
class: "kima-carousel__slide",
|
|
76
78
|
role: "group",
|
|
77
79
|
"aria-roledescription": "幻灯片",
|
|
78
80
|
"aria-label": `第 ${r + 1} 张,共 ${e.items.length} 张`,
|
|
79
|
-
"aria-hidden":
|
|
80
|
-
inert:
|
|
81
|
-
}, [v(
|
|
82
|
-
item:
|
|
81
|
+
"aria-hidden": U.value !== r,
|
|
82
|
+
inert: U.value !== r
|
|
83
|
+
}, [v(t.$slots, `slide-${r}`, {
|
|
84
|
+
item: n,
|
|
83
85
|
index: r
|
|
84
|
-
}, () => [
|
|
86
|
+
}, () => [n.title ? (h(), d("h3", k, y(n.title), 1)) : u("", !0), K(n) ? (h(), d("p", A, y(K(n)), 1)) : u("", !0)], !0)], 8, O), [[S, U.value === r]])]),
|
|
85
87
|
_: 2
|
|
86
|
-
}, 1024))), 128)), e.items.length ?
|
|
87
|
-
|
|
88
|
-
p(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"aria-controls": z,
|
|
92
|
-
"aria-label": "上一张",
|
|
93
|
-
onClick: r[0] ||= (e) => G(-1)
|
|
88
|
+
}, 1024))), 128)), e.items.length ? u("", !0) : (h(), d("p", j, "暂无内容"))], 512),
|
|
89
|
+
f("div", M, [
|
|
90
|
+
p(i, {
|
|
91
|
+
text: "上一张",
|
|
92
|
+
position: "right"
|
|
94
93
|
}, {
|
|
95
|
-
default: C(() => [
|
|
94
|
+
default: C(() => [p(r, {
|
|
95
|
+
class: "kima-carousel__previous",
|
|
96
|
+
icon: b(T),
|
|
97
|
+
variant: "tonal",
|
|
98
|
+
disabled: W.value,
|
|
99
|
+
"aria-controls": V,
|
|
100
|
+
label: "上一张",
|
|
101
|
+
onClick: n[0] ||= (e) => q(-1)
|
|
102
|
+
}, null, 8, ["icon", "disabled"])]),
|
|
96
103
|
_: 1
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
p(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
"aria-controls": z,
|
|
103
|
-
"aria-label": "下一张",
|
|
104
|
-
onClick: r[1] ||= (e) => G(1)
|
|
104
|
+
}),
|
|
105
|
+
f("output", N, y(e.items.length ? U.value + 1 : 0) + " / " + y(e.items.length), 1),
|
|
106
|
+
p(i, {
|
|
107
|
+
text: "下一张",
|
|
108
|
+
position: "left"
|
|
105
109
|
}, {
|
|
106
|
-
default: C(() => [
|
|
110
|
+
default: C(() => [p(r, {
|
|
111
|
+
class: "kima-carousel__next",
|
|
112
|
+
icon: b(E),
|
|
113
|
+
variant: "tonal",
|
|
114
|
+
disabled: G.value,
|
|
115
|
+
"aria-controls": V,
|
|
116
|
+
label: "下一张",
|
|
117
|
+
onClick: n[1] ||= (e) => q(1)
|
|
118
|
+
}, null, 8, ["icon", "disabled"])]),
|
|
107
119
|
_: 1
|
|
108
|
-
}
|
|
120
|
+
})
|
|
109
121
|
]),
|
|
110
|
-
v(
|
|
111
|
-
], 16,
|
|
122
|
+
v(t.$slots, "default", {}, void 0, !0)
|
|
123
|
+
], 16, D));
|
|
112
124
|
}
|
|
113
|
-
}), [["__scopeId", "data-v-
|
|
114
|
-
export {
|
|
125
|
+
}), [["__scopeId", "data-v-6a7ca57f"]]);
|
|
126
|
+
export { P as default };
|