@kernel4632/kima 0.8.4 → 0.8.6
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,16 +1,17 @@
|
|
|
1
1
|
import e from "../../_virtual/_plugin-vue_export-helper.js";
|
|
2
2
|
import t from "../core/button.ce.js";
|
|
3
3
|
import n from "../core/icon.ce.js";
|
|
4
|
-
import {
|
|
5
|
-
import { dismissInteraction as ee, useChoiceCursor as te, useInteractionModel as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
4
|
+
import { freezeLeaveLayout as r, presenceTransition as i } from "../../utils/motion.js";
|
|
5
|
+
import { dismissInteraction as ee, useChoiceCursor as te, useInteractionModel as a, useInteractionReset as ne, useInteractionRoot as re, usePlacement as ie } from "../../utils/interaction.js";
|
|
6
|
+
import ae from "../core/icon-button.ce.js";
|
|
7
|
+
import { useContentMotion as o } from "../../utils/content-motion.js";
|
|
8
|
+
import oe from "./chip.ce.js";
|
|
8
9
|
/* empty css */
|
|
9
|
-
import { Fragment as
|
|
10
|
-
import { PopoverContent as
|
|
11
|
-
import { Cancel01Icon as
|
|
10
|
+
import { Fragment as s, Transition as c, TransitionGroup as se, computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, createTextVNode as m, createVNode as h, mergeProps as g, nextTick as _, openBlock as v, ref as y, renderList as b, toDisplayString as x, unref as S, useId as ce, vModelText as le, watch as ue, withCtx as C, withDirectives as de, withKeys as fe, withModifiers as w } from "vue";
|
|
11
|
+
import { PopoverContent as pe, PopoverRoot as me, PopoverTrigger as he } from "reka-ui";
|
|
12
|
+
import { Cancel01Icon as ge, Tick01Icon as _e } from "@hugeicons/core-free-icons";
|
|
12
13
|
// src/components/interaction/multi-select.ce.vue
|
|
13
|
-
var
|
|
14
|
+
var ve = { class: "kima-multi-select__control" }, T = ["aria-activedescendant"], E = [
|
|
14
15
|
"aria-label",
|
|
15
16
|
"tabindex",
|
|
16
17
|
"aria-activedescendant"
|
|
@@ -78,61 +79,65 @@ var me = { class: "kima-multi-select__control" }, he = ["aria-activedescendant"]
|
|
|
78
79
|
"change"
|
|
79
80
|
],
|
|
80
81
|
setup(e, { emit: N }) {
|
|
81
|
-
let P = e, F = N, { root: I, attrs:
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
let P = e, F = N, { root: I, attrs: ye, forwardedAttrs: be } = re(), [L, R] = a(P, "modelValue", F), [z, xe] = a(P, "open", F), Se = ie(P), B = y(""), V = y(null), H = y(null), U = `kima-multi-select-${ce()}`, W = l(() => Array.isArray(L.value) ? L.value : []), G = l(() => P.items.filter((e) => W.value.includes(e.value))), K = l(() => P.items.filter((e) => `${e.label} ${e.description || ""}`.toLocaleLowerCase().includes(B.value.trim().toLocaleLowerCase())));
|
|
83
|
+
y(null), o(I, () => G.value);
|
|
84
|
+
function q(e) {
|
|
85
|
+
P.disabled || (R(e), F("change", [...e]));
|
|
84
86
|
}
|
|
85
|
-
function
|
|
86
|
-
P.disabled || e.disabled ||
|
|
87
|
+
function J(e) {
|
|
88
|
+
P.disabled || e.disabled || q(W.value.includes(e.value) ? W.value.filter((t) => !Object.is(t, e.value)) : [...W.value, e.value]);
|
|
87
89
|
}
|
|
88
|
-
function
|
|
89
|
-
e.disabled ||
|
|
90
|
+
function Ce(e) {
|
|
91
|
+
e.disabled || q(W.value.filter((t) => !Object.is(t, e.value)));
|
|
90
92
|
}
|
|
91
|
-
function
|
|
92
|
-
|
|
93
|
+
function we() {
|
|
94
|
+
q(P.items.filter((e) => e.disabled && W.value.includes(e.value)).map((e) => e.value));
|
|
93
95
|
}
|
|
94
|
-
function
|
|
95
|
-
e && P.disabled || (e && !
|
|
96
|
+
function Y(e) {
|
|
97
|
+
e && P.disabled || (e && !z.value && (B.value = ""), xe(e));
|
|
96
98
|
}
|
|
97
|
-
let { active:
|
|
99
|
+
let { active: X, activeId: Z, highlight: Q, keydown: Te } = te(K, J, `${U}-option`);
|
|
98
100
|
function $(e) {
|
|
99
101
|
if (!e.isComposing) {
|
|
100
102
|
if (e.key === " " && !P.searchable) {
|
|
101
103
|
e.preventDefault();
|
|
102
|
-
let t =
|
|
103
|
-
t &&
|
|
104
|
-
} else
|
|
104
|
+
let t = K.value[X.value];
|
|
105
|
+
t && J(t);
|
|
106
|
+
} else Te(e);
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
|
-
function
|
|
108
|
-
e.preventDefault(),
|
|
109
|
-
|
|
109
|
+
function Ee(e) {
|
|
110
|
+
e.preventDefault(), _(() => {
|
|
111
|
+
z.value && !P.disabled && (P.searchable ? V.value : H.value)?.focus();
|
|
110
112
|
});
|
|
111
113
|
}
|
|
112
|
-
function
|
|
113
|
-
|
|
114
|
+
function De(e) {
|
|
115
|
+
q([...e.target.selectedOptions].map((e) => P.items[Number(e.dataset.index)].value));
|
|
114
116
|
}
|
|
115
|
-
return
|
|
116
|
-
e &&
|
|
117
|
-
}), (te,
|
|
117
|
+
return ne(I, L, R, () => Y(!1)), ue(() => P.disabled, (e) => {
|
|
118
|
+
e && Y(!1);
|
|
119
|
+
}), (te, a) => (v(), f("div", g({
|
|
118
120
|
ref_key: "root",
|
|
119
121
|
ref: I
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
+
}, S(be), { class: "kima-multi-select" }), [
|
|
123
|
+
h(se, g({
|
|
122
124
|
tag: "div",
|
|
123
125
|
name: "kima-list"
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
+
}, {
|
|
127
|
+
...S(i),
|
|
128
|
+
onBeforeLeave: S(r)
|
|
129
|
+
}, { class: "kima-multi-select__chips" }), {
|
|
130
|
+
default: C(() => [(v(!0), f(s, null, b(G.value, (t) => (v(), f("span", {
|
|
126
131
|
key: t.value,
|
|
127
132
|
class: "kima-multi-select__chip"
|
|
128
|
-
}, [
|
|
133
|
+
}, [h(oe, {
|
|
129
134
|
removable: "",
|
|
130
135
|
label: t.label,
|
|
131
136
|
disabled: e.disabled || t.disabled,
|
|
132
137
|
value: t.value,
|
|
133
|
-
onRemove: (e) =>
|
|
138
|
+
onRemove: (e) => Ce(t)
|
|
134
139
|
}, {
|
|
135
|
-
default:
|
|
140
|
+
default: C(() => [m(x(t.label), 1)]),
|
|
136
141
|
_: 2
|
|
137
142
|
}, 1032, [
|
|
138
143
|
"label",
|
|
@@ -142,20 +147,20 @@ var me = { class: "kima-multi-select__control" }, he = ["aria-activedescendant"]
|
|
|
142
147
|
])]))), 128))]),
|
|
143
148
|
_: 1
|
|
144
149
|
}, 16),
|
|
145
|
-
|
|
146
|
-
open:
|
|
150
|
+
p("div", ve, [h(S(me), {
|
|
151
|
+
open: S(z) && !e.disabled,
|
|
147
152
|
modal: !1,
|
|
148
|
-
"onUpdate:open":
|
|
153
|
+
"onUpdate:open": Y
|
|
149
154
|
}, {
|
|
150
|
-
default:
|
|
151
|
-
default:
|
|
155
|
+
default: C(() => [h(S(he), { "as-child": "" }, {
|
|
156
|
+
default: C(() => [h(t, {
|
|
152
157
|
variant: "tonal",
|
|
153
158
|
disabled: e.disabled,
|
|
154
|
-
"aria-label":
|
|
159
|
+
"aria-label": S(ye)["aria-label"] || e.label,
|
|
155
160
|
"aria-required": e.required || void 0,
|
|
156
|
-
onKeydown:
|
|
161
|
+
onKeydown: a[0] ||= fe(w((e) => Y(!0), ["prevent"]), ["down"])
|
|
157
162
|
}, {
|
|
158
|
-
default:
|
|
163
|
+
default: C(() => [m(x(G.value.length ? `已选择 ${G.value.length} 项` : e.placeholder), 1)]),
|
|
159
164
|
_: 1
|
|
160
165
|
}, 8, [
|
|
161
166
|
"disabled",
|
|
@@ -163,84 +168,84 @@ var me = { class: "kima-multi-select__control" }, he = ["aria-activedescendant"]
|
|
|
163
168
|
"aria-required"
|
|
164
169
|
])]),
|
|
165
170
|
_: 1
|
|
166
|
-
}),
|
|
167
|
-
default:
|
|
171
|
+
}), h(c, g({ name: "kima-popup" }, S(i)), {
|
|
172
|
+
default: C(() => [S(z) && !e.disabled ? (v(), u(S(pe), g({
|
|
168
173
|
key: 0,
|
|
169
174
|
"force-mount": ""
|
|
170
|
-
},
|
|
175
|
+
}, S(Se), {
|
|
171
176
|
class: "kima-multi-select__popup",
|
|
172
177
|
"aria-label": e.label,
|
|
173
|
-
onOpenAutoFocus:
|
|
174
|
-
onEscapeKeyDown:
|
|
178
|
+
onOpenAutoFocus: Ee,
|
|
179
|
+
onEscapeKeyDown: a[5] ||= (e) => S(ee)(e, () => Y(!1))
|
|
175
180
|
}), {
|
|
176
|
-
default:
|
|
177
|
-
e.searchable ?
|
|
181
|
+
default: C(() => [
|
|
182
|
+
e.searchable ? de((v(), f("input", {
|
|
178
183
|
key: 0,
|
|
179
184
|
ref_key: "search",
|
|
180
|
-
ref:
|
|
181
|
-
"onUpdate:modelValue":
|
|
185
|
+
ref: V,
|
|
186
|
+
"onUpdate:modelValue": a[1] ||= (e) => B.value = e,
|
|
182
187
|
class: "kima-multi-select__search",
|
|
183
188
|
type: "search",
|
|
184
189
|
role: "combobox",
|
|
185
190
|
"aria-expanded": "true",
|
|
186
191
|
"aria-autocomplete": "list",
|
|
187
192
|
"aria-label": "搜索选项",
|
|
188
|
-
"aria-controls":
|
|
189
|
-
"aria-activedescendant":
|
|
193
|
+
"aria-controls": U,
|
|
194
|
+
"aria-activedescendant": S(Z),
|
|
190
195
|
onKeydown: $,
|
|
191
|
-
onInput:
|
|
192
|
-
onChange:
|
|
193
|
-
}, null, 40,
|
|
194
|
-
|
|
195
|
-
id:
|
|
196
|
+
onInput: a[2] ||= w(() => {}, ["stop"]),
|
|
197
|
+
onChange: a[3] ||= w(() => {}, ["stop"])
|
|
198
|
+
}, null, 40, T)), [[le, B.value]]) : d("", !0),
|
|
199
|
+
p("div", {
|
|
200
|
+
id: U,
|
|
196
201
|
ref_key: "panel",
|
|
197
|
-
ref:
|
|
202
|
+
ref: H,
|
|
198
203
|
class: "kima-multi-select__list",
|
|
199
204
|
role: "listbox",
|
|
200
205
|
"aria-multiselectable": "true",
|
|
201
206
|
"aria-label": e.label,
|
|
202
207
|
tabindex: e.searchable ? -1 : 0,
|
|
203
|
-
"aria-activedescendant": e.searchable ? void 0 :
|
|
208
|
+
"aria-activedescendant": e.searchable ? void 0 : S(Z),
|
|
204
209
|
onKeydown: $
|
|
205
|
-
}, [(
|
|
206
|
-
id: `${
|
|
210
|
+
}, [(v(!0), f(s, null, b(K.value, (e, t) => (v(), f("div", {
|
|
211
|
+
id: `${U}-option-${t}`,
|
|
207
212
|
key: e.value,
|
|
208
213
|
class: "kima-multi-select__item",
|
|
209
214
|
role: "option",
|
|
210
|
-
"aria-selected":
|
|
215
|
+
"aria-selected": W.value.includes(e.value),
|
|
211
216
|
"aria-disabled": e.disabled || void 0,
|
|
212
|
-
"data-active":
|
|
213
|
-
onPointerdown:
|
|
214
|
-
onPointermove: (n) => !e.disabled &&
|
|
215
|
-
onClick: (t) =>
|
|
216
|
-
}, [
|
|
217
|
+
"data-active": S(X) === t,
|
|
218
|
+
onPointerdown: a[4] ||= w(() => {}, ["prevent"]),
|
|
219
|
+
onPointermove: (n) => !e.disabled && S(Q)(t),
|
|
220
|
+
onClick: (t) => J(e)
|
|
221
|
+
}, [p("span", null, [m(x(e.label), 1), e.description ? (v(), f("small", O, x(e.description), 1)) : d("", !0)]), W.value.includes(e.value) ? (v(), u(n, {
|
|
217
222
|
key: 0,
|
|
218
|
-
icon:
|
|
223
|
+
icon: S(_e),
|
|
219
224
|
size: 20,
|
|
220
225
|
"aria-hidden": "true"
|
|
221
|
-
}, null, 8, ["icon"])) :
|
|
222
|
-
|
|
226
|
+
}, null, 8, ["icon"])) : d("", !0)], 40, D))), 128))], 40, E),
|
|
227
|
+
K.value.length ? d("", !0) : (v(), f("p", k, "没有匹配选项"))
|
|
223
228
|
]),
|
|
224
229
|
_: 1
|
|
225
|
-
}, 16, ["aria-label"])) :
|
|
230
|
+
}, 16, ["aria-label"])) : d("", !0)]),
|
|
226
231
|
_: 1
|
|
227
232
|
}, 16)]),
|
|
228
233
|
_: 1
|
|
229
|
-
}, 8, ["open"]),
|
|
230
|
-
default:
|
|
234
|
+
}, 8, ["open"]), h(c, g({ name: "kima-content" }, S(i)), {
|
|
235
|
+
default: C(() => [e.clearable && G.value.length ? (v(), f("span", A, [h(ae, {
|
|
231
236
|
label: "清除选择",
|
|
232
237
|
disabled: e.disabled,
|
|
233
|
-
onClick:
|
|
238
|
+
onClick: we
|
|
234
239
|
}, {
|
|
235
|
-
default:
|
|
236
|
-
icon:
|
|
240
|
+
default: C(() => [h(n, {
|
|
241
|
+
icon: S(ge),
|
|
237
242
|
size: 20
|
|
238
243
|
}, null, 8, ["icon"])]),
|
|
239
244
|
_: 1
|
|
240
|
-
}, 8, ["disabled"])])) :
|
|
245
|
+
}, 8, ["disabled"])])) : d("", !0)]),
|
|
241
246
|
_: 1
|
|
242
247
|
}, 16)]),
|
|
243
|
-
|
|
248
|
+
p("select", {
|
|
244
249
|
class: "kima-multi-select__native",
|
|
245
250
|
multiple: "",
|
|
246
251
|
name: e.name,
|
|
@@ -248,17 +253,17 @@ var me = { class: "kima-multi-select__control" }, he = ["aria-activedescendant"]
|
|
|
248
253
|
disabled: e.disabled,
|
|
249
254
|
tabindex: "-1",
|
|
250
255
|
"aria-hidden": "true",
|
|
251
|
-
onInput:
|
|
252
|
-
onChange:
|
|
253
|
-
onInvalid:
|
|
254
|
-
}, [(
|
|
256
|
+
onInput: a[6] ||= w(() => {}, ["stop"]),
|
|
257
|
+
onChange: w(De, ["stop"]),
|
|
258
|
+
onInvalid: a[7] ||= w((e) => S(I)?.querySelector("button")?.focus(), ["prevent"])
|
|
259
|
+
}, [(v(!0), f(s, null, b(e.items, (e, t) => (v(), f("option", {
|
|
255
260
|
key: e.value,
|
|
256
261
|
value: String(e.value),
|
|
257
262
|
"data-index": t,
|
|
258
263
|
disabled: e.disabled,
|
|
259
|
-
selected:
|
|
260
|
-
},
|
|
264
|
+
selected: W.value.includes(e.value)
|
|
265
|
+
}, x(e.label), 9, M))), 128))], 40, j)
|
|
261
266
|
], 16));
|
|
262
267
|
}
|
|
263
|
-
}), [["__scopeId", "data-v-
|
|
268
|
+
}), [["__scopeId", "data-v-cf70a212"]]);
|
|
264
269
|
export { N as default };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import e from "../../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
-
import {
|
|
3
|
-
import { useInteractionRoot as
|
|
4
|
-
import
|
|
2
|
+
import { freezeLeaveLayout as t, presenceTransition as n } from "../../utils/motion.js";
|
|
3
|
+
import { useInteractionRoot as r } from "../../utils/interaction.js";
|
|
4
|
+
import { useContentMotion as i } from "../../utils/content-motion.js";
|
|
5
|
+
import a from "../core/progress.ce.js";
|
|
5
6
|
/* empty css */
|
|
6
|
-
import { Fragment as
|
|
7
|
+
import { Fragment as o, TransitionGroup as s, computed as c, createElementBlock as l, createElementVNode as u, createVNode as d, mergeProps as f, openBlock as p, ref as m, renderList as h, toDisplayString as g, unref as _, watch as v, withCtx as y } from "vue";
|
|
7
8
|
// src/components/utility/progress-group.ce.vue
|
|
8
|
-
var
|
|
9
|
+
var b = ["aria-label"], x = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
9
10
|
__name: "progress-group.ce",
|
|
10
11
|
props: {
|
|
11
12
|
tasks: {
|
|
@@ -18,8 +19,8 @@ var _ = ["aria-label"], v = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inhe
|
|
|
18
19
|
}
|
|
19
20
|
},
|
|
20
21
|
emits: ["change"],
|
|
21
|
-
setup(e, { expose:
|
|
22
|
-
let
|
|
22
|
+
setup(e, { expose: x, emit: S }) {
|
|
23
|
+
let C = e, w = S, { root: T, forwardedAttrs: E } = r(), D = c(() => C.tasks.map((e, t) => {
|
|
23
24
|
let n = Number(e.max ?? 100), r = Number(e.value) || 0, i = Number(e.weight ?? 1);
|
|
24
25
|
return {
|
|
25
26
|
...e,
|
|
@@ -27,33 +28,36 @@ var _ = ["aria-label"], v = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inhe
|
|
|
27
28
|
weight: Number.isFinite(i) ? Math.max(0, i) : 0,
|
|
28
29
|
percent: n > 0 ? Math.min(100, Math.max(0, r / n * 100)) : 0
|
|
29
30
|
};
|
|
30
|
-
})),
|
|
31
|
-
let e =
|
|
32
|
-
return e ?
|
|
31
|
+
})), O = c(() => {
|
|
32
|
+
let e = D.value.reduce((e, t) => e + t.weight, 0);
|
|
33
|
+
return e ? D.value.reduce((e, t) => e + t.percent * t.weight, 0) / e : 0;
|
|
33
34
|
});
|
|
34
|
-
return
|
|
35
|
+
return m(null), i(T, () => D.value), v(O, (e) => w("change", e)), x({ aggregate: O }), (r, i) => (p(), l("section", f({
|
|
35
36
|
ref_key: "root",
|
|
36
|
-
ref:
|
|
37
|
-
},
|
|
37
|
+
ref: T
|
|
38
|
+
}, _(E), {
|
|
38
39
|
class: "kima-progress-group",
|
|
39
40
|
"aria-label": e.label
|
|
40
41
|
}), [
|
|
41
|
-
|
|
42
|
-
value:
|
|
42
|
+
d(a, {
|
|
43
|
+
value: O.value,
|
|
43
44
|
label: e.label
|
|
44
45
|
}, null, 8, ["value", "label"]),
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
u("p", null, g(e.label) + " · " + g(Math.round(O.value)) + "%", 1),
|
|
47
|
+
d(s, f({
|
|
47
48
|
tag: "ul",
|
|
48
49
|
name: "kima-list"
|
|
49
|
-
},
|
|
50
|
-
|
|
50
|
+
}, {
|
|
51
|
+
..._(n),
|
|
52
|
+
onBeforeLeave: _(t)
|
|
53
|
+
}), {
|
|
54
|
+
default: y(() => [(p(!0), l(o, null, h(D.value, (e) => (p(), l("li", { key: e.id }, [u("span", null, g(e.label), 1), d(a, {
|
|
51
55
|
value: e.percent,
|
|
52
56
|
label: e.label || "任务"
|
|
53
57
|
}, null, 8, ["value", "label"])]))), 128))]),
|
|
54
58
|
_: 1
|
|
55
59
|
}, 16)
|
|
56
|
-
], 16,
|
|
60
|
+
], 16, b));
|
|
57
61
|
}
|
|
58
|
-
}), [["__scopeId", "data-v-
|
|
59
|
-
export {
|
|
62
|
+
}), [["__scopeId", "data-v-d4453504"]]);
|
|
63
|
+
export { x as default };
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import e from "../../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
-
import {
|
|
3
|
-
import { useInteractionModel as
|
|
4
|
-
import
|
|
2
|
+
import { freezeLeaveLayout as t, presenceTransition as n } from "../../utils/motion.js";
|
|
3
|
+
import { useInteractionModel as r, useInteractionReset as i, useInteractionRoot as a } from "../../utils/interaction.js";
|
|
4
|
+
import { useContentMotion as o } from "../../utils/content-motion.js";
|
|
5
|
+
import s from "../interaction/chip.ce.js";
|
|
5
6
|
/* empty css */
|
|
6
|
-
import { Fragment as
|
|
7
|
+
import { Fragment as c, TransitionGroup as l, computed as u, createBlock as d, createElementBlock as f, createVNode as p, mergeProps as m, nextTick as h, onMounted as g, openBlock as _, ref as v, renderList as y, unref as b, watch as x, withCtx as S } from "vue";
|
|
7
8
|
// src/components/utility/tag-group.ce.vue
|
|
8
|
-
var
|
|
9
|
+
var C = ["aria-label"], w = [
|
|
9
10
|
"name",
|
|
10
11
|
"value",
|
|
11
12
|
"disabled"
|
|
12
|
-
],
|
|
13
|
+
], T = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
13
14
|
__name: "tag-group.ce",
|
|
14
15
|
props: {
|
|
15
16
|
items: {
|
|
@@ -35,61 +36,66 @@ var x = ["aria-label"], S = [
|
|
|
35
36
|
"change",
|
|
36
37
|
"remove"
|
|
37
38
|
],
|
|
38
|
-
setup(e, { emit:
|
|
39
|
-
let
|
|
39
|
+
setup(e, { emit: T }) {
|
|
40
|
+
let E = e, D = T, { root: O, forwardedAttrs: k } = a(), [A, j] = r(E, "items", D), [M, N] = r(E, "modelValue", D), P = v(0), F = u(() => A.value.map((e) => typeof e == "object" ? e : {
|
|
40
41
|
value: e,
|
|
41
42
|
label: String(e)
|
|
42
|
-
}))
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
}));
|
|
44
|
+
o(O, () => F.value);
|
|
45
|
+
let I = (e) => M.value.includes(e.value);
|
|
46
|
+
function L(e) {
|
|
47
|
+
E.disabled || e.disabled || (N(I(e) ? M.value.filter((t) => t !== e.value) : [...M.value, e.value]), D("change", M.value));
|
|
45
48
|
}
|
|
46
|
-
function
|
|
47
|
-
return [...
|
|
49
|
+
function R() {
|
|
50
|
+
return [...O.value?.querySelectorAll("button:not(:disabled)") || []].filter((e) => !e.closest("[inert]"));
|
|
48
51
|
}
|
|
49
|
-
async function
|
|
50
|
-
await
|
|
51
|
-
let t =
|
|
52
|
-
|
|
53
|
-
e.tabIndex = t ===
|
|
54
|
-
}), e && t[
|
|
52
|
+
async function z(e = !1) {
|
|
53
|
+
await h();
|
|
54
|
+
let t = R();
|
|
55
|
+
P.value = Math.max(0, Math.min(P.value, t.length - 1)), t.forEach((e, t) => {
|
|
56
|
+
e.tabIndex = t === P.value ? 0 : -1;
|
|
57
|
+
}), e && t[P.value]?.focus();
|
|
55
58
|
}
|
|
56
|
-
function
|
|
57
|
-
|
|
59
|
+
function B(e) {
|
|
60
|
+
E.disabled || e.disabled || (j(A.value.filter((t) => (typeof t == "object" ? t.value : t) !== e.value)), N(M.value.filter((t) => t !== e.value)), D("remove", e), z(!0));
|
|
58
61
|
}
|
|
59
|
-
function
|
|
60
|
-
let t =
|
|
62
|
+
function V(e) {
|
|
63
|
+
let t = R(), n = t.indexOf(e.target);
|
|
61
64
|
if (!(n < 0) && ([
|
|
62
65
|
"ArrowRight",
|
|
63
66
|
"ArrowLeft",
|
|
64
67
|
"Home",
|
|
65
68
|
"End"
|
|
66
|
-
].includes(e.key) && (e.preventDefault(),
|
|
69
|
+
].includes(e.key) && (e.preventDefault(), P.value = e.key === "Home" ? 0 : e.key === "End" ? t.length - 1 : (n + (e.key === "ArrowLeft" ? -1 : 1) + t.length) % t.length, z(!0)), ["Delete", "Backspace"].includes(e.key) && E.removable)) {
|
|
67
70
|
let t = e.target.closest("[data-tag-index]")?.dataset.tagIndex;
|
|
68
|
-
t != null && (e.preventDefault(),
|
|
71
|
+
t != null && (e.preventDefault(), B(F.value[Number(t)]));
|
|
69
72
|
}
|
|
70
73
|
}
|
|
71
|
-
return
|
|
72
|
-
|
|
73
|
-
() =>
|
|
74
|
-
() =>
|
|
75
|
-
() =>
|
|
76
|
-
], () =>
|
|
74
|
+
return x([
|
|
75
|
+
F,
|
|
76
|
+
() => E.disabled,
|
|
77
|
+
() => E.selectable,
|
|
78
|
+
() => E.removable
|
|
79
|
+
], () => z(), {
|
|
77
80
|
immediate: !0,
|
|
78
81
|
flush: "post"
|
|
79
|
-
}),
|
|
82
|
+
}), g(() => z()), i(O, M, N), i(O, A, j), (r, i) => (_(), f("div", m({
|
|
80
83
|
ref_key: "root",
|
|
81
|
-
ref:
|
|
82
|
-
},
|
|
84
|
+
ref: O
|
|
85
|
+
}, b(k), {
|
|
83
86
|
class: "kima-tag-group",
|
|
84
87
|
role: "group",
|
|
85
88
|
"aria-label": e.label,
|
|
86
|
-
onKeydown:
|
|
87
|
-
}), [
|
|
89
|
+
onKeydown: V
|
|
90
|
+
}), [p(l, m({
|
|
88
91
|
name: "kima-list",
|
|
89
92
|
tag: "div",
|
|
90
93
|
class: "kima-tag-group__items"
|
|
91
|
-
},
|
|
92
|
-
|
|
94
|
+
}, {
|
|
95
|
+
...b(n),
|
|
96
|
+
onBeforeLeave: b(t)
|
|
97
|
+
}), {
|
|
98
|
+
default: S(() => [(_(!0), f(c, null, y(F.value, (t, n) => (_(), d(s, {
|
|
93
99
|
key: t.value,
|
|
94
100
|
"data-tag-index": n,
|
|
95
101
|
label: t.label,
|
|
@@ -97,9 +103,9 @@ var x = ["aria-label"], S = [
|
|
|
97
103
|
selectable: e.selectable,
|
|
98
104
|
removable: e.removable,
|
|
99
105
|
disabled: e.disabled || t.disabled,
|
|
100
|
-
"model-value":
|
|
101
|
-
onChange: (e) =>
|
|
102
|
-
onRemove: (e) =>
|
|
106
|
+
"model-value": I(t),
|
|
107
|
+
onChange: (e) => L(t),
|
|
108
|
+
onRemove: (e) => B(t)
|
|
103
109
|
}, null, 8, [
|
|
104
110
|
"data-tag-index",
|
|
105
111
|
"label",
|
|
@@ -112,13 +118,13 @@ var x = ["aria-label"], S = [
|
|
|
112
118
|
"onRemove"
|
|
113
119
|
]))), 128))]),
|
|
114
120
|
_: 1
|
|
115
|
-
}, 16), (
|
|
121
|
+
}, 16), (_(!0), f(c, null, y(b(M), (t) => (_(), f("input", {
|
|
116
122
|
key: t,
|
|
117
123
|
type: "hidden",
|
|
118
124
|
name: e.name,
|
|
119
125
|
value: t,
|
|
120
126
|
disabled: e.disabled
|
|
121
|
-
}, null, 8,
|
|
127
|
+
}, null, 8, w))), 128))], 16, C));
|
|
122
128
|
}
|
|
123
|
-
}), [["__scopeId", "data-v-
|
|
124
|
-
export {
|
|
129
|
+
}), [["__scopeId", "data-v-892954ad"]]);
|
|
130
|
+
export { T as default };
|