@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,286 @@
|
|
|
1
|
+
import { useRipple as e } from "../../utils/ripple.js";
|
|
2
|
+
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
3
|
+
import { useInputAttrs as n, useInputState as r } from "../../utils/input-state.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { computed as i, createElementBlock as a, createElementVNode as o, mergeProps as s, normalizeClass as c, normalizeStyle as l, openBlock as u, ref as d, toDisplayString as f, unref as p, watch as m, withModifiers as h } from "vue";
|
|
6
|
+
// src/components/form-completion/color-picker.ce.vue
|
|
7
|
+
var g = { class: "kima-color-picker__editor" }, _ = [
|
|
8
|
+
"tabindex",
|
|
9
|
+
"aria-disabled",
|
|
10
|
+
"aria-readonly",
|
|
11
|
+
"aria-label",
|
|
12
|
+
"aria-valuetext"
|
|
13
|
+
], v = [
|
|
14
|
+
"tabindex",
|
|
15
|
+
"aria-disabled",
|
|
16
|
+
"aria-readonly",
|
|
17
|
+
"aria-valuenow"
|
|
18
|
+
], y = [
|
|
19
|
+
"tabindex",
|
|
20
|
+
"aria-disabled",
|
|
21
|
+
"aria-readonly",
|
|
22
|
+
"aria-valuenow"
|
|
23
|
+
], b = { class: "kima-color-picker__inputs" }, x = [
|
|
24
|
+
"value",
|
|
25
|
+
"aria-label",
|
|
26
|
+
"disabled"
|
|
27
|
+
], S = [
|
|
28
|
+
"value",
|
|
29
|
+
"name",
|
|
30
|
+
"aria-label",
|
|
31
|
+
"disabled",
|
|
32
|
+
"readonly",
|
|
33
|
+
"required"
|
|
34
|
+
], C = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
35
|
+
__name: "color-picker.ce",
|
|
36
|
+
props: {
|
|
37
|
+
modelValue: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: "#61afef"
|
|
40
|
+
},
|
|
41
|
+
label: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: "颜色"
|
|
44
|
+
},
|
|
45
|
+
name: String,
|
|
46
|
+
disabled: Boolean,
|
|
47
|
+
readonly: Boolean,
|
|
48
|
+
required: Boolean
|
|
49
|
+
},
|
|
50
|
+
emits: ["update:modelValue", "change"],
|
|
51
|
+
setup(t, { emit: C }) {
|
|
52
|
+
let w = t, T = C, E = d(null), D = d(null), O = d(null), { attrs: k, controlAttrs: A } = n();
|
|
53
|
+
function j(e, t = 0, n = 1) {
|
|
54
|
+
return Math.max(t, Math.min(n, e));
|
|
55
|
+
}
|
|
56
|
+
function M(e) {
|
|
57
|
+
let t = String(e || "").replace("#", "");
|
|
58
|
+
return t.length === 3 && (t = [...t].map((e) => e + e).join("")), /^(?:[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t) ? {
|
|
59
|
+
r: parseInt(t.slice(0, 2), 16),
|
|
60
|
+
g: parseInt(t.slice(2, 4), 16),
|
|
61
|
+
b: parseInt(t.slice(4, 6), 16),
|
|
62
|
+
a: t.length === 8 ? parseInt(t.slice(6, 8), 16) / 255 : 1
|
|
63
|
+
} : null;
|
|
64
|
+
}
|
|
65
|
+
function N({ r: e, g: t, b: n, a: r = 1 }) {
|
|
66
|
+
e /= 255, t /= 255, n /= 255;
|
|
67
|
+
let i = Math.max(e, t, n), a = i - Math.min(e, t, n), o = 0;
|
|
68
|
+
return a && (o = i === e ? (t - n) / a % 6 : i === t ? (n - e) / a + 2 : (e - t) / a + 4, o *= 60, o < 0 && (o += 360)), {
|
|
69
|
+
h: o,
|
|
70
|
+
s: i ? a / i : 0,
|
|
71
|
+
v: i,
|
|
72
|
+
a: r
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function P({ h: e, s: t, v: n, a: r = 1 }) {
|
|
76
|
+
let i = n * t, a = i * (1 - Math.abs(e / 60 % 2 - 1)), o = n - i, s = 0, c = 0, l = 0;
|
|
77
|
+
return e < 60 ? [s, c, l] = [
|
|
78
|
+
i,
|
|
79
|
+
a,
|
|
80
|
+
0
|
|
81
|
+
] : e < 120 ? [s, c, l] = [
|
|
82
|
+
a,
|
|
83
|
+
i,
|
|
84
|
+
0
|
|
85
|
+
] : e < 180 ? [s, c, l] = [
|
|
86
|
+
0,
|
|
87
|
+
i,
|
|
88
|
+
a
|
|
89
|
+
] : e < 240 ? [s, c, l] = [
|
|
90
|
+
0,
|
|
91
|
+
a,
|
|
92
|
+
i
|
|
93
|
+
] : e < 300 ? [s, c, l] = [
|
|
94
|
+
a,
|
|
95
|
+
0,
|
|
96
|
+
i
|
|
97
|
+
] : [s, c, l] = [
|
|
98
|
+
i,
|
|
99
|
+
0,
|
|
100
|
+
a
|
|
101
|
+
], {
|
|
102
|
+
r: Math.round((s + o) * 255),
|
|
103
|
+
g: Math.round((c + o) * 255),
|
|
104
|
+
b: Math.round((l + o) * 255),
|
|
105
|
+
a: r
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function F(e, t = !1) {
|
|
109
|
+
return `#${[
|
|
110
|
+
e.r,
|
|
111
|
+
e.g,
|
|
112
|
+
e.b
|
|
113
|
+
].map((e) => Math.round(e).toString(16).padStart(2, "0")).join("")}${t ? Math.round(j(e.a) * 255).toString(16).padStart(2, "0") : ""}`;
|
|
114
|
+
}
|
|
115
|
+
let I = d(N(M(w.modelValue) || {
|
|
116
|
+
r: 97,
|
|
117
|
+
g: 175,
|
|
118
|
+
b: 239,
|
|
119
|
+
a: 1
|
|
120
|
+
})), L = d(F(P(I.value), I.value.a < 1)), { local: R, update: z } = r(w, T, E, (e) => M(e) ? F(M(e), M(e).a < 1) : "#61afef", B);
|
|
121
|
+
e(E);
|
|
122
|
+
function B(e) {
|
|
123
|
+
let t = M(e);
|
|
124
|
+
t && (I.value = N(t), L.value = F(t, t.a < 1), D.value?.setCustomValidity(""), O.value && (O.value.value = F(t).slice(0, 7)));
|
|
125
|
+
}
|
|
126
|
+
m(R, B);
|
|
127
|
+
function V(e, t = !0) {
|
|
128
|
+
if (w.disabled || w.readonly) return;
|
|
129
|
+
let n = M(e);
|
|
130
|
+
if (!n) {
|
|
131
|
+
D.value?.setCustomValidity("请输入六位 HEX 颜色");
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
D.value?.setCustomValidity("");
|
|
135
|
+
let r = F(n, n.a < 1);
|
|
136
|
+
L.value = r, z(r, t);
|
|
137
|
+
}
|
|
138
|
+
function H(e, t = !0) {
|
|
139
|
+
if (w.disabled || w.readonly) return;
|
|
140
|
+
I.value = {
|
|
141
|
+
...I.value,
|
|
142
|
+
...e
|
|
143
|
+
};
|
|
144
|
+
let n = F(P(I.value), I.value.a < 1);
|
|
145
|
+
L.value = n, z(n, t);
|
|
146
|
+
}
|
|
147
|
+
function U(e) {
|
|
148
|
+
let t = e.currentTarget.getBoundingClientRect();
|
|
149
|
+
H({
|
|
150
|
+
s: j((e.clientX - t.left) / t.width),
|
|
151
|
+
v: j(1 - (e.clientY - t.top) / t.height)
|
|
152
|
+
}, !1);
|
|
153
|
+
}
|
|
154
|
+
function W(e) {
|
|
155
|
+
let t = e.currentTarget.getBoundingClientRect();
|
|
156
|
+
H({ h: j((e.clientY - t.top) / t.height, 0, 1) * 360 }, !1);
|
|
157
|
+
}
|
|
158
|
+
function G(e) {
|
|
159
|
+
let t = e.currentTarget.getBoundingClientRect();
|
|
160
|
+
H({ a: j((e.clientX - t.left) / t.width) }, !1);
|
|
161
|
+
}
|
|
162
|
+
function K(e, t, n) {
|
|
163
|
+
let r = e.key;
|
|
164
|
+
if (w.disabled || w.readonly || ![
|
|
165
|
+
"ArrowLeft",
|
|
166
|
+
"ArrowRight",
|
|
167
|
+
"ArrowUp",
|
|
168
|
+
"ArrowDown",
|
|
169
|
+
"Home",
|
|
170
|
+
"End"
|
|
171
|
+
].includes(r)) return;
|
|
172
|
+
e.preventDefault();
|
|
173
|
+
let i = r === "ArrowRight" || r === "ArrowUp" ? 1 : -1;
|
|
174
|
+
H({ [t]: r === "Home" ? 0 : r === "End" ? t === "h" ? 359 : 1 : j(I.value[t] + i * n, 0, t === "h" ? 359 : 1) });
|
|
175
|
+
}
|
|
176
|
+
function q(e) {
|
|
177
|
+
if (w.disabled || w.readonly || ![
|
|
178
|
+
"ArrowLeft",
|
|
179
|
+
"ArrowRight",
|
|
180
|
+
"ArrowUp",
|
|
181
|
+
"ArrowDown"
|
|
182
|
+
].includes(e.key)) return;
|
|
183
|
+
e.preventDefault();
|
|
184
|
+
let t = ["ArrowLeft", "ArrowRight"].includes(e.key) ? "s" : "v", n = ["ArrowRight", "ArrowUp"].includes(e.key) ? 1 : -1;
|
|
185
|
+
H({ [t]: j(I.value[t] + n * .01) });
|
|
186
|
+
}
|
|
187
|
+
function J(e, t) {
|
|
188
|
+
w.disabled || w.readonly || (e.currentTarget.setPointerCapture(e.pointerId), t(e));
|
|
189
|
+
}
|
|
190
|
+
function Y(e) {
|
|
191
|
+
let t = M(e.target.value);
|
|
192
|
+
t && V(F(t), !0);
|
|
193
|
+
}
|
|
194
|
+
let X = i(() => P(I.value)), Z = i(() => {
|
|
195
|
+
let { r: e, g: t, b: n } = X.value;
|
|
196
|
+
e /= 255, t /= 255, n /= 255;
|
|
197
|
+
let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2, o = r - i, s = o ? o / (1 - Math.abs(2 * a - 1)) : 0, c = 0;
|
|
198
|
+
return o && (c = r === e ? 60 * ((t - n) / o % 6) : r === t ? 60 * ((n - e) / o + 2) : 60 * ((e - t) / o + 4), c < 0 && (c += 360)), {
|
|
199
|
+
h: Math.round(c),
|
|
200
|
+
s: Math.round(s * 100),
|
|
201
|
+
l: Math.round(a * 100)
|
|
202
|
+
};
|
|
203
|
+
});
|
|
204
|
+
return (e, n) => (u(), a("div", {
|
|
205
|
+
ref_key: "root",
|
|
206
|
+
ref: E,
|
|
207
|
+
class: c(["kima-color-picker", p(k).class]),
|
|
208
|
+
style: l(p(k).style)
|
|
209
|
+
}, [
|
|
210
|
+
o("div", g, [o("div", {
|
|
211
|
+
class: "kima-color-picker__area",
|
|
212
|
+
role: "slider",
|
|
213
|
+
tabindex: t.disabled ? -1 : 0,
|
|
214
|
+
"aria-disabled": t.disabled,
|
|
215
|
+
"aria-readonly": t.readonly,
|
|
216
|
+
"aria-label": `${t.label}饱和度和明度`,
|
|
217
|
+
"aria-valuetext": `S ${Math.round(I.value.s * 100)}%, V ${Math.round(I.value.v * 100)}%`,
|
|
218
|
+
style: l({ background: `linear-gradient(to top,var(--kima-color-picker-black),var(--kima-color-transparent)),linear-gradient(to right,var(--kima-color-picker-white),hsl(${I.value.h} 100% 50%))` }),
|
|
219
|
+
onPointerdown: n[0] ||= (e) => J(e, U),
|
|
220
|
+
onPointermove: n[1] ||= (e) => e.buttons && U(e),
|
|
221
|
+
onKeydown: q
|
|
222
|
+
}, [o("span", { style: l({
|
|
223
|
+
left: `${I.value.s * 100}%`,
|
|
224
|
+
top: `${(1 - I.value.v) * 100}%`
|
|
225
|
+
}) }, null, 4)], 44, _), o("div", {
|
|
226
|
+
class: "kima-color-picker__hue",
|
|
227
|
+
role: "slider",
|
|
228
|
+
tabindex: t.disabled ? -1 : 0,
|
|
229
|
+
"aria-disabled": t.disabled,
|
|
230
|
+
"aria-readonly": t.readonly,
|
|
231
|
+
"aria-label": "色相",
|
|
232
|
+
"aria-valuemin": 0,
|
|
233
|
+
"aria-valuemax": 359,
|
|
234
|
+
"aria-valuenow": I.value.h,
|
|
235
|
+
onPointerdown: n[2] ||= (e) => J(e, W),
|
|
236
|
+
onPointermove: n[3] ||= (e) => e.buttons && W(e),
|
|
237
|
+
onKeydown: n[4] ||= (e) => K(e, "h", 1)
|
|
238
|
+
}, [o("span", { style: l({ top: `${I.value.h / 360 * 100}%` }) }, null, 4)], 40, v)]),
|
|
239
|
+
o("div", {
|
|
240
|
+
class: "kima-color-picker__alpha",
|
|
241
|
+
role: "slider",
|
|
242
|
+
tabindex: t.disabled ? -1 : 0,
|
|
243
|
+
"aria-disabled": t.disabled,
|
|
244
|
+
"aria-readonly": t.readonly,
|
|
245
|
+
"aria-label": "透明度",
|
|
246
|
+
"aria-valuemin": "0",
|
|
247
|
+
"aria-valuemax": "1",
|
|
248
|
+
"aria-valuenow": I.value.a,
|
|
249
|
+
style: l({ "--kima-alpha-color": `rgb(${X.value.r} ${X.value.g} ${X.value.b})` }),
|
|
250
|
+
onPointerdown: n[5] ||= (e) => J(e, G),
|
|
251
|
+
onPointermove: n[6] ||= (e) => e.buttons && G(e),
|
|
252
|
+
onKeydown: n[7] ||= (e) => K(e, "a", .01)
|
|
253
|
+
}, [o("span", { style: l({ left: `clamp(10px, ${I.value.a * 100}%, calc(100% - 10px))` }) }, null, 4)], 44, y),
|
|
254
|
+
o("div", b, [o("input", {
|
|
255
|
+
ref_key: "nativeColor",
|
|
256
|
+
ref: O,
|
|
257
|
+
class: "kima-color-picker__native",
|
|
258
|
+
type: "color",
|
|
259
|
+
value: F(X.value).slice(0, 7),
|
|
260
|
+
"aria-label": `${t.label}颜色选择器`,
|
|
261
|
+
disabled: t.disabled || t.readonly,
|
|
262
|
+
onInput: Y
|
|
263
|
+
}, null, 40, x), o("input", s({
|
|
264
|
+
ref_key: "hex",
|
|
265
|
+
ref: D
|
|
266
|
+
}, p(A), {
|
|
267
|
+
class: "kima-color-picker__hex",
|
|
268
|
+
type: "text",
|
|
269
|
+
value: L.value,
|
|
270
|
+
name: t.name,
|
|
271
|
+
"aria-label": p(A)["aria-label"] || t.label,
|
|
272
|
+
disabled: t.disabled,
|
|
273
|
+
readonly: t.readonly,
|
|
274
|
+
required: t.required,
|
|
275
|
+
pattern: "#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?",
|
|
276
|
+
maxlength: "9",
|
|
277
|
+
onInput: n[8] ||= h((e) => {
|
|
278
|
+
L.value = e.target.value, V(L.value, !1);
|
|
279
|
+
}, ["stop"]),
|
|
280
|
+
onChange: n[9] ||= h((e) => V(L.value, !0), ["stop"])
|
|
281
|
+
}), null, 16, S)]),
|
|
282
|
+
o("output", null, "RGB " + f(X.value.r) + ", " + f(X.value.g) + ", " + f(X.value.b) + " · HSL " + f(Z.value.h) + "°, " + f(Z.value.s) + "%, " + f(Z.value.l) + "%", 1)
|
|
283
|
+
], 6));
|
|
284
|
+
}
|
|
285
|
+
}), [["__scopeId", "data-v-04812c30"]]);
|
|
286
|
+
export { C as default };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import e from "../../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import { normalizeDate as t } from "../../utils/local-date.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import { Fragment as n, computed as r, createElementBlock as i, createElementVNode as a, nextTick as o, onBeforeUnmount as s, onMounted as c, openBlock as l, ref as u, renderList as d, watch as f } from "vue";
|
|
5
|
+
// src/components/form-completion/date-field.ce.vue
|
|
6
|
+
var p = ["aria-label", "aria-disabled"], m = [
|
|
7
|
+
"value",
|
|
8
|
+
"placeholder",
|
|
9
|
+
"aria-label",
|
|
10
|
+
"maxlength",
|
|
11
|
+
"disabled",
|
|
12
|
+
"readonly",
|
|
13
|
+
"onInput",
|
|
14
|
+
"onKeydown",
|
|
15
|
+
"onCompositionend"
|
|
16
|
+
], h = [
|
|
17
|
+
"name",
|
|
18
|
+
"required",
|
|
19
|
+
"disabled",
|
|
20
|
+
"value",
|
|
21
|
+
"aria-label"
|
|
22
|
+
], g = /*#__PURE__*/ e({
|
|
23
|
+
__name: "date-field.ce",
|
|
24
|
+
props: {
|
|
25
|
+
modelValue: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: ""
|
|
28
|
+
},
|
|
29
|
+
name: String,
|
|
30
|
+
label: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: "日期"
|
|
33
|
+
},
|
|
34
|
+
required: Boolean,
|
|
35
|
+
disabled: Boolean,
|
|
36
|
+
readonly: Boolean,
|
|
37
|
+
min: String,
|
|
38
|
+
max: String
|
|
39
|
+
},
|
|
40
|
+
emits: ["update:modelValue", "change"],
|
|
41
|
+
setup(e, { emit: g }) {
|
|
42
|
+
let _ = e, v = g, y = u([
|
|
43
|
+
"",
|
|
44
|
+
"",
|
|
45
|
+
""
|
|
46
|
+
]), b = u([]), x = u(null), S = u(!1);
|
|
47
|
+
function C(e) {
|
|
48
|
+
let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e || "");
|
|
49
|
+
return t ? t.slice(1) : [
|
|
50
|
+
"",
|
|
51
|
+
"",
|
|
52
|
+
""
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
function w() {
|
|
56
|
+
return y.value.every(Boolean);
|
|
57
|
+
}
|
|
58
|
+
function T(e) {
|
|
59
|
+
return !!(t(e) && (!_.min || e >= _.min) && (!_.max || e <= _.max));
|
|
60
|
+
}
|
|
61
|
+
function E() {
|
|
62
|
+
let e = y.value.some(Boolean);
|
|
63
|
+
x.value?.setCustomValidity(!e && !_.required || S.value ? "" : "请输入完整且在范围内的日期");
|
|
64
|
+
}
|
|
65
|
+
function D(e, n = !1) {
|
|
66
|
+
let r = t(e);
|
|
67
|
+
S.value = !!(r && (!_.min || r >= _.min) && (!_.max || r <= _.max)), S.value ? (y.value = C(r), v("update:modelValue", r), n && v("change", r)) : (v("update:modelValue", ""), n && v("change", "")), E();
|
|
68
|
+
}
|
|
69
|
+
f(() => _.modelValue, (e) => {
|
|
70
|
+
y.value = C(e), S.value = T(e), E();
|
|
71
|
+
}, { immediate: !0 });
|
|
72
|
+
function O(e, t) {
|
|
73
|
+
let n = e === 0 ? 4 : 2, r = e === 0 ? 9999 : e === 1 ? 12 : 31, i = t.target.value.replace(/\D/g, "").slice(0, n);
|
|
74
|
+
y.value[e] = i, t.target.value = i, i.length === n && Number(i) >= 1 && Number(i) <= r ? (e < 2 && o(() => b.value[e + 1]?.focus()), w() ? D(y.value.join("-"), !0) : (S.value = !1, E())) : (S.value = !1, E(), v("update:modelValue", ""));
|
|
75
|
+
}
|
|
76
|
+
function k(e, t) {
|
|
77
|
+
if (!(_.disabled || _.readonly || t.isComposing)) {
|
|
78
|
+
if (t.key === "ArrowUp" || t.key === "ArrowDown") {
|
|
79
|
+
t.preventDefault();
|
|
80
|
+
let n = b.value[e];
|
|
81
|
+
n.value = String(Math.max(1, Math.min(e === 0 ? 9999 : e === 1 ? 12 : 31, Number(n.value || 0) + (t.key === "ArrowUp" ? 1 : -1)))).padStart(e ? 2 : 4, "0"), O(e, { target: n });
|
|
82
|
+
} else t.key === "ArrowLeft" && t.target.selectionStart === 0 ? b.value[e - 1]?.focus() : t.key === "ArrowRight" && t.target.selectionStart === t.target.value.length && b.value[e + 1]?.focus();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
let A, j, M;
|
|
86
|
+
function N(e) {
|
|
87
|
+
e.target === A && queueMicrotask(() => {
|
|
88
|
+
e.defaultPrevented || (y.value = C(M), S.value = T(M), E(), v("update:modelValue", M));
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
c(() => {
|
|
92
|
+
M = _.modelValue, A = x.value?.form, j = x.value?.ownerDocument, E(), j?.addEventListener("reset", N, !0);
|
|
93
|
+
}), s(() => j?.removeEventListener("reset", N, !0));
|
|
94
|
+
let P = r(() => y.value);
|
|
95
|
+
return (t, r) => (l(), i("div", {
|
|
96
|
+
class: "kima-date-field",
|
|
97
|
+
role: "group",
|
|
98
|
+
"aria-label": e.label,
|
|
99
|
+
"aria-disabled": e.disabled || void 0
|
|
100
|
+
}, [(l(!0), i(n, null, d(P.value, (t, n) => (l(), i("input", {
|
|
101
|
+
key: n,
|
|
102
|
+
ref_for: !0,
|
|
103
|
+
ref: (e) => b.value[n] = e,
|
|
104
|
+
class: "kima-date-field__segment",
|
|
105
|
+
type: "text",
|
|
106
|
+
value: t,
|
|
107
|
+
placeholder: n === 0 ? "YYYY" : n === 1 ? "MM" : "DD",
|
|
108
|
+
"aria-label": `${e.label} ${n === 0 ? "年" : n === 1 ? "月" : "日"}`,
|
|
109
|
+
inputmode: "numeric",
|
|
110
|
+
maxlength: n === 0 ? 4 : 2,
|
|
111
|
+
disabled: e.disabled,
|
|
112
|
+
readonly: e.readonly,
|
|
113
|
+
onInput: (e) => O(n, e),
|
|
114
|
+
onKeydown: (e) => k(n, e),
|
|
115
|
+
onCompositionend: (e) => O(n, e)
|
|
116
|
+
}, null, 40, m))), 128)), a("input", {
|
|
117
|
+
ref_key: "hidden",
|
|
118
|
+
ref: x,
|
|
119
|
+
class: "kima-date-field__native",
|
|
120
|
+
type: "text",
|
|
121
|
+
name: e.name,
|
|
122
|
+
required: e.required,
|
|
123
|
+
disabled: e.disabled,
|
|
124
|
+
value: S.value ? y.value.join("-") : "",
|
|
125
|
+
"aria-label": e.label,
|
|
126
|
+
tabindex: "-1",
|
|
127
|
+
"aria-hidden": "true"
|
|
128
|
+
}, null, 8, h)], 8, p));
|
|
129
|
+
}
|
|
130
|
+
}, [["__scopeId", "data-v-7c8a7c79"]]);
|
|
131
|
+
export { g as default };
|
|
@@ -0,0 +1,158 @@
|
|
|
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
|
+
/* empty css */
|
|
5
|
+
import { Fragment as r, TransitionGroup as i, computed as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, mergeProps as u, openBlock as d, ref as f, renderList as p, renderSlot as m, toDisplayString as h, unref as g, withCtx as _ } from "vue";
|
|
6
|
+
// src/components/form-completion/dynamic-input.ce.vue
|
|
7
|
+
var v = ["aria-label"], y = { class: "kima-dynamic-input__actions" }, b = /*#__PURE__*/ e({
|
|
8
|
+
__name: "dynamic-input.ce",
|
|
9
|
+
props: {
|
|
10
|
+
modelValue: {
|
|
11
|
+
type: Array,
|
|
12
|
+
default: () => []
|
|
13
|
+
},
|
|
14
|
+
create: {
|
|
15
|
+
type: Function,
|
|
16
|
+
default: () => ({})
|
|
17
|
+
},
|
|
18
|
+
disabled: Boolean,
|
|
19
|
+
min: {
|
|
20
|
+
type: Number,
|
|
21
|
+
default: 0
|
|
22
|
+
},
|
|
23
|
+
max: {
|
|
24
|
+
type: Number,
|
|
25
|
+
default: Infinity
|
|
26
|
+
},
|
|
27
|
+
label: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: "字段列表"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
emits: [
|
|
33
|
+
"update:modelValue",
|
|
34
|
+
"change",
|
|
35
|
+
"add",
|
|
36
|
+
"remove",
|
|
37
|
+
"move"
|
|
38
|
+
],
|
|
39
|
+
setup(e, { expose: b, emit: x }) {
|
|
40
|
+
let S = e, C = x, w = 0, T = /* @__PURE__ */ new WeakMap();
|
|
41
|
+
function E(e) {
|
|
42
|
+
return !e || typeof e != "object" ? `row-${++w}` : (T.has(e) || T.set(e, e.id || `row-${++w}`), T.get(e));
|
|
43
|
+
}
|
|
44
|
+
let D = f(S.modelValue.map((e) => ({ ...e }))), O = a(() => S.disabled || D.value.length >= S.max);
|
|
45
|
+
function k(e, t, n) {
|
|
46
|
+
D.value = e, C("update:modelValue", e.map((e) => ({ ...e }))), C("change", e.map((e) => ({ ...e }))), t && C(t, n);
|
|
47
|
+
}
|
|
48
|
+
function A() {
|
|
49
|
+
if (O.value) return;
|
|
50
|
+
let e = {
|
|
51
|
+
...S.create(),
|
|
52
|
+
id: `row-${++w}`
|
|
53
|
+
};
|
|
54
|
+
k([...D.value, e], "add", {
|
|
55
|
+
row: e,
|
|
56
|
+
index: D.value.length
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function j(e) {
|
|
60
|
+
if (S.disabled || D.value.length <= S.min) return;
|
|
61
|
+
let t = D.value[e];
|
|
62
|
+
k(D.value.filter((t, n) => n !== e), "remove", {
|
|
63
|
+
row: t,
|
|
64
|
+
index: e
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function M(e, t) {
|
|
68
|
+
let n = e + t;
|
|
69
|
+
if (S.disabled || n < 0 || n >= D.value.length) return;
|
|
70
|
+
let r = [...D.value];
|
|
71
|
+
[r[e], r[n]] = [r[n], r[e]], k(r, "move", {
|
|
72
|
+
row: r[n],
|
|
73
|
+
from: e,
|
|
74
|
+
to: n
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function N(e, t) {
|
|
78
|
+
let n = [...D.value];
|
|
79
|
+
n[e] = t, k(n);
|
|
80
|
+
}
|
|
81
|
+
function P() {
|
|
82
|
+
return D.value.every((e) => e && e.valid !== !1);
|
|
83
|
+
}
|
|
84
|
+
return b({
|
|
85
|
+
add: A,
|
|
86
|
+
remove: j,
|
|
87
|
+
move: M,
|
|
88
|
+
validate: P,
|
|
89
|
+
rows: D
|
|
90
|
+
}), (a, f) => (d(), o("div", {
|
|
91
|
+
class: "kima-dynamic-input",
|
|
92
|
+
role: "group",
|
|
93
|
+
"aria-label": e.label
|
|
94
|
+
}, [l(i, u({
|
|
95
|
+
tag: "div",
|
|
96
|
+
name: "kima-list"
|
|
97
|
+
}, g(n), { class: "kima-dynamic-input__rows" }), {
|
|
98
|
+
default: _(() => [(d(!0), o(r, null, p(D.value, (n, r) => (d(), o("div", {
|
|
99
|
+
key: E(n),
|
|
100
|
+
class: "kima-dynamic-input__row"
|
|
101
|
+
}, [m(a.$slots, "default", {
|
|
102
|
+
row: n,
|
|
103
|
+
index: r,
|
|
104
|
+
id: E(n),
|
|
105
|
+
update: (e) => N(r, e)
|
|
106
|
+
}, () => [s("output", null, h(JSON.stringify(n)), 1)], !0), s("div", y, [
|
|
107
|
+
l(t, {
|
|
108
|
+
variant: "text",
|
|
109
|
+
disabled: e.disabled || r === 0,
|
|
110
|
+
"aria-label": `${e.label}上移第${r + 1}项`,
|
|
111
|
+
onClick: (e) => M(r, -1)
|
|
112
|
+
}, {
|
|
113
|
+
default: _(() => [...f[0] ||= [c("上移", -1)]]),
|
|
114
|
+
_: 1
|
|
115
|
+
}, 8, [
|
|
116
|
+
"disabled",
|
|
117
|
+
"aria-label",
|
|
118
|
+
"onClick"
|
|
119
|
+
]),
|
|
120
|
+
l(t, {
|
|
121
|
+
variant: "text",
|
|
122
|
+
disabled: e.disabled || r === D.value.length - 1,
|
|
123
|
+
"aria-label": `${e.label}下移第${r + 1}项`,
|
|
124
|
+
onClick: (e) => M(r, 1)
|
|
125
|
+
}, {
|
|
126
|
+
default: _(() => [...f[1] ||= [c("下移", -1)]]),
|
|
127
|
+
_: 1
|
|
128
|
+
}, 8, [
|
|
129
|
+
"disabled",
|
|
130
|
+
"aria-label",
|
|
131
|
+
"onClick"
|
|
132
|
+
]),
|
|
133
|
+
l(t, {
|
|
134
|
+
variant: "text",
|
|
135
|
+
disabled: e.disabled || D.value.length <= e.min,
|
|
136
|
+
"aria-label": `移除第${r + 1}项`,
|
|
137
|
+
onClick: (e) => j(r)
|
|
138
|
+
}, {
|
|
139
|
+
default: _(() => [...f[2] ||= [c("移除", -1)]]),
|
|
140
|
+
_: 1
|
|
141
|
+
}, 8, [
|
|
142
|
+
"disabled",
|
|
143
|
+
"aria-label",
|
|
144
|
+
"onClick"
|
|
145
|
+
])
|
|
146
|
+
])]))), 128))]),
|
|
147
|
+
_: 3
|
|
148
|
+
}, 16), l(t, {
|
|
149
|
+
variant: "tonal",
|
|
150
|
+
disabled: O.value,
|
|
151
|
+
onClick: A
|
|
152
|
+
}, {
|
|
153
|
+
default: _(() => [...f[3] ||= [c("添加字段", -1)]]),
|
|
154
|
+
_: 1
|
|
155
|
+
}, 8, ["disabled"])], 8, v));
|
|
156
|
+
}
|
|
157
|
+
}, [["__scopeId", "data-v-97d6f5bf"]]);
|
|
158
|
+
export { b as default };
|