@kernel4632/kima 0.0.0-stage → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +209 -2
  3. package/dist/THIRD_PARTY_NOTICES.txt +2676 -0
  4. package/dist/kima-elements-core.js +53209 -0
  5. package/dist/kima-elements.js +126371 -0
  6. package/dist/kima-theme.js +1583 -0
  7. package/dist/kima.js +141 -0
  8. package/dist/style.css +2 -0
  9. package/dist/vue/_virtual/_plugin-vue_export-helper.js +7 -0
  10. package/dist/vue/components/advanced-input/calendar.ce.js +216 -0
  11. package/dist/vue/components/advanced-input/date-range-picker.ce.js +224 -0
  12. package/dist/vue/components/advanced-input/editable.ce.js +160 -0
  13. package/dist/vue/components/advanced-input/mention.ce.js +181 -0
  14. package/dist/vue/components/advanced-input/range-slider.ce.js +111 -0
  15. package/dist/vue/components/advanced-input/time-range-picker.ce.js +120 -0
  16. package/dist/vue/components/advanced-input/transfer.ce.js +192 -0
  17. package/dist/vue/components/content/chart.ce.js +282 -0
  18. package/dist/vue/components/content/code-editor.ce.js +309 -0
  19. package/dist/vue/components/content/equation.ce.js +69 -0
  20. package/dist/vue/components/content/heatmap.ce.js +148 -0
  21. package/dist/vue/components/content/rich-text-editor.ce.js +319 -0
  22. package/dist/vue/components/core/badge.ce.js +66 -0
  23. package/dist/vue/components/core/button-group.ce.js +142 -0
  24. package/dist/vue/components/core/button.ce.js +73 -0
  25. package/dist/vue/components/core/card.ce.js +73 -0
  26. package/dist/vue/components/core/cascader.ce.js +329 -0
  27. package/dist/vue/components/core/checkbox.ce.js +116 -0
  28. package/dist/vue/components/core/code-block.ce.js +108 -0
  29. package/dist/vue/components/core/combobox.ce.js +354 -0
  30. package/dist/vue/components/core/date-picker.ce.js +433 -0
  31. package/dist/vue/components/core/dialog.ce.js +118 -0
  32. package/dist/vue/components/core/divider.ce.js +49 -0
  33. package/dist/vue/components/core/drawer.ce.js +235 -0
  34. package/dist/vue/components/core/empty-state.ce.js +58 -0
  35. package/dist/vue/components/core/icon-button.ce.js +93 -0
  36. package/dist/vue/components/core/icon.ce.js +42 -0
  37. package/dist/vue/components/core/layout.ce.js +68 -0
  38. package/dist/vue/components/core/menu.ce.js +178 -0
  39. package/dist/vue/components/core/notification.ce.js +158 -0
  40. package/dist/vue/components/core/pagination.ce.js +158 -0
  41. package/dist/vue/components/core/progress.ce.js +49 -0
  42. package/dist/vue/components/core/select.ce.js +325 -0
  43. package/dist/vue/components/core/slider.ce.js +116 -0
  44. package/dist/vue/components/core/switch.ce.js +100 -0
  45. package/dist/vue/components/core/tabs.ce.js +193 -0
  46. package/dist/vue/components/core/text-field.ce.js +194 -0
  47. package/dist/vue/components/core/time-picker.ce.js +486 -0
  48. package/dist/vue/components/core/tooltip.ce.js +125 -0
  49. package/dist/vue/components/core/tree.ce.js +248 -0
  50. package/dist/vue/components/core/virtual-scroll.ce.js +176 -0
  51. package/dist/vue/components/data/copy-button.ce.js +75 -0
  52. package/dist/vue/components/data/image-preview.ce.js +226 -0
  53. package/dist/vue/components/data/infinite-scroll.ce.js +126 -0
  54. package/dist/vue/components/data/long-text.ce.js +70 -0
  55. package/dist/vue/components/data/relative-time.ce.js +77 -0
  56. package/dist/vue/components/data/ring-progress.ce.js +87 -0
  57. package/dist/vue/components/data/table.ce.js +491 -0
  58. package/dist/vue/components/data/virtual-table.ce.js +178 -0
  59. package/dist/vue/components/data/virtual-tree.ce.js +213 -0
  60. package/dist/vue/components/display/alert.ce.js +101 -0
  61. package/dist/vue/components/display/avatar-group.ce.js +65 -0
  62. package/dist/vue/components/display/avatar.ce.js +84 -0
  63. package/dist/vue/components/display/blockquote.ce.js +44 -0
  64. package/dist/vue/components/display/countdown.ce.js +77 -0
  65. package/dist/vue/components/display/descriptions.ce.js +43 -0
  66. package/dist/vue/components/display/highlight.ce.js +48 -0
  67. package/dist/vue/components/display/image.ce.js +146 -0
  68. package/dist/vue/components/display/list.ce.js +68 -0
  69. package/dist/vue/components/display/result.ce.js +57 -0
  70. package/dist/vue/components/display/skeleton.ce.js +67 -0
  71. package/dist/vue/components/display/spinner.ce.js +42 -0
  72. package/dist/vue/components/display/statistic.ce.js +71 -0
  73. package/dist/vue/components/display/timeline.ce.js +59 -0
  74. package/dist/vue/components/form-completion/angle-slider.ce.js +103 -0
  75. package/dist/vue/components/form-completion/color-picker.ce.js +286 -0
  76. package/dist/vue/components/form-completion/date-field.ce.js +131 -0
  77. package/dist/vue/components/form-completion/dynamic-input.ce.js +158 -0
  78. package/dist/vue/components/form-completion/form.ce.js +248 -0
  79. package/dist/vue/components/form-completion/json-input.ce.js +114 -0
  80. package/dist/vue/components/form-completion/masked-input.ce.js +88 -0
  81. package/dist/vue/components/form-completion/period-picker.ce.js +147 -0
  82. package/dist/vue/components/form-completion/time-field.ce.js +120 -0
  83. package/dist/vue/components/form-completion/upload-manager.ce.js +223 -0
  84. package/dist/vue/components/foundation/banner.ce.js +106 -0
  85. package/dist/vue/components/foundation/error-state.ce.js +108 -0
  86. package/dist/vue/components/foundation/field-group.ce.js +146 -0
  87. package/dist/vue/components/foundation/flex.ce.js +60 -0
  88. package/dist/vue/components/foundation/grid.ce.js +52 -0
  89. package/dist/vue/components/foundation/input-group.ce.js +34 -0
  90. package/dist/vue/components/foundation/page-header.ce.js +55 -0
  91. package/dist/vue/components/foundation/time-display.ce.js +129 -0
  92. package/dist/vue/components/foundation/typography.ce.js +71 -0
  93. package/dist/vue/components/input/checkbox-group.ce.js +93 -0
  94. package/dist/vue/components/input/field.ce.js +74 -0
  95. package/dist/vue/components/input/file-upload.ce.js +142 -0
  96. package/dist/vue/components/input/number-field.ce.js +103 -0
  97. package/dist/vue/components/input/pin-input.ce.js +112 -0
  98. package/dist/vue/components/input/radio-group.ce.js +96 -0
  99. package/dist/vue/components/input/rating.ce.js +115 -0
  100. package/dist/vue/components/input/tags-input.ce.js +153 -0
  101. package/dist/vue/components/input/textarea.ce.js +180 -0
  102. package/dist/vue/components/input/toggle.ce.js +58 -0
  103. package/dist/vue/components/interaction/chip.ce.js +95 -0
  104. package/dist/vue/components/interaction/command.ce.js +161 -0
  105. package/dist/vue/components/interaction/context-menu.ce.js +113 -0
  106. package/dist/vue/components/interaction/hover-card.ce.js +92 -0
  107. package/dist/vue/components/interaction/loading-overlay.ce.js +70 -0
  108. package/dist/vue/components/interaction/menubar.ce.js +134 -0
  109. package/dist/vue/components/interaction/multi-select.ce.js +264 -0
  110. package/dist/vue/components/interaction/popconfirm.ce.js +95 -0
  111. package/dist/vue/components/interaction/popover.ce.js +83 -0
  112. package/dist/vue/components/interaction/tree-select.ce.js +195 -0
  113. package/dist/vue/components/navigation/accordion.ce.js +114 -0
  114. package/dist/vue/components/navigation/anchor.ce.js +125 -0
  115. package/dist/vue/components/navigation/back-top.ce.js +67 -0
  116. package/dist/vue/components/navigation/breadcrumb.ce.js +48 -0
  117. package/dist/vue/components/navigation/carousel.ce.js +114 -0
  118. package/dist/vue/components/navigation/collapsible.ce.js +57 -0
  119. package/dist/vue/components/navigation/link.ce.js +62 -0
  120. package/dist/vue/components/navigation/navigation-menu.ce.js +91 -0
  121. package/dist/vue/components/navigation/overflow-list.ce.js +67 -0
  122. package/dist/vue/components/navigation/scroll-area.ce.js +47 -0
  123. package/dist/vue/components/navigation/splitter.ce.js +131 -0
  124. package/dist/vue/components/navigation/stepper.ce.js +74 -0
  125. package/dist/vue/components/navigation/toolbar.ce.js +93 -0
  126. package/dist/vue/components/navigation/visually-hidden.ce.js +16 -0
  127. package/dist/vue/components/shell/app-shell.ce.js +87 -0
  128. package/dist/vue/components/shell/config-provider.ce.js +110 -0
  129. package/dist/vue/components/shell/marquee.ce.js +92 -0
  130. package/dist/vue/components/shell/masonry.ce.js +50 -0
  131. package/dist/vue/components/shell/sidebar.ce.js +125 -0
  132. package/dist/vue/components/utility/affix.ce.js +64 -0
  133. package/dist/vue/components/utility/alert-dialog.ce.js +124 -0
  134. package/dist/vue/components/utility/animated-number.ce.js +66 -0
  135. package/dist/vue/components/utility/float-button.ce.js +104 -0
  136. package/dist/vue/components/utility/listbox.ce.js +81 -0
  137. package/dist/vue/components/utility/loading-bar.ce.js +85 -0
  138. package/dist/vue/components/utility/log-viewer.ce.js +124 -0
  139. package/dist/vue/components/utility/notification-queue.ce.js +109 -0
  140. package/dist/vue/components/utility/progress-group.ce.js +59 -0
  141. package/dist/vue/components/utility/qr-code.ce.js +62 -0
  142. package/dist/vue/components/utility/tag-group.ce.js +124 -0
  143. package/dist/vue/components/utility/tour.ce.js +214 -0
  144. package/dist/vue/components/utility/virtual-select.ce.js +207 -0
  145. package/dist/vue/components/utility/watermark.ce.js +44 -0
  146. package/dist/vue/internal/menu-items.js +184 -0
  147. package/dist/vue/internal/navigation-items.js +110 -0
  148. package/dist/vue/utils/code-highlight.js +142 -0
  149. package/dist/vue/utils/config.js +47 -0
  150. package/dist/vue/utils/content-motion.js +37 -0
  151. package/dist/vue/utils/content.js +83 -0
  152. package/dist/vue/utils/display-status.js +31 -0
  153. package/dist/vue/utils/foundation.js +65 -0
  154. package/dist/vue/utils/input-state.js +38 -0
  155. package/dist/vue/utils/interaction.js +103 -0
  156. package/dist/vue/utils/local-date.js +48 -0
  157. package/dist/vue/utils/motion.js +80 -0
  158. package/dist/vue/utils/native-slots.js +30 -0
  159. package/dist/vue/utils/navigation.js +44 -0
  160. package/dist/vue/utils/notifications.js +60 -0
  161. package/dist/vue/utils/qr.js +20 -0
  162. package/dist/vue/utils/remote-options.js +65 -0
  163. package/dist/vue/utils/ripple.js +20 -0
  164. package/dist/vue/utils/scoped-slots.js +22 -0
  165. package/dist/vue/utils/shell.js +43 -0
  166. package/dist/vue/utils/theme.js +50 -0
  167. package/dist/vue/utils/utility-choice.js +56 -0
  168. package/package.json +105 -4
