@kernel4632/kima 0.0.0-stage → 0.6.0
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 +166 -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 +99 -4
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { useNativeSlots as e } from "../../utils/native-slots.js";
|
|
2
|
+
import { useRipple as t } from "../../utils/ripple.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import n from "../../_virtual/_plugin-vue_export-helper.js";
|
|
5
|
+
import { Transition as r, computed as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createVNode as c, mergeProps as l, openBlock as u, ref as d, renderSlot as f, unref as p, useAttrs as m, withCtx as h } from "vue";
|
|
6
|
+
// src/components/core/button.ce.vue
|
|
7
|
+
var g = [
|
|
8
|
+
"type",
|
|
9
|
+
"disabled",
|
|
10
|
+
"aria-busy"
|
|
11
|
+
], _ = {
|
|
12
|
+
key: "loading",
|
|
13
|
+
class: "kima-button__indicator",
|
|
14
|
+
"aria-hidden": "true"
|
|
15
|
+
}, v = {
|
|
16
|
+
key: "leading",
|
|
17
|
+
class: "kima-button__slot kima-button__slot--leading"
|
|
18
|
+
}, y = { class: "kima-button__label" }, b = {
|
|
19
|
+
key: 0,
|
|
20
|
+
class: "kima-button__slot kima-button__slot--trailing"
|
|
21
|
+
}, x = /*#__PURE__*/ n(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
22
|
+
__name: "button.ce",
|
|
23
|
+
props: {
|
|
24
|
+
variant: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: "filled"
|
|
27
|
+
},
|
|
28
|
+
shape: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: "round"
|
|
31
|
+
},
|
|
32
|
+
round: Boolean,
|
|
33
|
+
disabled: Boolean,
|
|
34
|
+
loading: Boolean,
|
|
35
|
+
type: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: "button"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
setup(n) {
|
|
41
|
+
let x = n, S = m(), C = d(null), { hasNativeSlot: w, isCustomElement: T } = e(C), E = i(() => T ? {
|
|
42
|
+
...S,
|
|
43
|
+
id: void 0
|
|
44
|
+
} : S);
|
|
45
|
+
t(C);
|
|
46
|
+
let D = i(() => [
|
|
47
|
+
"filled",
|
|
48
|
+
"tonal",
|
|
49
|
+
"outlined",
|
|
50
|
+
"text"
|
|
51
|
+
].includes(x.variant) ? x.variant : "filled"), O = i(() => x.round || x.shape !== "square");
|
|
52
|
+
return (e, t) => (u(), o("button", l({
|
|
53
|
+
ref_key: "root",
|
|
54
|
+
ref: C
|
|
55
|
+
}, E.value, {
|
|
56
|
+
class: ["kima-button", [`kima-button--${D.value}`, { "kima-button--round": O.value }]],
|
|
57
|
+
type: n.type,
|
|
58
|
+
disabled: n.disabled || n.loading,
|
|
59
|
+
"aria-busy": n.loading || void 0
|
|
60
|
+
}), [
|
|
61
|
+
c(r, {
|
|
62
|
+
name: "kima-fade",
|
|
63
|
+
mode: "out-in"
|
|
64
|
+
}, {
|
|
65
|
+
default: h(() => [n.loading ? (u(), o("span", _, [...t[0] ||= [s("span", { class: "kima-button__spinner" }, null, -1)]])) : e.$slots.leading || p(w)("leading") ? (u(), o("span", v, [f(e.$slots, "leading", {}, void 0, !0)])) : a("", !0)]),
|
|
66
|
+
_: 3
|
|
67
|
+
}),
|
|
68
|
+
s("span", y, [f(e.$slots, "default", {}, void 0, !0)]),
|
|
69
|
+
e.$slots.trailing || p(w)("trailing") ? (u(), o("span", b, [f(e.$slots, "trailing", {}, void 0, !0)])) : a("", !0)
|
|
70
|
+
], 16, g));
|
|
71
|
+
}
|
|
72
|
+
}), [["__scopeId", "data-v-ba403858"]]);
|
|
73
|
+
export { x as default };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { useNativeSlots as e } from "../../utils/native-slots.js";
|
|
2
|
+
import { useRipple as t } from "../../utils/ripple.js";
|
|
3
|
+
import n from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { computed as r, createCommentVNode as i, createElementBlock as a, mergeProps as o, openBlock as s, ref as c, renderSlot as l, unref as u, useAttrs as d } from "vue";
|
|
6
|
+
// src/components/core/card.ce.vue
|
|
7
|
+
var f = [
|
|
8
|
+
"role",
|
|
9
|
+
"tabindex",
|
|
10
|
+
"aria-disabled"
|
|
11
|
+
], p = {
|
|
12
|
+
key: 0,
|
|
13
|
+
class: "kima-card__header"
|
|
14
|
+
}, m = {
|
|
15
|
+
key: 1,
|
|
16
|
+
class: "kima-card__body"
|
|
17
|
+
}, h = {
|
|
18
|
+
key: 2,
|
|
19
|
+
class: "kima-card__footer"
|
|
20
|
+
}, g = /*#__PURE__*/ n(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
21
|
+
__name: "card.ce",
|
|
22
|
+
props: {
|
|
23
|
+
variant: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: "surface"
|
|
26
|
+
},
|
|
27
|
+
clickable: Boolean,
|
|
28
|
+
disabled: Boolean
|
|
29
|
+
},
|
|
30
|
+
setup(n) {
|
|
31
|
+
let g = n, _ = d(), v = c(null), { hasNativeSlot: y, isCustomElement: b } = e(v), x = r(() => b ? {
|
|
32
|
+
..._,
|
|
33
|
+
id: void 0
|
|
34
|
+
} : _);
|
|
35
|
+
t(v);
|
|
36
|
+
let S = r(() => [
|
|
37
|
+
"surface",
|
|
38
|
+
"outlined",
|
|
39
|
+
"elevated"
|
|
40
|
+
].includes(g.variant) ? g.variant : "surface");
|
|
41
|
+
function C(e) {
|
|
42
|
+
if (!g.clickable || g.disabled) return;
|
|
43
|
+
let t = e.composedPath(), n = t.indexOf(e.currentTarget);
|
|
44
|
+
t.slice(0, n).some((e) => e.matches?.("button, a, input, select, textarea, label, summary, [role='button'], [role='switch'], [role='checkbox'], [contenteditable], [tabindex]")) && e.stopPropagation();
|
|
45
|
+
}
|
|
46
|
+
function w(e) {
|
|
47
|
+
!g.clickable || g.disabled || e.target !== e.currentTarget || e.isComposing || e.repeat || (e.key === "Enter" ? (e.preventDefault(), e.currentTarget.click()) : e.key === " " && e.preventDefault());
|
|
48
|
+
}
|
|
49
|
+
function T(e) {
|
|
50
|
+
!g.clickable || g.disabled || e.target !== e.currentTarget || e.isComposing || e.key !== " " || (e.preventDefault(), e.currentTarget.click());
|
|
51
|
+
}
|
|
52
|
+
return (e, t) => (s(), a("article", o({
|
|
53
|
+
class: ["kima-card", [`kima-card--${S.value}`, {
|
|
54
|
+
"kima-card--clickable": n.clickable,
|
|
55
|
+
"kima-card--disabled": n.disabled
|
|
56
|
+
}]],
|
|
57
|
+
role: n.clickable ? "button" : void 0,
|
|
58
|
+
tabindex: n.clickable && !n.disabled ? 0 : void 0,
|
|
59
|
+
"aria-disabled": n.disabled ? "true" : void 0,
|
|
60
|
+
ref_key: "root",
|
|
61
|
+
ref: v
|
|
62
|
+
}, x.value, {
|
|
63
|
+
onClick: C,
|
|
64
|
+
onKeydown: w,
|
|
65
|
+
onKeyup: T
|
|
66
|
+
}), [
|
|
67
|
+
e.$slots.header || u(y)("header") ? (s(), a("header", p, [l(e.$slots, "header", {}, void 0, !0)])) : i("", !0),
|
|
68
|
+
e.$slots.default || u(y)("default") ? (s(), a("div", m, [l(e.$slots, "default", {}, void 0, !0)])) : i("", !0),
|
|
69
|
+
e.$slots.footer || u(y)("footer") ? (s(), a("footer", h, [l(e.$slots, "footer", {}, void 0, !0)])) : i("", !0)
|
|
70
|
+
], 16, f));
|
|
71
|
+
}
|
|
72
|
+
}), [["__scopeId", "data-v-6c915f03"]]);
|
|
73
|
+
export { g as default };
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { useRipple as e } from "../../utils/ripple.js";
|
|
2
|
+
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
3
|
+
import n from "./icon.ce.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { Fragment as r, Transition as i, TransitionGroup as ee, computed as a, createBlock as te, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createVNode as l, getCurrentInstance as ne, mergeProps as re, nextTick as u, normalizeClass as d, onBeforeUnmount as ie, onMounted as ae, openBlock as f, ref as p, renderList as m, shallowRef as oe, toDisplayString as h, unref as g, useAttrs as se, useHost as ce, useId as le, watch as _, withCtx as v, withModifiers as y } from "vue";
|
|
6
|
+
import { ArrowDown01Icon as ue, ArrowRight01Icon as de, Cancel01Icon as fe } from "@hugeicons/core-free-icons";
|
|
7
|
+
// src/components/core/cascader.ce.vue
|
|
8
|
+
var pe = ["aria-disabled"], me = [
|
|
9
|
+
"disabled",
|
|
10
|
+
"aria-expanded",
|
|
11
|
+
"aria-label",
|
|
12
|
+
"aria-required",
|
|
13
|
+
"aria-activedescendant"
|
|
14
|
+
], he = ["disabled"], ge = [
|
|
15
|
+
"name",
|
|
16
|
+
"value",
|
|
17
|
+
"required",
|
|
18
|
+
"disabled"
|
|
19
|
+
], _e = ["aria-label"], ve = [
|
|
20
|
+
"id",
|
|
21
|
+
"aria-selected",
|
|
22
|
+
"aria-disabled",
|
|
23
|
+
"onClick"
|
|
24
|
+
], ye = { class: "kima-cascader__option-label" }, be = {
|
|
25
|
+
key: 0,
|
|
26
|
+
class: "kima-cascader__empty",
|
|
27
|
+
role: "status"
|
|
28
|
+
}, b = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
29
|
+
__name: "cascader.ce",
|
|
30
|
+
props: {
|
|
31
|
+
modelValue: {
|
|
32
|
+
type: Array,
|
|
33
|
+
default: () => []
|
|
34
|
+
},
|
|
35
|
+
options: {
|
|
36
|
+
type: Array,
|
|
37
|
+
default: () => []
|
|
38
|
+
},
|
|
39
|
+
label: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: ""
|
|
42
|
+
},
|
|
43
|
+
placeholder: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: "请选择"
|
|
46
|
+
},
|
|
47
|
+
name: String,
|
|
48
|
+
required: Boolean,
|
|
49
|
+
disabled: Boolean,
|
|
50
|
+
clearable: Boolean,
|
|
51
|
+
open: Boolean
|
|
52
|
+
},
|
|
53
|
+
emits: [
|
|
54
|
+
"update:modelValue",
|
|
55
|
+
"change",
|
|
56
|
+
"update:open"
|
|
57
|
+
],
|
|
58
|
+
setup(t, { emit: b }) {
|
|
59
|
+
let x = t, S = b, C = se(), xe = ne()?.ce ? ce() : null, Se = a(() => xe ? {
|
|
60
|
+
...C,
|
|
61
|
+
id: void 0
|
|
62
|
+
} : C), w = p(null), T = p(null), E = p(null), D = p(null);
|
|
63
|
+
e(D);
|
|
64
|
+
let O = p([]), k = oe(Array.isArray(x.modelValue) ? [...x.modelValue] : []), A = p(x.open && !x.disabled), j = p(0), M = p([]), N = `kima-cascader-${le()}`, P = `${N}-trigger`, F = `${N}-listbox`, Ce = `${N}-native`, I, L, R = [], z, B = !0, V = a(() => {
|
|
65
|
+
let e = [], t = Array.isArray(x.options) ? x.options : [];
|
|
66
|
+
for (let n = 0;; n += 1) {
|
|
67
|
+
e.push(t);
|
|
68
|
+
let r = t.find((e) => Object.is(e?.value, k.value[n])), i = Array.isArray(r?.children) ? r.children : [];
|
|
69
|
+
if (!r || i.length === 0) break;
|
|
70
|
+
t = i;
|
|
71
|
+
}
|
|
72
|
+
return e;
|
|
73
|
+
}), we = a(() => {
|
|
74
|
+
let e = [], t = Array.isArray(x.options) ? x.options : [];
|
|
75
|
+
for (let n = 0; n < k.value.length; n += 1) {
|
|
76
|
+
let r = t.find((e) => Object.is(e?.value, k.value[n]));
|
|
77
|
+
if (!r) break;
|
|
78
|
+
e.push(r), t = Array.isArray(r.children) ? r.children : [];
|
|
79
|
+
}
|
|
80
|
+
return e;
|
|
81
|
+
}), H = a(() => we.value.map((e) => e.label).join(" / ")), Te = a(() => k.value.length ? String(k.value[k.value.length - 1]) : ""), Ee = a(() => {
|
|
82
|
+
let e = M.value[j.value];
|
|
83
|
+
return A.value && Number.isInteger(e) && e >= 0 ? `${F}-${j.value}-option-${e}` : void 0;
|
|
84
|
+
});
|
|
85
|
+
function U(e, t) {
|
|
86
|
+
return e.length === t.length && e.every((e, n) => Object.is(e, t[n]));
|
|
87
|
+
}
|
|
88
|
+
function W(e) {
|
|
89
|
+
return e.flatMap((e, t) => e?.disabled ? [] : [t]);
|
|
90
|
+
}
|
|
91
|
+
function G(e) {
|
|
92
|
+
return W(e)[0] ?? -1;
|
|
93
|
+
}
|
|
94
|
+
function K(e) {
|
|
95
|
+
let t = W(e);
|
|
96
|
+
return t[t.length - 1] ?? -1;
|
|
97
|
+
}
|
|
98
|
+
function De(e, t) {
|
|
99
|
+
let n = e.findIndex((e) => Object.is(e?.value, k.value[t]) && !e.disabled);
|
|
100
|
+
return n >= 0 ? n : G(e);
|
|
101
|
+
}
|
|
102
|
+
function Oe(e, t, n) {
|
|
103
|
+
O.value[t] || (O.value[t] = []), e ? O.value[t][n] = e : delete O.value[t][n];
|
|
104
|
+
}
|
|
105
|
+
function q(e, t) {
|
|
106
|
+
let n = V.value[e]?.[t];
|
|
107
|
+
n && !n.disabled && (j.value = e, M.value[e] = t, u(() => O.value[e]?.[t]?.scrollIntoView({
|
|
108
|
+
block: "nearest",
|
|
109
|
+
inline: "nearest"
|
|
110
|
+
})));
|
|
111
|
+
}
|
|
112
|
+
function J() {
|
|
113
|
+
M.value = V.value.map((e, t) => De(e, t)), j.value = Math.max(0, V.value.length - 1);
|
|
114
|
+
}
|
|
115
|
+
function Y(e) {
|
|
116
|
+
let t = W(V.value[j.value] || []);
|
|
117
|
+
if (!t.length) return;
|
|
118
|
+
let n = t.indexOf(M.value[j.value]), r = n < 0 ? e > 0 ? 0 : t.length - 1 : (n + e + t.length) % t.length;
|
|
119
|
+
q(j.value, t[r]);
|
|
120
|
+
}
|
|
121
|
+
function ke(e) {
|
|
122
|
+
return x.disabled || U(e, k.value) ? !1 : (k.value = [...e], S("update:modelValue", k.value), S("change", k.value), !0);
|
|
123
|
+
}
|
|
124
|
+
function X(e, t) {
|
|
125
|
+
if (x.disabled || e?.disabled) return;
|
|
126
|
+
let n = k.value.slice(0, t);
|
|
127
|
+
n.push(e.value), ke(n);
|
|
128
|
+
let r = Array.isArray(e.children) ? e.children : [];
|
|
129
|
+
r.length ? (j.value = Math.min(t + 1, V.value.length - 1), M.value[j.value] = G(r), u(() => q(j.value, M.value[j.value]))) : Z(!0);
|
|
130
|
+
}
|
|
131
|
+
function Ae() {
|
|
132
|
+
x.disabled || A.value || (A.value = !0, J(), S("update:open", !0), u(() => T.value?.focus()));
|
|
133
|
+
}
|
|
134
|
+
function Z(e = !0) {
|
|
135
|
+
A.value && (B = e, A.value = !1, S("update:open", !1));
|
|
136
|
+
}
|
|
137
|
+
function je() {
|
|
138
|
+
A.value ? Z(!0) : Ae();
|
|
139
|
+
}
|
|
140
|
+
function Me() {
|
|
141
|
+
ke([]), Z(!0), u(() => T.value?.focus());
|
|
142
|
+
}
|
|
143
|
+
function Ne(e) {
|
|
144
|
+
if (x.disabled || e.isComposing) return;
|
|
145
|
+
if (e.key === "Tab") {
|
|
146
|
+
Z(!1);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (![
|
|
150
|
+
"ArrowDown",
|
|
151
|
+
"ArrowUp",
|
|
152
|
+
"ArrowLeft",
|
|
153
|
+
"ArrowRight",
|
|
154
|
+
"Home",
|
|
155
|
+
"End",
|
|
156
|
+
"Enter",
|
|
157
|
+
" ",
|
|
158
|
+
"Escape"
|
|
159
|
+
].includes(e.key)) return;
|
|
160
|
+
if (e.preventDefault(), e.stopPropagation(), e.key === "Escape") {
|
|
161
|
+
Z(!0);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
if (!A.value) {
|
|
165
|
+
Ae(), e.key === "ArrowUp" || e.key === "ArrowLeft" || e.key === "End" ? u(() => q(j.value, K(V.value[j.value] || []))) : e.key === "Home" && u(() => q(j.value, G(V.value[j.value] || [])));
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
let t = V.value[j.value] || [];
|
|
169
|
+
if (e.key === "ArrowDown") Y(1);
|
|
170
|
+
else if (e.key === "ArrowUp") Y(-1);
|
|
171
|
+
else if (e.key === "Home") q(j.value, G(t));
|
|
172
|
+
else if (e.key === "End") q(j.value, K(t));
|
|
173
|
+
else if (e.key === "ArrowLeft") j.value > 0 && q(j.value - 1, M.value[j.value - 1]);
|
|
174
|
+
else if (e.key === "ArrowRight") {
|
|
175
|
+
let e = t[M.value[j.value]];
|
|
176
|
+
(Array.isArray(e?.children) ? e.children : []).length && X(e, j.value);
|
|
177
|
+
} else {
|
|
178
|
+
let e = t[M.value[j.value]];
|
|
179
|
+
e && X(e, j.value);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
function Q(e) {
|
|
183
|
+
A.value && !e.composedPath().includes(w.value) && Z(!1);
|
|
184
|
+
}
|
|
185
|
+
function Pe(e) {
|
|
186
|
+
e.preventDefault(), u(() => T.value?.focus());
|
|
187
|
+
}
|
|
188
|
+
function $(e) {
|
|
189
|
+
clearTimeout(z), z = setTimeout(() => {
|
|
190
|
+
if (e.defaultPrevented) return;
|
|
191
|
+
let t = [...R], n = !U(k.value, t);
|
|
192
|
+
k.value = t, Z(!1), E.value && (E.value.value = t.length ? String(t[t.length - 1]) : ""), n && S("update:modelValue", k.value);
|
|
193
|
+
}, 0);
|
|
194
|
+
}
|
|
195
|
+
return _(() => x.modelValue, (e) => {
|
|
196
|
+
k.value = Array.isArray(e) ? [...e] : [];
|
|
197
|
+
}), _(() => x.open, (e) => {
|
|
198
|
+
A.value = e && !x.disabled, A.value && J();
|
|
199
|
+
}), _(() => x.disabled, (e) => {
|
|
200
|
+
e && Z(!1);
|
|
201
|
+
}), _(V, J, { deep: !0 }), _(A, (e, t) => {
|
|
202
|
+
e ? J() : t && B && u(() => T.value?.focus()), B = !0;
|
|
203
|
+
}, { immediate: !0 }), ae(() => {
|
|
204
|
+
R = [...k.value], L = E.value?.form, L?.addEventListener("reset", $), I = w.value.ownerDocument, I.addEventListener("pointerdown", Q, !0), I.addEventListener("focusin", Q, !0);
|
|
205
|
+
}), ie(() => {
|
|
206
|
+
clearTimeout(z), L?.removeEventListener("reset", $), I?.removeEventListener("pointerdown", Q, !0), I?.removeEventListener("focusin", Q, !0);
|
|
207
|
+
}), (e, a) => (f(), s("div", re({
|
|
208
|
+
ref_key: "root",
|
|
209
|
+
ref: w
|
|
210
|
+
}, Se.value, { class: ["kima-cascader", {
|
|
211
|
+
"kima-cascader--open": A.value,
|
|
212
|
+
"kima-cascader--disabled": t.disabled
|
|
213
|
+
}] }), [
|
|
214
|
+
c("div", {
|
|
215
|
+
ref_key: "control",
|
|
216
|
+
ref: D,
|
|
217
|
+
class: "kima-cascader__control",
|
|
218
|
+
"aria-disabled": t.disabled || void 0
|
|
219
|
+
}, [c("button", {
|
|
220
|
+
id: P,
|
|
221
|
+
ref_key: "trigger",
|
|
222
|
+
ref: T,
|
|
223
|
+
class: "kima-cascader__trigger",
|
|
224
|
+
type: "button",
|
|
225
|
+
role: "combobox",
|
|
226
|
+
disabled: t.disabled,
|
|
227
|
+
"aria-expanded": A.value,
|
|
228
|
+
"aria-controls": F,
|
|
229
|
+
"aria-haspopup": "listbox",
|
|
230
|
+
"aria-label": g(C)["aria-label"] || g(C).ariaLabel || t.label || void 0,
|
|
231
|
+
"aria-required": t.required || void 0,
|
|
232
|
+
"aria-activedescendant": Ee.value,
|
|
233
|
+
onClick: je,
|
|
234
|
+
onKeydown: Ne
|
|
235
|
+
}, [c("span", { class: d(["kima-cascader__trigger-label", { "kima-cascader__trigger-label--placeholder": !H.value }]) }, h(H.value || t.placeholder), 3), l(n, {
|
|
236
|
+
class: "kima-cascader__arrow",
|
|
237
|
+
icon: g(ue),
|
|
238
|
+
size: 20,
|
|
239
|
+
"aria-hidden": "true"
|
|
240
|
+
}, null, 8, ["icon"])], 40, me), l(i, { name: "kima-fade" }, {
|
|
241
|
+
default: v(() => [t.clearable && k.value.length ? (f(), s("button", {
|
|
242
|
+
key: 0,
|
|
243
|
+
class: "kima-cascader__clear",
|
|
244
|
+
type: "button",
|
|
245
|
+
"aria-label": "清除选择",
|
|
246
|
+
title: "清除选择",
|
|
247
|
+
disabled: t.disabled,
|
|
248
|
+
onClick: y(Me, ["stop"])
|
|
249
|
+
}, [l(n, {
|
|
250
|
+
icon: g(fe),
|
|
251
|
+
size: 18,
|
|
252
|
+
"aria-hidden": "true"
|
|
253
|
+
}, null, 8, ["icon"])], 8, he)) : o("", !0)]),
|
|
254
|
+
_: 1
|
|
255
|
+
})], 8, pe),
|
|
256
|
+
c("input", {
|
|
257
|
+
ref_key: "nativeInput",
|
|
258
|
+
ref: E,
|
|
259
|
+
class: "kima-cascader__native",
|
|
260
|
+
type: "text",
|
|
261
|
+
id: Ce,
|
|
262
|
+
name: t.name,
|
|
263
|
+
value: Te.value,
|
|
264
|
+
required: t.required,
|
|
265
|
+
disabled: t.disabled,
|
|
266
|
+
tabindex: "-1",
|
|
267
|
+
"aria-hidden": "true",
|
|
268
|
+
onInput: a[0] ||= y(() => {}, ["stop"]),
|
|
269
|
+
onChange: a[1] ||= y(() => {}, ["stop"]),
|
|
270
|
+
onInvalid: Pe
|
|
271
|
+
}, null, 40, ge),
|
|
272
|
+
l(i, {
|
|
273
|
+
name: "kima-popup",
|
|
274
|
+
onBeforeEnter: a[4] ||= (e) => {
|
|
275
|
+
e.inert = !1, e.removeAttribute("aria-hidden");
|
|
276
|
+
},
|
|
277
|
+
onBeforeLeave: a[5] ||= (e) => {
|
|
278
|
+
e.inert = !0, e.setAttribute("aria-hidden", "true");
|
|
279
|
+
}
|
|
280
|
+
}, {
|
|
281
|
+
default: v(() => [A.value ? (f(), s("div", {
|
|
282
|
+
key: 0,
|
|
283
|
+
id: F,
|
|
284
|
+
class: "kima-cascader__popup",
|
|
285
|
+
role: "group",
|
|
286
|
+
"aria-labelledby": P,
|
|
287
|
+
onKeydown: Ne
|
|
288
|
+
}, [l(ee, {
|
|
289
|
+
name: "kima-list",
|
|
290
|
+
tag: "div",
|
|
291
|
+
class: "kima-cascader__columns",
|
|
292
|
+
onBeforeLeave: a[3] ||= (e) => {
|
|
293
|
+
e.inert = !0, e.setAttribute("aria-hidden", "true");
|
|
294
|
+
}
|
|
295
|
+
}, {
|
|
296
|
+
default: v(() => [(f(!0), s(r, null, m(V.value, (e, t) => (f(), s("div", {
|
|
297
|
+
key: t,
|
|
298
|
+
class: "kima-cascader__column",
|
|
299
|
+
role: "listbox",
|
|
300
|
+
"aria-label": `第 ${t + 1} 级`
|
|
301
|
+
}, [(f(!0), s(r, null, m(e, (e, r) => (f(), s("div", {
|
|
302
|
+
id: `${F}-${t}-option-${r}`,
|
|
303
|
+
key: r,
|
|
304
|
+
ref_for: !0,
|
|
305
|
+
ref: (e) => Oe(e, t, r),
|
|
306
|
+
class: d(["kima-cascader__option", {
|
|
307
|
+
"kima-cascader__option--active": t === j.value && r === M.value[t],
|
|
308
|
+
"kima-cascader__option--selected": Object.is(e.value, k.value[t])
|
|
309
|
+
}]),
|
|
310
|
+
role: "option",
|
|
311
|
+
"aria-selected": Object.is(e.value, k.value[t]),
|
|
312
|
+
"aria-disabled": e.disabled || void 0,
|
|
313
|
+
tabindex: "-1",
|
|
314
|
+
onPointerdown: a[2] ||= y(() => {}, ["prevent"]),
|
|
315
|
+
onClick: (n) => X(e, t)
|
|
316
|
+
}, [c("span", ye, h(e.label), 1), Array.isArray(e.children) && e.children.length ? (f(), te(n, {
|
|
317
|
+
key: 0,
|
|
318
|
+
icon: g(de),
|
|
319
|
+
size: 18,
|
|
320
|
+
"aria-hidden": "true"
|
|
321
|
+
}, null, 8, ["icon"])) : o("", !0)], 42, ve))), 128)), e.length === 0 ? (f(), s("div", be, "暂无选项")) : o("", !0)], 8, _e))), 128))]),
|
|
322
|
+
_: 1
|
|
323
|
+
})], 32)) : o("", !0)]),
|
|
324
|
+
_: 1
|
|
325
|
+
})
|
|
326
|
+
], 16));
|
|
327
|
+
}
|
|
328
|
+
}), [["__scopeId", "data-v-0ed26222"]]);
|
|
329
|
+
export { b as default };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { useNativeSlots as e } from "../../utils/native-slots.js";
|
|
2
|
+
import { useRipple as t } from "../../utils/ripple.js";
|
|
3
|
+
import n from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
import r from "./icon.ce.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import { computed as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, mergeProps as u, normalizeClass as d, onBeforeUnmount as f, onMounted as p, openBlock as m, ref as h, renderSlot as g, toDisplayString as _, unref as v, useAttrs as y, watch as b, withModifiers as x } from "vue";
|
|
7
|
+
import { MinusSignIcon as S, Tick02Icon as C } from "@hugeicons/core-free-icons";
|
|
8
|
+
// src/components/core/checkbox.ce.vue
|
|
9
|
+
var w = [
|
|
10
|
+
"checked",
|
|
11
|
+
".indeterminate",
|
|
12
|
+
"disabled",
|
|
13
|
+
"required",
|
|
14
|
+
"name",
|
|
15
|
+
"value"
|
|
16
|
+
], T = { class: "kima-checkbox__box" }, E = {
|
|
17
|
+
key: 0,
|
|
18
|
+
class: "kima-checkbox__label"
|
|
19
|
+
}, D = /*#__PURE__*/ n(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
20
|
+
__name: "checkbox.ce",
|
|
21
|
+
props: {
|
|
22
|
+
modelValue: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: !1
|
|
25
|
+
},
|
|
26
|
+
indeterminate: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: !1
|
|
29
|
+
},
|
|
30
|
+
disabled: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: !1
|
|
33
|
+
},
|
|
34
|
+
required: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: !1
|
|
37
|
+
},
|
|
38
|
+
name: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: void 0
|
|
41
|
+
},
|
|
42
|
+
value: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: "on"
|
|
45
|
+
},
|
|
46
|
+
label: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: ""
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
emits: ["update:modelValue", "change"],
|
|
52
|
+
setup(n, { emit: D }) {
|
|
53
|
+
let O = n, k = D, A = y(), j = h(null), M = h(null), N = h(null), { hasNativeSlot: P, isCustomElement: F } = e(j), I = i(() => F ? {
|
|
54
|
+
...A,
|
|
55
|
+
id: void 0
|
|
56
|
+
} : A), L = h(O.modelValue || A.checked === "" || A.checked === !0), R = h(O.indeterminate), z, B, V;
|
|
57
|
+
t(M), b(() => O.modelValue, (e) => {
|
|
58
|
+
L.value = e;
|
|
59
|
+
}), b(() => O.indeterminate, (e) => {
|
|
60
|
+
R.value = e;
|
|
61
|
+
});
|
|
62
|
+
function H(e) {
|
|
63
|
+
L.value = e.target.checked, R.value = e.target.indeterminate, k("update:modelValue", L.value), k("change", L.value);
|
|
64
|
+
}
|
|
65
|
+
function U(e) {
|
|
66
|
+
e.target === N.value.form && queueMicrotask(() => {
|
|
67
|
+
if (e.defaultPrevented || !N.value) return;
|
|
68
|
+
let t = L.value !== z;
|
|
69
|
+
L.value = z, R.value = B, N.value.checked = z, N.value.indeterminate = B, t && k("update:modelValue", z);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return p(() => {
|
|
73
|
+
z = L.value, B = R.value, N.value.defaultChecked = z, V = N.value.ownerDocument, V.addEventListener("reset", U, !0);
|
|
74
|
+
}), f(() => V.removeEventListener("reset", U, !0)), (e, t) => (m(), o("label", {
|
|
75
|
+
ref_key: "root",
|
|
76
|
+
ref: j,
|
|
77
|
+
class: d(["kima-checkbox", {
|
|
78
|
+
"kima-checkbox--checked": L.value,
|
|
79
|
+
"kima-checkbox--indeterminate": R.value,
|
|
80
|
+
"kima-checkbox--disabled": n.disabled
|
|
81
|
+
}])
|
|
82
|
+
}, [
|
|
83
|
+
s("input", u({
|
|
84
|
+
ref_key: "input",
|
|
85
|
+
ref: N
|
|
86
|
+
}, I.value, {
|
|
87
|
+
class: "kima-checkbox__input",
|
|
88
|
+
type: "checkbox",
|
|
89
|
+
checked: L.value,
|
|
90
|
+
".indeterminate": R.value,
|
|
91
|
+
disabled: n.disabled,
|
|
92
|
+
required: n.required,
|
|
93
|
+
name: n.name,
|
|
94
|
+
value: n.value,
|
|
95
|
+
onInput: t[0] ||= x(() => {}, ["stop"]),
|
|
96
|
+
onChange: x(H, ["stop"])
|
|
97
|
+
}), null, 48, w),
|
|
98
|
+
s("span", {
|
|
99
|
+
ref_key: "control",
|
|
100
|
+
ref: M,
|
|
101
|
+
class: "kima-checkbox__control",
|
|
102
|
+
"aria-hidden": "true"
|
|
103
|
+
}, [s("span", T, [l(r, {
|
|
104
|
+
class: "kima-checkbox__mark kima-checkbox__mark--tick",
|
|
105
|
+
icon: v(C),
|
|
106
|
+
size: 20
|
|
107
|
+
}, null, 8, ["icon"]), l(r, {
|
|
108
|
+
class: "kima-checkbox__mark kima-checkbox__mark--dash",
|
|
109
|
+
icon: v(S),
|
|
110
|
+
size: 20
|
|
111
|
+
}, null, 8, ["icon"])])], 512),
|
|
112
|
+
n.label || e.$slots.default || v(P)("default") ? (m(), o("span", E, [g(e.$slots, "default", {}, () => [c(_(n.label), 1)], !0)])) : a("", !0)
|
|
113
|
+
], 2));
|
|
114
|
+
}
|
|
115
|
+
}), [["__scopeId", "data-v-7c9707de"]]);
|
|
116
|
+
export { D as default };
|