@vaebe/ccui 2.0.0-beta.0 → 2.0.1-beta.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.
- package/README.md +4 -0
- package/button/index.es.js +28 -22
- package/button/index.umd.js +1 -1
- package/calendar/index.es.js +445 -90
- package/calendar/index.umd.js +1 -1
- package/ccui-cli.css +1 -1
- package/check-box/index.es.js +8 -2
- package/check-box/index.umd.js +1 -1
- package/chunk-Ndeg2fpE.js +20 -0
- package/collapse/index.es.js +10 -7
- package/collapse/index.umd.js +1 -1
- package/config-provider/chunk-C_CI6nMA.js +13 -0
- package/config-provider/en-BG83iZ_P.js +24 -0
- package/config-provider/index.es.js +408 -53
- package/config-provider/index.umd.js +1 -1
- package/config-provider/ja-B-93MQG5.js +56 -0
- package/config-provider/ko-86th3uXt.js +56 -0
- package/config-provider/zh-cn-BQE-LNg1.js +59 -0
- package/date-picker/ccui-cli.css +1 -1
- package/date-picker/index.es.js +664 -482
- package/date-picker/index.umd.js +1 -1
- package/drawer/index.es.js +271 -279
- package/drawer/index.umd.js +1 -1
- package/dropdown/index.es.js +187 -171
- package/dropdown/index.umd.js +1 -1
- package/empty/index.es.js +341 -24
- package/empty/index.umd.js +1 -1
- package/en-BVwCvuzF.js +24 -0
- package/float-button/index.es.js +1134 -46
- package/float-button/index.umd.js +1 -1
- package/form/index.es.js +1357 -261
- package/form/index.umd.js +1 -1
- package/icon/index.es.js +93 -10
- package/icon/index.umd.js +1 -1
- package/image/index.es.js +353 -36
- package/image/index.umd.js +1 -1
- package/input/index.es.js +24 -15
- package/input/index.umd.js +1 -1
- package/input-number/index.es.js +45 -25
- package/input-number/index.umd.js +1 -1
- package/ja-B4U4rt8A.js +56 -0
- package/ko-BG35I8uK.js +56 -0
- package/menu/index.es.js +3 -1
- package/menu/index.umd.js +1 -1
- package/message/index.es.js +1179 -86
- package/message/index.umd.js +1 -1
- package/modal/index.es.js +735 -335
- package/modal/index.umd.js +1 -1
- package/notification/index.es.js +1176 -83
- package/notification/index.umd.js +1 -1
- package/package.json +9 -9
- package/pagination/index.es.js +381 -60
- package/pagination/index.umd.js +1 -1
- package/popconfirm/index.es.js +469 -143
- package/popconfirm/index.umd.js +1 -1
- package/popover/index.es.js +192 -175
- package/popover/index.umd.js +1 -1
- package/radio/index.es.js +8 -2
- package/radio/index.umd.js +1 -1
- package/rate/index.es.js +22 -12
- package/rate/index.umd.js +1 -1
- package/select/index.es.js +135 -53
- package/select/index.umd.js +1 -1
- package/slider/index.es.js +165 -155
- package/slider/index.umd.js +1 -1
- package/steps/index.es.js +1140 -49
- package/steps/index.umd.js +1 -1
- package/switch/index.es.js +2 -0
- package/switch/index.umd.js +1 -1
- package/tabs/index.es.js +31 -5
- package/tabs/index.umd.js +1 -1
- package/tag/index.es.js +53 -35
- package/tag/index.umd.js +1 -1
- package/tooltip/index.es.js +78 -77
- package/tooltip/index.umd.js +1 -1
- package/tree/ccui-cli.css +1 -1
- package/tree/index.es.js +1491 -276
- package/tree/index.umd.js +1 -1
- package/typography/index.es.js +1213 -125
- package/typography/index.umd.js +1 -1
- package/vue-ccui.es.js +8726 -7604
- package/vue-ccui.umd.js +1 -1
- package/zh-cn-C8nbfD5S.js +59 -0
package/dropdown/index.es.js
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
import * as e from "vue";
|
|
2
2
|
import { Teleport as t, Transition as n, computed as r, createVNode as i, defineComponent as a, getCurrentInstance as o, isVNode as s, mergeProps as c, nextTick as l, onMounted as u, onUnmounted as d, ref as f, watch as p } from "vue";
|
|
3
|
-
import { arrow as m, autoUpdate as h, computePosition as g, flip as _, offset as
|
|
3
|
+
import { arrow as m, autoUpdate as h, computePosition as g, flip as _, offset as ee, shift as v } from "@floating-ui/dom";
|
|
4
4
|
//#region \0rolldown/runtime.js
|
|
5
|
-
var
|
|
5
|
+
var y = Object.defineProperty, b = Object.getOwnPropertyDescriptor, x = Object.getOwnPropertyNames, S = Object.prototype.hasOwnProperty, C = (e, t) => {
|
|
6
6
|
let n = {};
|
|
7
|
-
for (var r in e)
|
|
7
|
+
for (var r in e) y(n, r, {
|
|
8
8
|
get: e[r],
|
|
9
9
|
enumerable: !0
|
|
10
10
|
});
|
|
11
|
-
return t ||
|
|
12
|
-
},
|
|
13
|
-
if (t && typeof t == "object" || typeof t == "function") for (var i =
|
|
11
|
+
return t || y(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
12
|
+
}, w = (e, t, n, r) => {
|
|
13
|
+
if (t && typeof t == "object" || typeof t == "function") for (var i = x(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !S.call(e, s) && s !== n && y(e, s, {
|
|
14
14
|
get: ((e) => t[e]).bind(null, s),
|
|
15
|
-
enumerable: !(r =
|
|
15
|
+
enumerable: !(r = b(t, s)) || r.enumerable
|
|
16
16
|
});
|
|
17
17
|
return e;
|
|
18
|
-
},
|
|
18
|
+
}, T = (e, t, n) => (w(e, t, "default"), n && w(n, t, "default"));
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region ../../node_modules/.pnpm/@floating-ui+utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
|
|
21
|
-
function
|
|
21
|
+
function E() {
|
|
22
22
|
return typeof window < "u";
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
return
|
|
24
|
+
function D(e) {
|
|
25
|
+
return k(e) ? (e.nodeName || "").toLowerCase() : "#document";
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function O(e) {
|
|
28
28
|
var t;
|
|
29
29
|
return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
return
|
|
31
|
+
function k(e) {
|
|
32
|
+
return E() ? e instanceof Node || e instanceof O(e).Node : !1;
|
|
33
33
|
}
|
|
34
34
|
//#endregion
|
|
35
35
|
//#region ../../node_modules/.pnpm/vue-demi@0.14.10_vue@3.5.33_typescript@5.9.3_/node_modules/vue-demi/lib/index.mjs
|
|
36
|
-
var
|
|
36
|
+
var A = /* @__PURE__ */ C({
|
|
37
37
|
Vue: () => e,
|
|
38
38
|
Vue2: () => void 0,
|
|
39
|
-
del: () =>
|
|
40
|
-
install: () =>
|
|
39
|
+
del: () => P,
|
|
40
|
+
install: () => M,
|
|
41
41
|
isVue2: () => !1,
|
|
42
42
|
isVue3: () => !0,
|
|
43
|
-
set: () =>
|
|
43
|
+
set: () => N
|
|
44
44
|
});
|
|
45
|
-
import * as
|
|
46
|
-
|
|
47
|
-
function
|
|
48
|
-
function
|
|
45
|
+
import * as j from "vue";
|
|
46
|
+
T(A, j);
|
|
47
|
+
function M() {}
|
|
48
|
+
function N(e, t, n) {
|
|
49
49
|
return Array.isArray(e) ? (e.length = Math.max(e.length, t), e.splice(t, 1, n), n) : (e[t] = n, n);
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function P(e, t) {
|
|
52
52
|
if (Array.isArray(e)) {
|
|
53
53
|
e.splice(t, 1);
|
|
54
54
|
return;
|
|
@@ -57,25 +57,25 @@ function ee(e, t) {
|
|
|
57
57
|
}
|
|
58
58
|
//#endregion
|
|
59
59
|
//#region ../../node_modules/.pnpm/@floating-ui+vue@1.1.9_vue@3.5.33_typescript@5.9.3_/node_modules/@floating-ui/vue/dist/floating-ui.vue.mjs
|
|
60
|
-
function
|
|
60
|
+
function F(e) {
|
|
61
61
|
return typeof e == "object" && !!e && "$el" in e;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
if (
|
|
63
|
+
function I(e) {
|
|
64
|
+
if (F(e)) {
|
|
65
65
|
let t = e.$el;
|
|
66
|
-
return
|
|
66
|
+
return k(t) && D(t) === "#comment" ? null : t;
|
|
67
67
|
}
|
|
68
68
|
return e;
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
return typeof e == "function" ? e() : (0,
|
|
70
|
+
function L(e) {
|
|
71
|
+
return typeof e == "function" ? e() : (0, A.unref)(e);
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function te(e) {
|
|
74
74
|
return {
|
|
75
75
|
name: "arrow",
|
|
76
76
|
options: e,
|
|
77
77
|
fn(t) {
|
|
78
|
-
let n =
|
|
78
|
+
let n = I(L(e.element));
|
|
79
79
|
return n == null ? {} : m({
|
|
80
80
|
element: n,
|
|
81
81
|
padding: e.padding
|
|
@@ -83,34 +83,34 @@ function ne(e) {
|
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function R(e) {
|
|
87
87
|
return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
|
|
88
88
|
}
|
|
89
|
-
function
|
|
90
|
-
let n =
|
|
89
|
+
function z(e, t) {
|
|
90
|
+
let n = R(e);
|
|
91
91
|
return Math.round(t * n) / n;
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function ne(e, t, n) {
|
|
94
94
|
n === void 0 && (n = {});
|
|
95
|
-
let r = n.whileElementsMounted, i = (0,
|
|
95
|
+
let r = n.whileElementsMounted, i = (0, A.computed)(() => L(n.open) ?? !0), a = (0, A.computed)(() => L(n.middleware)), o = (0, A.computed)(() => L(n.placement) ?? "bottom"), s = (0, A.computed)(() => L(n.strategy) ?? "absolute"), c = (0, A.computed)(() => L(n.transform) ?? !0), l = (0, A.computed)(() => I(e.value)), u = (0, A.computed)(() => I(t.value)), d = (0, A.ref)(0), f = (0, A.ref)(0), p = (0, A.ref)(s.value), m = (0, A.ref)(o.value), h = (0, A.shallowRef)({}), _ = (0, A.ref)(!1), ee = (0, A.computed)(() => {
|
|
96
96
|
let e = {
|
|
97
97
|
position: p.value,
|
|
98
98
|
left: "0",
|
|
99
99
|
top: "0"
|
|
100
100
|
};
|
|
101
101
|
if (!u.value) return e;
|
|
102
|
-
let t =
|
|
102
|
+
let t = z(u.value, d.value), n = z(u.value, f.value);
|
|
103
103
|
return c.value ? {
|
|
104
104
|
...e,
|
|
105
105
|
transform: "translate(" + t + "px, " + n + "px)",
|
|
106
|
-
...
|
|
106
|
+
...R(u.value) >= 1.5 && { willChange: "transform" }
|
|
107
107
|
} : {
|
|
108
108
|
position: p.value,
|
|
109
109
|
left: t + "px",
|
|
110
110
|
top: n + "px"
|
|
111
111
|
};
|
|
112
|
-
}),
|
|
113
|
-
function
|
|
112
|
+
}), v;
|
|
113
|
+
function y() {
|
|
114
114
|
if (l.value == null || u.value == null) return;
|
|
115
115
|
let e = i.value;
|
|
116
116
|
g(l.value, u.value, {
|
|
@@ -121,67 +121,73 @@ function re(e, t, n) {
|
|
|
121
121
|
d.value = t.x, f.value = t.y, p.value = t.strategy, m.value = t.placement, h.value = t.middlewareData, _.value = e !== !1;
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
|
-
function
|
|
125
|
-
typeof
|
|
124
|
+
function b() {
|
|
125
|
+
typeof v == "function" && (v(), v = void 0);
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
if (
|
|
129
|
-
|
|
127
|
+
function x() {
|
|
128
|
+
if (b(), r === void 0) {
|
|
129
|
+
y();
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
132
|
if (l.value != null && u.value != null) {
|
|
133
|
-
|
|
133
|
+
v = r(l.value, u.value, y);
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function S() {
|
|
138
138
|
i.value || (_.value = !1);
|
|
139
139
|
}
|
|
140
|
-
return (0,
|
|
140
|
+
return (0, A.watch)([
|
|
141
141
|
a,
|
|
142
142
|
o,
|
|
143
143
|
s,
|
|
144
144
|
i
|
|
145
|
-
],
|
|
146
|
-
x: (0,
|
|
147
|
-
y: (0,
|
|
148
|
-
strategy: (0,
|
|
149
|
-
placement: (0,
|
|
150
|
-
middlewareData: (0,
|
|
151
|
-
isPositioned: (0,
|
|
152
|
-
floatingStyles:
|
|
153
|
-
update:
|
|
145
|
+
], y, { flush: "sync" }), (0, A.watch)([l, u], x, { flush: "sync" }), (0, A.watch)(i, S, { flush: "sync" }), (0, A.getCurrentScope)() && (0, A.onScopeDispose)(b), {
|
|
146
|
+
x: (0, A.shallowReadonly)(d),
|
|
147
|
+
y: (0, A.shallowReadonly)(f),
|
|
148
|
+
strategy: (0, A.shallowReadonly)(p),
|
|
149
|
+
placement: (0, A.shallowReadonly)(m),
|
|
150
|
+
middlewareData: (0, A.shallowReadonly)(h),
|
|
151
|
+
isPositioned: (0, A.shallowReadonly)(_),
|
|
152
|
+
floatingStyles: ee,
|
|
153
|
+
update: y
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
156
|
//#endregion
|
|
157
|
-
//#region ../ccui/ui/shared/
|
|
158
|
-
var
|
|
159
|
-
function
|
|
160
|
-
|
|
161
|
-
z.has(r) || (z.add(r), typeof console < "u" && console.warn(`[ccui][${e}] ${t} 已 deprecated,请改用 ${n}。`));
|
|
157
|
+
//#region ../ccui/ui/shared/utils/deprecated.ts
|
|
158
|
+
var B = /* @__PURE__ */ new Set();
|
|
159
|
+
function re() {
|
|
160
|
+
return globalThis.process?.env?.NODE_ENV !== "production";
|
|
162
161
|
}
|
|
163
162
|
function V(e, t, n) {
|
|
163
|
+
if (!re()) return;
|
|
164
|
+
let r = n ? `${n}.${e}` : e;
|
|
165
|
+
if (B.has(r) || (B.add(r), typeof console > "u")) return;
|
|
166
|
+
let i = n ? `[ccui][${n}]` : "[ccui]", a = t ? `,请改用 ${t}` : "";
|
|
167
|
+
console.warn(`${i} ${e} 已 deprecated${a}。`);
|
|
168
|
+
}
|
|
169
|
+
function H(e, t, n) {
|
|
164
170
|
return e ? Object.prototype.hasOwnProperty.call(e, t) || Object.prototype.hasOwnProperty.call(e, n) : !1;
|
|
165
171
|
}
|
|
166
172
|
//#endregion
|
|
167
173
|
//#region ../ccui/ui/shared/hooks/use-namespace.ts
|
|
168
|
-
function
|
|
174
|
+
function U(e, t, n) {
|
|
169
175
|
let r = e;
|
|
170
176
|
return t && (r += `__${t}`), n && (r += `--${n}`), r;
|
|
171
177
|
}
|
|
172
|
-
function
|
|
178
|
+
function W(e, t = !1) {
|
|
173
179
|
let n = t ? `.ccui-${e}` : `ccui-${e}`;
|
|
174
180
|
return {
|
|
175
|
-
b: () =>
|
|
176
|
-
e: (e) => e ?
|
|
177
|
-
m: (e) => e ?
|
|
178
|
-
em: (e, t) => e && t ?
|
|
181
|
+
b: () => U(n),
|
|
182
|
+
e: (e) => e ? U(n, e) : "",
|
|
183
|
+
m: (e) => e ? U(n, "", e) : "",
|
|
184
|
+
em: (e, t) => e && t ? U(n, e, t) : "",
|
|
179
185
|
is: (e) => `is-${e}`
|
|
180
186
|
};
|
|
181
187
|
}
|
|
182
188
|
//#endregion
|
|
183
189
|
//#region ../ccui/ui/popover/src/popover-types.ts
|
|
184
|
-
var
|
|
190
|
+
var G = {
|
|
185
191
|
title: {
|
|
186
192
|
type: String,
|
|
187
193
|
default: ""
|
|
@@ -202,10 +208,6 @@ var W = {
|
|
|
202
208
|
type: Boolean,
|
|
203
209
|
default: void 0
|
|
204
210
|
},
|
|
205
|
-
open: {
|
|
206
|
-
type: Boolean,
|
|
207
|
-
default: void 0
|
|
208
|
-
},
|
|
209
211
|
color: {
|
|
210
212
|
type: String,
|
|
211
213
|
default: ""
|
|
@@ -329,51 +331,58 @@ var W = {
|
|
|
329
331
|
triggerKeys: {
|
|
330
332
|
type: Array,
|
|
331
333
|
default: () => ["Enter", " "]
|
|
334
|
+
},
|
|
335
|
+
role: {
|
|
336
|
+
type: String,
|
|
337
|
+
default: "dialog"
|
|
338
|
+
},
|
|
339
|
+
ariaHasPopup: {
|
|
340
|
+
type: String,
|
|
341
|
+
default: "dialog"
|
|
332
342
|
}
|
|
333
343
|
};
|
|
334
344
|
//#endregion
|
|
335
345
|
//#region ../ccui/ui/popover/src/popover.tsx
|
|
336
|
-
function
|
|
346
|
+
function K(e) {
|
|
337
347
|
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !s(e);
|
|
338
348
|
}
|
|
339
349
|
function ie(e) {
|
|
340
350
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
341
351
|
}
|
|
342
|
-
var ae = 0,
|
|
352
|
+
var ae = 0, q = /* @__PURE__ */ a({
|
|
343
353
|
name: "CPopover",
|
|
344
|
-
props:
|
|
354
|
+
props: G,
|
|
345
355
|
emits: [
|
|
346
356
|
"before-show",
|
|
347
357
|
"show",
|
|
348
358
|
"before-hide",
|
|
349
359
|
"hide",
|
|
350
360
|
"update:visible",
|
|
351
|
-
"update:open",
|
|
352
361
|
"before-enter",
|
|
353
362
|
"after-enter",
|
|
354
363
|
"before-leave",
|
|
355
364
|
"after-leave"
|
|
356
365
|
],
|
|
357
366
|
setup(e, { emit: a, slots: s, expose: m }) {
|
|
358
|
-
let g =
|
|
359
|
-
|
|
360
|
-
let
|
|
367
|
+
let g = W("popover"), y = `${g.e("popper")}-${++ae}`, b = `${y}-title`, x = r(() => !!s.title || !!e.title), S = o()?.vnode.props;
|
|
368
|
+
H(S, "showArrow", "show-arrow") && V("showArrow", "arrow", "Popover"), H(S, "showAfter", "show-after") && V("showAfter", "mouseEnterDelay", "Popover"), H(S, "hideAfter", "hide-after") && V("hideAfter", "mouseLeaveDelay", "Popover"), H(S, "popperClass", "popper-class") && V("popperClass", "overlayClassName", "Popover"), H(S, "teleported", "teleported") && V("teleported", "getPopupContainer", "Popover");
|
|
369
|
+
let C = f(!1), w = f(), T = f(), E = f(), D = f(), O = f(), k = f(), A = r(() => e.visible), j = r(() => A.value !== void 0), M = r(() => !!(j.value ? A.value : C.value)), N = r(() => e.mouseEnterDelay === void 0 ? e.showAfter : e.mouseEnterDelay), P = r(() => e.mouseLeaveDelay === void 0 ? e.hideAfter : e.mouseLeaveDelay), F = r(() => e.arrow === void 0 ? e.showArrow : typeof e.arrow == "boolean" ? e.arrow : !0), I = r(() => ie(e.arrow) ? !!e.arrow.pointAtCenter : !1), L = r(() => e.overlayClassName || e.popperClass), R = r(() => e.color ? { backgroundColor: e.color } : {}), z = r(() => e.virtualTriggering && e.virtualRef ? e.virtualRef : w.value), B = r(() => [
|
|
361
370
|
g.e("popper"),
|
|
362
371
|
g.em("popper", e.effect),
|
|
363
372
|
g.em("popper", e.placement.split("-")[0]),
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
].filter(Boolean).join(" ")), { floatingStyles:
|
|
373
|
+
I.value && g.em("popper", "arrow-center"),
|
|
374
|
+
L.value
|
|
375
|
+
].filter(Boolean).join(" ")), { floatingStyles: re, middlewareData: U, update: G } = ne(r(() => z.value), T, {
|
|
367
376
|
placement: e.placement,
|
|
368
377
|
middleware: [
|
|
369
|
-
|
|
378
|
+
ee(e.offset),
|
|
370
379
|
...e.autoAdjustOverflow ? [_()] : [],
|
|
371
|
-
|
|
372
|
-
...
|
|
380
|
+
v({ padding: 8 }),
|
|
381
|
+
...F.value ? [te({ element: E })] : []
|
|
373
382
|
]
|
|
374
|
-
}),
|
|
375
|
-
if (!
|
|
376
|
-
let { x: t, y: n } =
|
|
383
|
+
}), q = r(() => {
|
|
384
|
+
if (!F.value || !U.value.arrow) return {};
|
|
385
|
+
let { x: t, y: n } = U.value.arrow, r = {
|
|
377
386
|
top: "bottom",
|
|
378
387
|
right: "left",
|
|
379
388
|
bottom: "top",
|
|
@@ -386,118 +395,126 @@ var ae = 0, K = /* @__PURE__ */ a({
|
|
|
386
395
|
bottom: "",
|
|
387
396
|
[r]: "-4px"
|
|
388
397
|
};
|
|
389
|
-
}),
|
|
390
|
-
|
|
391
|
-
},
|
|
392
|
-
|
|
398
|
+
}), J = () => {
|
|
399
|
+
D.value &&= (clearTimeout(D.value), void 0), O.value &&= (clearTimeout(O.value), void 0), k.value &&= (clearTimeout(k.value), void 0);
|
|
400
|
+
}, Y = () => {
|
|
401
|
+
J();
|
|
393
402
|
let t = () => {
|
|
394
|
-
a("before-hide"),
|
|
403
|
+
a("before-hide"), j.value || (C.value = !1), a("update:visible", !1), a("hide");
|
|
395
404
|
};
|
|
396
|
-
|
|
397
|
-
},
|
|
405
|
+
P.value > 0 && e.trigger !== "click" ? O.value = window.setTimeout(t, P.value) : t();
|
|
406
|
+
}, X = () => {
|
|
398
407
|
if (e.disabled) return;
|
|
399
|
-
|
|
408
|
+
J();
|
|
400
409
|
let t = () => {
|
|
401
|
-
a("before-show"),
|
|
402
|
-
|
|
403
|
-
|
|
410
|
+
a("before-show"), j.value || (C.value = !0), a("update:visible", !0), l(() => {
|
|
411
|
+
G(), a("show"), e.autoClose > 0 && (k.value = window.setTimeout(() => {
|
|
412
|
+
Y();
|
|
404
413
|
}, e.autoClose));
|
|
405
414
|
});
|
|
406
415
|
};
|
|
407
|
-
|
|
408
|
-
}, Y = () => {
|
|
409
|
-
e.trigger === "hover" && J();
|
|
410
|
-
}, X = () => {
|
|
411
|
-
e.trigger === "hover" && q();
|
|
416
|
+
N.value > 0 ? D.value = window.setTimeout(t, N.value) : t();
|
|
412
417
|
}, oe = () => {
|
|
413
|
-
e.trigger === "
|
|
414
|
-
}, se = (
|
|
415
|
-
e.trigger === "
|
|
418
|
+
e.trigger === "hover" && X();
|
|
419
|
+
}, se = () => {
|
|
420
|
+
e.trigger === "hover" && Y();
|
|
416
421
|
}, ce = () => {
|
|
417
|
-
e.trigger === "
|
|
418
|
-
}, le = () => {
|
|
419
|
-
e.trigger === "
|
|
420
|
-
}, ue = (
|
|
422
|
+
e.trigger === "click" && (M.value ? Y() : X());
|
|
423
|
+
}, le = (t) => {
|
|
424
|
+
e.trigger === "contextmenu" && (t.preventDefault(), M.value ? Y() : X());
|
|
425
|
+
}, ue = () => {
|
|
426
|
+
e.trigger === "focus" && X();
|
|
427
|
+
}, de = () => {
|
|
428
|
+
e.trigger === "focus" && Y();
|
|
429
|
+
}, fe = (e) => {
|
|
421
430
|
if (!e) return e;
|
|
422
431
|
let t = e.toLowerCase();
|
|
423
432
|
return e === " " || t === "space" || t === "spacebar" ? "Space" : e;
|
|
424
|
-
},
|
|
433
|
+
}, pe = (t) => {
|
|
425
434
|
if (e.trigger !== "focus") return;
|
|
426
|
-
let n =
|
|
427
|
-
e.triggerKeys.map(
|
|
428
|
-
},
|
|
429
|
-
e.trigger === "hover" && e.enterable &&
|
|
430
|
-
},
|
|
431
|
-
e.trigger === "hover" && e.enterable &&
|
|
432
|
-
},
|
|
433
|
-
if (!
|
|
434
|
-
let n = t.target, r = n instanceof Node ? n : null, i = e.virtualTriggering && e.virtualRef ? e.virtualRef :
|
|
435
|
-
!a && !o &&
|
|
435
|
+
let n = fe(t.key);
|
|
436
|
+
e.triggerKeys.map(fe).includes(n) && (t.preventDefault(), M.value ? Y() : X());
|
|
437
|
+
}, me = () => {
|
|
438
|
+
e.trigger === "hover" && e.enterable && J();
|
|
439
|
+
}, he = () => {
|
|
440
|
+
e.trigger === "hover" && e.enterable && Y();
|
|
441
|
+
}, ge = r(() => [g.b(), e.disabled ? g.m("disabled") : ""].filter(Boolean).join(" ")), Z = (t) => {
|
|
442
|
+
if (!M.value || e.trigger === "manual" || !e.hideOnClickOutside) return;
|
|
443
|
+
let n = t.target, r = n instanceof Node ? n : null, i = e.virtualTriggering && e.virtualRef ? e.virtualRef : w.value, a = !!(r && i && i.contains(r)), o = !!(r && T.value && T.value.contains(r));
|
|
444
|
+
!a && !o && Y();
|
|
436
445
|
}, Q = (t) => {
|
|
437
|
-
|
|
446
|
+
M.value && e.trigger !== "manual" && e.closeOnEsc && t.key === "Escape" && Y();
|
|
438
447
|
}, $;
|
|
439
448
|
u(() => {
|
|
440
449
|
e.visible && l(() => {
|
|
441
|
-
let e =
|
|
442
|
-
e &&
|
|
450
|
+
let e = z.value;
|
|
451
|
+
e && T.value && ($ = h(e, T.value, G)), window.addEventListener("mousedown", Z, !0), window.addEventListener("keydown", Q, !0);
|
|
443
452
|
});
|
|
444
453
|
}), d(() => {
|
|
445
|
-
if (
|
|
454
|
+
if (J(), $?.(), window.removeEventListener("mousedown", Z, !0), window.removeEventListener("keydown", Q, !0), e.virtualTriggering && e.virtualRef) {
|
|
446
455
|
let t = e.virtualRef;
|
|
447
|
-
t.removeEventListener("mouseenter",
|
|
456
|
+
t.removeEventListener("mouseenter", oe), t.removeEventListener("mouseleave", se), t.removeEventListener("click", ce), t.removeEventListener("focus", ue), t.removeEventListener("blur", de), t.removeEventListener("keydown", pe), t.removeEventListener("contextmenu", le);
|
|
448
457
|
}
|
|
449
|
-
}), p(
|
|
450
|
-
if (
|
|
458
|
+
}), p(A, (e) => {
|
|
459
|
+
if (j.value) {
|
|
451
460
|
let t = !!e;
|
|
452
|
-
t !==
|
|
461
|
+
t !== C.value && (C.value = t, t && l(() => G()));
|
|
453
462
|
}
|
|
454
|
-
}), p(
|
|
463
|
+
}), p(M, (e) => {
|
|
455
464
|
if (e) {
|
|
456
|
-
let e =
|
|
457
|
-
e &&
|
|
465
|
+
let e = z.value;
|
|
466
|
+
e && T.value && ($?.(), $ = h(e, T.value, G)), window.addEventListener("mousedown", Z, !0), window.addEventListener("keydown", Q, !0);
|
|
458
467
|
} else $?.(), window.removeEventListener("mousedown", Z, !0), window.removeEventListener("keydown", Q, !0);
|
|
459
468
|
});
|
|
460
|
-
let
|
|
461
|
-
ref:
|
|
469
|
+
let _e = () => F.value ? i("div", {
|
|
470
|
+
ref: E,
|
|
462
471
|
class: [g.e("arrow"), g.em("arrow", e.placement.split("-")[0])].join(" "),
|
|
463
|
-
style:
|
|
464
|
-
}, null) : null,
|
|
472
|
+
style: q.value
|
|
473
|
+
}, null) : null, ve = () => {
|
|
465
474
|
let t = !!s.title, n = !!e.title;
|
|
466
|
-
return !t && !n ? null : i("div", {
|
|
467
|
-
|
|
468
|
-
|
|
475
|
+
return !t && !n ? null : i("div", {
|
|
476
|
+
class: g.e("header"),
|
|
477
|
+
id: b
|
|
478
|
+
}, [s.title ? s.title() : e.title]);
|
|
479
|
+
}, ye = () => e.rawContent ? i("div", { innerHTML: e.content }, null) : s.content ? s.content() : e.content;
|
|
480
|
+
return m({ hide: Y }), () => {
|
|
469
481
|
let r = {};
|
|
470
|
-
e.virtualTriggering || (e.trigger === "hover" ? (r.onMouseenter =
|
|
482
|
+
e.virtualTriggering || (e.trigger === "hover" ? (r.onMouseenter = oe, r.onMouseleave = se) : e.trigger === "click" ? r.onClick = ce : e.trigger === "focus" ? (r.onFocus = ue, r.onBlur = de, r.onKeydown = pe) : e.trigger === "contextmenu" && (r.onContextmenu = le));
|
|
471
483
|
let o = i("div", {
|
|
472
|
-
ref:
|
|
473
|
-
class:
|
|
474
|
-
role:
|
|
475
|
-
id:
|
|
484
|
+
ref: T,
|
|
485
|
+
class: B.value,
|
|
486
|
+
role: e.role,
|
|
487
|
+
id: y,
|
|
488
|
+
"aria-labelledby": x.value ? b : void 0,
|
|
489
|
+
"aria-label": !x.value && e.ariaLabel ? e.ariaLabel : void 0,
|
|
476
490
|
style: {
|
|
491
|
+
...re.value,
|
|
477
492
|
...R.value,
|
|
478
|
-
...F.value,
|
|
479
493
|
zIndex: 2e3,
|
|
480
494
|
pointerEvents: e.enterable ? "auto" : "none",
|
|
481
495
|
width: e.width || void 0
|
|
482
496
|
},
|
|
483
|
-
onMouseenter:
|
|
484
|
-
onMouseleave:
|
|
497
|
+
onMouseenter: me,
|
|
498
|
+
onMouseleave: he
|
|
485
499
|
}, [
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
i("div", { class: g.e("content") }, [
|
|
500
|
+
_e(),
|
|
501
|
+
ve(),
|
|
502
|
+
i("div", { class: g.e("content") }, [ye()])
|
|
489
503
|
]), l = () => {
|
|
490
504
|
if (e.getPopupContainer) {
|
|
491
|
-
let n = e.getPopupContainer(
|
|
492
|
-
return n ? i(t, { to: n },
|
|
505
|
+
let n = e.getPopupContainer(w.value ?? null);
|
|
506
|
+
return n ? i(t, { to: n }, K(o) ? o : { default: () => [o] }) : o;
|
|
493
507
|
}
|
|
494
|
-
return e.teleported ? i(t, { to: "body" },
|
|
508
|
+
return e.teleported ? i(t, { to: "body" }, K(o) ? o : { default: () => [o] }) : o;
|
|
495
509
|
};
|
|
496
|
-
return i("div", { class:
|
|
510
|
+
return i("div", { class: ge.value }, [
|
|
497
511
|
!e.virtualTriggering && i("div", c({
|
|
498
|
-
ref:
|
|
512
|
+
ref: w,
|
|
499
513
|
class: g.e("trigger"),
|
|
500
|
-
"aria-describedby":
|
|
514
|
+
"aria-describedby": M.value ? y : void 0,
|
|
515
|
+
"aria-haspopup": e.ariaHasPopup,
|
|
516
|
+
"aria-expanded": M.value ? "true" : "false",
|
|
517
|
+
"aria-controls": M.value ? y : void 0,
|
|
501
518
|
"aria-label": e.ariaLabel,
|
|
502
519
|
tabindex: e.trigger === "focus" ? e.tabindex : void 0
|
|
503
520
|
}, r), [s.default?.()]),
|
|
@@ -508,11 +525,11 @@ var ae = 0, K = /* @__PURE__ */ a({
|
|
|
508
525
|
onAfterEnter: () => a("after-enter"),
|
|
509
526
|
onBeforeLeave: () => a("before-leave"),
|
|
510
527
|
onAfterLeave: () => a("after-leave")
|
|
511
|
-
}, { default: () => [
|
|
528
|
+
}, { default: () => [M.value && l()] })
|
|
512
529
|
]);
|
|
513
530
|
};
|
|
514
531
|
}
|
|
515
|
-
}),
|
|
532
|
+
}), J = /* @__PURE__ */ a({
|
|
516
533
|
name: "CDropdown",
|
|
517
534
|
props: {
|
|
518
535
|
items: {
|
|
@@ -550,14 +567,14 @@ var ae = 0, K = /* @__PURE__ */ a({
|
|
|
550
567
|
"visible-change"
|
|
551
568
|
],
|
|
552
569
|
setup(e, { emit: t, slots: n }) {
|
|
553
|
-
let a =
|
|
570
|
+
let a = W("dropdown"), o = f(null), s = f(!1), c = r(() => e.visible !== void 0), l = r(() => c.value ? e.visible : s.value);
|
|
554
571
|
p(() => e.visible, (e) => {
|
|
555
572
|
e !== void 0 && (s.value = !!e);
|
|
556
573
|
});
|
|
557
574
|
let u = (n) => {
|
|
558
575
|
n.disabled || (t("select", n), e.hideOnClick && (c.value || (s.value = !1), t("update:visible", !1), t("visible-change", !1), o.value?.hide?.()));
|
|
559
576
|
};
|
|
560
|
-
return () => i(
|
|
577
|
+
return () => i(q, {
|
|
561
578
|
ref: o,
|
|
562
579
|
trigger: e.trigger,
|
|
563
580
|
placement: e.placement,
|
|
@@ -567,15 +584,14 @@ var ae = 0, K = /* @__PURE__ */ a({
|
|
|
567
584
|
offset: 4,
|
|
568
585
|
popperClass: a.b(),
|
|
569
586
|
width: e.width,
|
|
587
|
+
role: "menu",
|
|
588
|
+
ariaHasPopup: "menu",
|
|
570
589
|
"onUpdate:visible": (e) => {
|
|
571
590
|
c.value || (s.value = e), t("update:visible", e), t("visible-change", e);
|
|
572
591
|
}
|
|
573
592
|
}, {
|
|
574
593
|
default: () => n.default?.(),
|
|
575
|
-
content: () => i("ul", {
|
|
576
|
-
class: a.e("menu"),
|
|
577
|
-
role: "menu"
|
|
578
|
-
}, [n.menu ? n.menu({ select: u }) : e.items.map((e) => i("li", {
|
|
594
|
+
content: () => i("ul", { class: a.e("menu") }, [n.menu ? n.menu({ select: u }) : e.items.map((e) => i("li", {
|
|
579
595
|
key: e.key,
|
|
580
596
|
class: [
|
|
581
597
|
a.e("item"),
|
|
@@ -591,16 +607,16 @@ var ae = 0, K = /* @__PURE__ */ a({
|
|
|
591
607
|
});
|
|
592
608
|
//#endregion
|
|
593
609
|
//#region ../ccui/ui/dropdown/index.ts
|
|
594
|
-
|
|
595
|
-
e.component(
|
|
610
|
+
J.install = function(e) {
|
|
611
|
+
e.component(J.name, J);
|
|
596
612
|
};
|
|
597
|
-
var
|
|
613
|
+
var Y = {
|
|
598
614
|
title: "Dropdown 下拉菜单",
|
|
599
615
|
category: "导航",
|
|
600
616
|
status: "100%",
|
|
601
617
|
install(e) {
|
|
602
|
-
e.component(
|
|
618
|
+
e.component(J.name, J);
|
|
603
619
|
}
|
|
604
620
|
};
|
|
605
621
|
//#endregion
|
|
606
|
-
export {
|
|
622
|
+
export { J as Dropdown, Y as default };
|