@@ -0,0 +1,181 @@
1
+ import { useRipple as e } from "../../utils/ripple.js";
2
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
3
+ import { presenceTransition as n } from "../../utils/motion.js";
4
+ import { useInputAttrs as r, useInputState as i } from "../../utils/input-state.js";
5
+ /* empty css */
6
+ import { Fragment as a, Transition as o, computed as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createVNode as d, mergeProps as f, nextTick as p, normalizeClass as m, normalizeStyle as h, openBlock as g, ref as _, renderList as v, toDisplayString as y, unref as b, useId as x, watch as S, withCtx as C, withModifiers as w } from "vue";
7
+ // src/components/advanced-input/mention.ce.vue
8
+ var T = [
9
+ "value",
10
+ "name",
11
+ "aria-label",
12
+ "placeholder",
13
+ "disabled",
14
+ "readonly",
15
+ "required",
16
+ "maxlength",
17
+ "rows",
18
+ "aria-controls",
19
+ "aria-activedescendant"
20
+ ], E = {
21
+ key: 0,
22
+ class: "kima-mention__popup"
23
+ }, D = [
24
+ "id",
25
+ "aria-selected",
26
+ "aria-disabled",
27
+ "onPointerdown"
28
+ ], O = {
29
+ key: 0,
30
+ role: "status"
31
+ }, k = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
32
+ __name: "mention.ce",
33
+ props: {
34
+ modelValue: {
35
+ type: String,
36
+ default: ""
37
+ },
38
+ items: {
39
+ type: Array,
40
+ default: () => []
41
+ },
42
+ trigger: {
43
+ type: String,
44
+ default: "@"
45
+ },
46
+ label: {
47
+ type: String,
48
+ default: "消息"
49
+ },
50
+ placeholder: String,
51
+ name: String,
52
+ disabled: Boolean,
53
+ readonly: Boolean,
54
+ required: Boolean,
55
+ maxlength: Number,
56
+ rows: {
57
+ type: Number,
58
+ default: 4
59
+ }
60
+ },
61
+ emits: [
62
+ "update:modelValue",
63
+ "change",
64
+ "select"
65
+ ],
66
+ setup(t, { expose: k, emit: A }) {
67
+ let j = t, M = A, N = _(null), P = _(null), { attrs: F, controlAttrs: I } = r(), L = _(0), R = _(0), z = _(!1), B = _(!1), V = _(!1), H = _(0), { local: U, update: W } = i(j, M, N, (e) => String(e || ""), () => {
68
+ V.value = !0, z.value = !1;
69
+ });
70
+ e(N);
71
+ let G = `kima-mention-${x()}`, K = s(() => {
72
+ if (!B.value || z.value || V.value || j.disabled || j.readonly || !j.trigger || L.value !== R.value) return null;
73
+ let e = U.value.slice(0, L.value), t = e.lastIndexOf(j.trigger);
74
+ if (t < 0 || t && !/\s/.test(e[t - 1])) return null;
75
+ let n = e.slice(t + j.trigger.length);
76
+ return /^[\p{L}\p{N}_-]*$/u.test(n) ? {
77
+ start: t,
78
+ end: L.value,
79
+ term: n
80
+ } : null;
81
+ }), q = s(() => K.value ? j.items.map((e) => ({
82
+ item: e,
83
+ label: String(typeof e == "string" ? e : e.label ?? e.value),
84
+ value: typeof e == "string" ? e : e.value ?? e.label,
85
+ disabled: !!e?.disabled
86
+ })).filter((e) => e.label.toLocaleLowerCase().includes(K.value.term.toLocaleLowerCase())).slice(0, 8) : []), J = s(() => !!K.value);
87
+ S(q, (e) => {
88
+ H.value = Math.max(0, e.findIndex((e) => !e.disabled));
89
+ });
90
+ function Y() {
91
+ L.value = P.value?.selectionStart || 0, R.value = P.value?.selectionEnd || 0;
92
+ }
93
+ function X() {
94
+ z.value || (V.value = !1, W(P.value.value), Y());
95
+ }
96
+ function Z() {
97
+ z.value = !1, X();
98
+ }
99
+ async function Q(e) {
100
+ let t = K.value;
101
+ if (!t || !e || e.disabled) return;
102
+ let n = `${j.trigger}${e.label} `, r = U.value.slice(0, t.start) + n + U.value.slice(t.end);
103
+ j.maxlength && r.length > j.maxlength || (W(r), M("select", e.item, {
104
+ start: t.start,
105
+ end: t.end,
106
+ text: n
107
+ }), V.value = !0, await p(), P.value && !j.disabled && (P.value.focus(), P.value.setSelectionRange(t.start + n.length, t.start + n.length), Y()));
108
+ }
109
+ function $(e) {
110
+ if (e.isComposing || z.value || e.keyCode === 229) e.key === "Enter" && e.preventDefault();
111
+ else if (Y(), J.value) {
112
+ if (e.key === "Escape") e.preventDefault(), V.value = !0;
113
+ else if (["ArrowDown", "ArrowUp"].includes(e.key)) {
114
+ e.preventDefault();
115
+ let t = q.value;
116
+ for (let n = 1; n <= t.length; n += 1) {
117
+ let r = (H.value + (e.key === "ArrowDown" ? n : -n) + t.length * 2) % t.length;
118
+ if (!t[r].disabled) {
119
+ H.value = r;
120
+ break;
121
+ }
122
+ }
123
+ } else e.key === "Enter" && q.value.some((e) => !e.disabled) && (e.preventDefault(), Q(q.value[H.value]));
124
+ }
125
+ }
126
+ return k({ focus: () => P.value?.focus() }), (e, r) => (g(), l("div", {
127
+ ref_key: "root",
128
+ ref: N,
129
+ class: m(["kima-mention", b(F).class]),
130
+ style: h(b(F).style)
131
+ }, [u("textarea", f({
132
+ ref_key: "input",
133
+ ref: P
134
+ }, b(I), {
135
+ class: "kima-mention__input",
136
+ value: b(U),
137
+ name: t.name,
138
+ "aria-label": b(I)["aria-label"] || t.label,
139
+ placeholder: t.placeholder,
140
+ disabled: t.disabled,
141
+ readonly: t.readonly,
142
+ required: t.required,
143
+ maxlength: t.maxlength,
144
+ rows: t.rows,
145
+ "aria-autocomplete": "list",
146
+ "aria-controls": J.value ? G : void 0,
147
+ "aria-activedescendant": J.value && q.value[H.value] ? `${G}-${H.value}` : void 0,
148
+ onInput: w(X, ["stop"]),
149
+ onChange: r[0] ||= w(() => {}, ["stop"]),
150
+ onKeydown: $,
151
+ onKeyup: Y,
152
+ onClick: r[1] ||= (e) => {
153
+ V.value = !1, Y();
154
+ },
155
+ onSelect: w(Y, ["stop"]),
156
+ onFocus: r[2] ||= (e) => {
157
+ B.value = !0, Y();
158
+ },
159
+ onBlur: r[3] ||= (e) => B.value = !1,
160
+ onCompositionstart: r[4] ||= (e) => z.value = !0,
161
+ onCompositionend: Z
162
+ }), null, 16, T), d(o, f({ name: "kima-popup" }, b(n)), {
163
+ default: C(() => [J.value ? (g(), l("div", E, [u("ul", {
164
+ id: G,
165
+ class: "kima-mention__list",
166
+ role: "listbox",
167
+ "aria-label": "提及建议"
168
+ }, [(g(!0), l(a, null, v(q.value, (e, t) => (g(), l("li", {
169
+ id: `${G}-${t}`,
170
+ key: t,
171
+ class: "kima-mention__option",
172
+ role: "option",
173
+ "aria-selected": t === H.value,
174
+ "aria-disabled": e.disabled || void 0,
175
+ onPointerdown: w((t) => Q(e), ["prevent"])
176
+ }, y(e.label), 41, D))), 128))]), q.value.length ? c("", !0) : (g(), l("p", O, "无匹配候选"))])) : c("", !0)]),
177
+ _: 1
178
+ }, 16)], 6));
179
+ }
180
+ }), [["__scopeId", "data-v-e6d9ff72"]]);
181
+ export { k as default };
@@ -0,0 +1,111 @@
1
+ import e from "../../_virtual/_plugin-vue_export-helper.js";
2
+ import { useInputState as t } from "../../utils/input-state.js";
3
+ /* empty css */
4
+ import { Fragment as n, computed as r, createElementBlock as i, createElementVNode as a, normalizeStyle as o, openBlock as s, ref as c, renderList as l, toDisplayString as u, unref as d, watch as f, withModifiers as p } from "vue";
5
+ // src/components/advanced-input/range-slider.ce.vue
6
+ var m = ["aria-label", "aria-disabled"], h = { class: "kima-range-slider__values" }, g = { class: "kima-range-slider__tracks" }, _ = [
7
+ "value",
8
+ "min",
9
+ "max",
10
+ "step",
11
+ "disabled",
12
+ "name",
13
+ "aria-label",
14
+ "aria-valuemin",
15
+ "aria-valuemax",
16
+ "onInput"
17
+ ], v = /*#__PURE__*/ e({
18
+ __name: "range-slider.ce",
19
+ props: {
20
+ modelValue: {
21
+ type: Array,
22
+ default: () => [25, 75]
23
+ },
24
+ min: {
25
+ type: Number,
26
+ default: 0
27
+ },
28
+ max: {
29
+ type: Number,
30
+ default: 100
31
+ },
32
+ step: {
33
+ type: Number,
34
+ default: 1
35
+ },
36
+ name: String,
37
+ startName: String,
38
+ endName: String,
39
+ label: {
40
+ type: String,
41
+ default: "范围"
42
+ },
43
+ startLabel: {
44
+ type: String,
45
+ default: "下限"
46
+ },
47
+ endLabel: {
48
+ type: String,
49
+ default: "上限"
50
+ },
51
+ disabled: Boolean,
52
+ required: Boolean
53
+ },
54
+ emits: ["update:modelValue", "change"],
55
+ setup(e, { emit: v }) {
56
+ let y = e, b = v, x = c(null), S = r(() => Number.isFinite(y.min) ? y.min : 0), C = r(() => Math.max(S.value, Number.isFinite(y.max) ? y.max : S.value + 100)), w = r(() => Number.isFinite(y.step) && y.step > 0 ? y.step : 1);
57
+ function T(e, t) {
58
+ let n = Number(e), r = Math.max(S.value, Math.min(C.value, Number.isFinite(n) ? n : t)), i = S.value + Math.round((r - S.value) / w.value) * w.value, a = S.value + Math.floor((C.value - S.value) / w.value + 1e-9) * w.value;
59
+ return Number(Math.max(S.value, Math.min(a, i)).toFixed(10));
60
+ }
61
+ function E(e) {
62
+ let t = T(e?.[0], S.value), n = T(e?.[1], C.value);
63
+ return t <= n ? [t, n] : [n, t];
64
+ }
65
+ let { local: D, update: O } = t(y, b, x, E);
66
+ f([
67
+ S,
68
+ C,
69
+ w
70
+ ], () => {
71
+ D.value = E(D.value);
72
+ });
73
+ function k(e, t) {
74
+ let n = [...D.value], r = T(t.target.value, S.value);
75
+ n[e] = e === 0 ? Math.min(r, n[1]) : Math.max(r, n[0]), t.target.value = String(n[e]), O(n, !1);
76
+ }
77
+ let A = r(() => {
78
+ let e = C.value - S.value || 1;
79
+ return {
80
+ "--kima-range-start": `${(D.value[0] - S.value) / e * 100}%`,
81
+ "--kima-range-end": `${(D.value[1] - S.value) / e * 100}%`
82
+ };
83
+ });
84
+ return (t, r) => (s(), i("div", {
85
+ ref_key: "root",
86
+ ref: x,
87
+ class: "kima-range-slider",
88
+ role: "group",
89
+ "aria-label": e.label,
90
+ "aria-disabled": e.disabled || void 0,
91
+ style: o(A.value)
92
+ }, [a("output", h, u(d(D)[0]) + " – " + u(d(D)[1]), 1), a("div", g, [(s(!0), i(n, null, l(d(D), (t, n) => (s(), i("input", {
93
+ key: n,
94
+ class: "kima-range-slider__input",
95
+ type: "range",
96
+ value: t,
97
+ min: S.value,
98
+ max: C.value,
99
+ step: w.value,
100
+ disabled: e.disabled,
101
+ name: n === 0 ? e.startName || (e.name ? `${e.name}[start]` : void 0) : e.endName || (e.name ? `${e.name}[end]` : void 0),
102
+ "aria-label": n === 0 ? e.startLabel : e.endLabel,
103
+ "aria-valuemin": n === 0 ? S.value : d(D)[0],
104
+ "aria-valuemax": n === 0 ? d(D)[1] : C.value,
105
+ style: o({ zIndex: n === 0 && d(D)[0] === C.value ? 3 : n + 1 }),
106
+ onInput: p((e) => k(n, e), ["stop"]),
107
+ onChange: r[0] ||= p((e) => b("change", [...d(D)]), ["stop"])
108
+ }, null, 44, _))), 128))])], 12, m));
109
+ }
110
+ }, [["__scopeId", "data-v-cceb9717"]]);
111
+ export { v as default };
@@ -0,0 +1,120 @@
1
+ import { useRipple as e } from "../../utils/ripple.js";
2
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
3
+ import { useInputState as n } from "../../utils/input-state.js";
4
+ import { timeMinutes as r } from "../../utils/local-date.js";
5
+ /* empty css */
6
+ import { computed as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, openBlock as c, ref as l, toDisplayString as u, unref as d, watchEffect as f, withModifiers as p } from "vue";
7
+ // src/components/advanced-input/time-range-picker.ce.vue
8
+ var m = ["aria-disabled"], h = [
9
+ "value",
10
+ "aria-label",
11
+ "name",
12
+ "min",
13
+ "max",
14
+ "step",
15
+ "required",
16
+ "disabled"
17
+ ], g = [
18
+ "value",
19
+ "aria-label",
20
+ "name",
21
+ "min",
22
+ "max",
23
+ "step",
24
+ "required",
25
+ "disabled"
26
+ ], _ = ["role"], v = /*#__PURE__*/ t({
27
+ __name: "time-range-picker.ce",
28
+ props: {
29
+ modelValue: {
30
+ type: Array,
31
+ default: () => [null, null]
32
+ },
33
+ name: String,
34
+ startName: String,
35
+ endName: String,
36
+ startLabel: {
37
+ type: String,
38
+ default: "开始时间"
39
+ },
40
+ endLabel: {
41
+ type: String,
42
+ default: "结束时间"
43
+ },
44
+ min: String,
45
+ max: String,
46
+ step: {
47
+ type: Number,
48
+ default: 1
49
+ },
50
+ required: Boolean,
51
+ disabled: Boolean,
52
+ allowOvernight: {
53
+ type: Boolean,
54
+ default: !0
55
+ }
56
+ },
57
+ emits: ["update:modelValue", "change"],
58
+ setup(t, { expose: v, emit: y }) {
59
+ let b = t, x = y, S = l(null), C = l(null), w = l(null), { local: T, update: E } = n(b, x, S, (e) => [r(e?.[0]) === null ? null : e[0], r(e?.[1]) === null ? null : e[1]]);
60
+ e(S);
61
+ let D = i(() => {
62
+ let e = r(T.value[0]), t = r(T.value[1]);
63
+ return e === null || t === null ? null : t - e + (b.allowOvernight && t <= e ? 1440 : 0);
64
+ }), O = i(() => D.value !== null && D.value < 0 ? "结束时间不能早于开始时间" : ""), k = i(() => Math.max(1, Number.isFinite(b.step) ? Math.floor(b.step) : 1) * 60);
65
+ f(() => {
66
+ w.value?.setCustomValidity(O.value);
67
+ }, { flush: "post" });
68
+ function A(e, t) {
69
+ let n = [...T.value];
70
+ n[e] = t || null, E(n);
71
+ }
72
+ return v({ getInterval: () => D.value }), (e, n) => (c(), o("div", {
73
+ ref_key: "root",
74
+ ref: S,
75
+ class: "kima-time-range-picker",
76
+ role: "group",
77
+ "aria-label": "时间范围",
78
+ "aria-disabled": t.disabled || void 0
79
+ }, [
80
+ s("input", {
81
+ ref_key: "startInput",
82
+ ref: C,
83
+ class: "kima-time-range-picker__input",
84
+ type: "time",
85
+ value: d(T)[0] || "",
86
+ "aria-label": t.startLabel,
87
+ name: d(T)[0] ? t.startName || (t.name ? `${t.name}[start]` : void 0) : void 0,
88
+ min: t.min,
89
+ max: t.max,
90
+ step: k.value,
91
+ required: t.required,
92
+ disabled: t.disabled,
93
+ onInput: n[0] ||= p((e) => A(0, e.target.value), ["stop"]),
94
+ onChange: n[1] ||= p(() => {}, ["stop"])
95
+ }, null, 40, h),
96
+ n[4] ||= s("span", { "aria-hidden": "true" }, "→", -1),
97
+ s("input", {
98
+ ref_key: "endInput",
99
+ ref: w,
100
+ class: "kima-time-range-picker__input",
101
+ type: "time",
102
+ value: d(T)[1] || "",
103
+ "aria-label": t.endLabel,
104
+ name: d(T)[1] ? t.endName || (t.name ? `${t.name}[end]` : void 0) : void 0,
105
+ min: t.min,
106
+ max: t.max,
107
+ step: k.value,
108
+ required: t.required,
109
+ disabled: t.disabled,
110
+ onInput: n[2] ||= p((e) => A(1, e.target.value), ["stop"]),
111
+ onChange: n[3] ||= p(() => {}, ["stop"])
112
+ }, null, 40, g),
113
+ D.value === null ? a("", !0) : (c(), o("output", {
114
+ key: 0,
115
+ role: O.value ? "alert" : "status"
116
+ }, u(O.value || `${Math.floor(D.value / 60)}h ${D.value % 60}m${t.allowOvernight && d(T)[1] <= d(T)[0] ? " · 次日结束" : ""}`), 9, _))
117
+ ], 8, m));
118
+ }
119
+ }, [["__scopeId", "data-v-52265737"]]);
120
+ export { v as default };
@@ -0,0 +1,192 @@
1
+ import { useRipple as e } from "../../utils/ripple.js";
2
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
3
+ import n from "../core/button.ce.js";
4
+ import { useInputState as r } from "../../utils/input-state.js";
5
+ /* empty css */
6
+ import { Fragment as i, computed as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, openBlock as d, ref as f, renderList as p, toDisplayString as m, unref as h, vModelSelect as g, vModelText as _, watchEffect as v, withCtx as y, withDirectives as b } from "vue";
7
+ // src/components/advanced-input/transfer.ce.vue
8
+ var x = ["aria-label", "aria-disabled"], S = ["aria-label"], C = ["aria-label", "disabled"], w = ["aria-label", "disabled"], T = ["value", "disabled"], E = {
9
+ key: 1,
10
+ role: "status"
11
+ }, D = ["aria-label"], O = ["aria-label", "disabled"], k = ["aria-label", "disabled"], A = ["value", "disabled"], j = {
12
+ key: 1,
13
+ role: "status"
14
+ }, M = [
15
+ "name",
16
+ "value",
17
+ "disabled"
18
+ ], N = /*#__PURE__*/ t({
19
+ __name: "transfer.ce",
20
+ props: {
21
+ modelValue: {
22
+ type: Array,
23
+ default: () => []
24
+ },
25
+ options: {
26
+ type: Array,
27
+ default: () => []
28
+ },
29
+ name: String,
30
+ label: {
31
+ type: String,
32
+ default: "穿梭选择"
33
+ },
34
+ disabled: Boolean,
35
+ required: Boolean,
36
+ searchable: {
37
+ type: Boolean,
38
+ default: !0
39
+ },
40
+ availableTitle: {
41
+ type: String,
42
+ default: "可用项"
43
+ },
44
+ selectedTitle: {
45
+ type: String,
46
+ default: "已选项"
47
+ }
48
+ },
49
+ emits: ["update:modelValue", "change"],
50
+ setup(t, { emit: N }) {
51
+ let P = t, F = N, I = f(null), L = f(null), R = f([]), z = f([]), B = f(""), V = f(""), { local: H, update: U } = r(P, F, I, (e) => Array.isArray(e) ? [...new Set(e.map(String))] : [], () => {
52
+ R.value = [], z.value = [], B.value = "", V.value = "";
53
+ });
54
+ e(I);
55
+ let W = a(() => {
56
+ let e = /* @__PURE__ */ new Set();
57
+ return P.options.filter((t) => {
58
+ let n = String(t.value);
59
+ return !e.has(n) && (e.add(n), !0);
60
+ }).map((e) => ({
61
+ ...e,
62
+ value: String(e.value),
63
+ label: String(e.label ?? e.value)
64
+ }));
65
+ }), G = a(() => W.value.filter((e) => !H.value.includes(e.value))), K = a(() => H.value.map((e) => W.value.find((t) => t.value === e) || {
66
+ value: e,
67
+ label: e,
68
+ disabled: !0
69
+ })), q = a(() => G.value.filter((e) => e.label.toLocaleLowerCase().includes(B.value.toLocaleLowerCase()))), J = a(() => K.value.filter((e) => e.label.toLocaleLowerCase().includes(V.value.toLocaleLowerCase())));
70
+ v(() => {
71
+ L.value?.setCustomValidity(P.required && !H.value.length ? "请至少移入一项" : "");
72
+ }, { flush: "post" });
73
+ let Y = a(() => q.value.filter((e) => R.value.includes(e.value) && !e.disabled)), X = a(() => J.value.filter((e) => z.value.includes(e.value) && !e.disabled));
74
+ function Z() {
75
+ P.disabled || (U([...H.value, ...Y.value.map((e) => e.value)]), R.value = []);
76
+ }
77
+ function Q() {
78
+ if (P.disabled) return;
79
+ let e = new Set(X.value.map((e) => e.value));
80
+ U(H.value.filter((t) => !e.has(t))), z.value = [];
81
+ }
82
+ function $(e) {
83
+ let t = (e === "left" ? q.value : J.value).filter((e) => !e.disabled).map((e) => e.value);
84
+ e === "left" ? R.value = t : z.value = t;
85
+ }
86
+ return (e, r) => (d(), s("div", {
87
+ ref_key: "root",
88
+ ref: I,
89
+ class: "kima-transfer",
90
+ role: "group",
91
+ "aria-label": t.label,
92
+ "aria-disabled": t.disabled || void 0
93
+ }, [
94
+ c("section", {
95
+ class: "kima-transfer__panel",
96
+ "aria-label": t.availableTitle
97
+ }, [
98
+ c("header", null, [c("strong", null, m(t.availableTitle), 1), c("span", null, m(G.value.length), 1)]),
99
+ t.searchable ? b((d(), s("input", {
100
+ key: 0,
101
+ "onUpdate:modelValue": r[0] ||= (e) => B.value = e,
102
+ class: "kima-transfer__search",
103
+ type: "search",
104
+ "aria-label": `搜索${t.availableTitle}`,
105
+ disabled: t.disabled,
106
+ placeholder: "搜索"
107
+ }, null, 8, C)), [[_, B.value]]) : o("", !0),
108
+ b(c("select", {
109
+ ref_key: "left",
110
+ ref: L,
111
+ "onUpdate:modelValue": r[1] ||= (e) => R.value = e,
112
+ class: "kima-transfer__list",
113
+ multiple: "",
114
+ size: "6",
115
+ "aria-label": t.availableTitle,
116
+ disabled: t.disabled
117
+ }, [(d(!0), s(i, null, p(q.value, (e) => (d(), s("option", {
118
+ key: e.value,
119
+ value: e.value,
120
+ disabled: e.disabled
121
+ }, m(e.label), 9, T))), 128))], 8, w), [[g, R.value]]),
122
+ q.value.length ? o("", !0) : (d(), s("span", E, "无可用项")),
123
+ u(n, {
124
+ variant: "text",
125
+ disabled: t.disabled || !q.value.some((e) => !e.disabled),
126
+ onClick: r[2] ||= (e) => $("left")
127
+ }, {
128
+ default: y(() => [...r[6] ||= [l("全选可用项", -1)]]),
129
+ _: 1
130
+ }, 8, ["disabled"]),
131
+ u(n, {
132
+ disabled: t.disabled || !Y.value.length,
133
+ onClick: Z
134
+ }, {
135
+ default: y(() => [...r[7] ||= [l("移入选中项 →", -1)]]),
136
+ _: 1
137
+ }, 8, ["disabled"])
138
+ ], 8, S),
139
+ c("section", {
140
+ class: "kima-transfer__panel",
141
+ "aria-label": t.selectedTitle
142
+ }, [
143
+ c("header", null, [c("strong", null, m(t.selectedTitle), 1), c("span", null, m(h(H).length), 1)]),
144
+ t.searchable ? b((d(), s("input", {
145
+ key: 0,
146
+ "onUpdate:modelValue": r[3] ||= (e) => V.value = e,
147
+ class: "kima-transfer__search",
148
+ type: "search",
149
+ "aria-label": `搜索${t.selectedTitle}`,
150
+ disabled: t.disabled,
151
+ placeholder: "搜索"
152
+ }, null, 8, O)), [[_, V.value]]) : o("", !0),
153
+ b(c("select", {
154
+ "onUpdate:modelValue": r[4] ||= (e) => z.value = e,
155
+ class: "kima-transfer__list",
156
+ multiple: "",
157
+ size: "6",
158
+ "aria-label": t.selectedTitle,
159
+ disabled: t.disabled
160
+ }, [(d(!0), s(i, null, p(J.value, (e) => (d(), s("option", {
161
+ key: e.value,
162
+ value: e.value,
163
+ disabled: e.disabled
164
+ }, m(e.label), 9, A))), 128))], 8, k), [[g, z.value]]),
165
+ J.value.length ? o("", !0) : (d(), s("span", j, "无已选项")),
166
+ u(n, {
167
+ variant: "text",
168
+ disabled: t.disabled || !J.value.some((e) => !e.disabled),
169
+ onClick: r[5] ||= (e) => $("right")
170
+ }, {
171
+ default: y(() => [...r[8] ||= [l("全选已选项", -1)]]),
172
+ _: 1
173
+ }, 8, ["disabled"]),
174
+ u(n, {
175
+ disabled: t.disabled || !X.value.length,
176
+ onClick: Q
177
+ }, {
178
+ default: y(() => [...r[9] ||= [l("← 移出选中项", -1)]]),
179
+ _: 1
180
+ }, 8, ["disabled"])
181
+ ], 8, D),
182
+ (d(!0), s(i, null, p(h(H), (e) => (d(), s("input", {
183
+ key: e,
184
+ type: "hidden",
185
+ name: t.name,
186
+ value: e,
187
+ disabled: t.disabled
188
+ }, null, 8, M))), 128))
189
+ ], 8, x));
190
+ }
191
+ }, [["__scopeId", "data-v-d1dddadf"]]);
192
+ export { N as default };