@vavt/react-ui 1.0.4 → 1.2.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/dist/{Anchor-QZROepM_.js → Anchor-CAZPkv56.js} +1 -1
- package/dist/{Anchor-iriRYxEs.cjs → Anchor-CmuV1Ump.cjs} +1 -1
- package/dist/{Announcement-XjJyJ28N.cjs → Announcement-D0hZE2sM.cjs} +1 -1
- package/dist/{Announcement-D_NccvTm.js → Announcement-DzzaTvcO.js} +1 -1
- package/dist/Checkbox-CBMmX-R-.js +86 -0
- package/dist/Checkbox-CzNGP2tH.cjs +1 -0
- package/dist/Checkbox-GJlGNzlH.cjs +1 -0
- package/dist/Checkbox-bHOjYdMp.js +61 -0
- package/dist/{Cron-Go4yIqrd.js → Cron-DIB4GG4y.js} +7 -7
- package/dist/{Cron-3D9GmlYf.cjs → Cron-MhbYMEeJ.cjs} +1 -1
- package/dist/{DatePicker-B-F5q_s_.js → DatePicker--13tW0cw.js} +1 -1
- package/dist/{DatePicker-CoHW85qm.cjs → DatePicker-Bj709smn.cjs} +1 -1
- package/dist/{DateTimePicker-BSBZZ7xV.js → DateTimePicker-Blqs2Bcv.js} +1 -1
- package/dist/{DateTimePicker-CAkdoY--.cjs → DateTimePicker-ZSScsk-j.cjs} +1 -1
- package/dist/{Drawer-D45miZ27.cjs → Drawer-DcbgMkub.cjs} +1 -1
- package/dist/{Drawer-C0toQ-fQ.js → Drawer-yM_r1M0H.js} +2 -2
- package/dist/{Dropdown-BsXYVdt6.cjs → Dropdown-PHqXNiAZ.cjs} +1 -1
- package/dist/{Dropdown-DljKFnvO.js → Dropdown-mYCY-LcF.js} +2 -2
- package/dist/Form-BkyDHPEI.cjs +1 -0
- package/dist/Form-D_Uv-8HG.js +449 -0
- package/dist/{Input-CIB_TY2n.js → Input-BRy5Xuwy.js} +28 -37
- package/dist/Input-C9ESmbJ7.cjs +1 -0
- package/dist/{MessageBox-CTJfdU29.cjs → MessageBox-BSMYQenX.cjs} +1 -1
- package/dist/{MessageBox-B4Qo1vs2.js → MessageBox-DipOfKXI.js} +2 -2
- package/dist/Modal-BOI8r4y1.cjs +1 -0
- package/dist/Modal-De9igZ5e.js +238 -0
- package/dist/{NumberInput-C_vLULbX.js → NumberInput-CB-nKZgs.js} +1 -1
- package/dist/{NumberInput-CYVj89_s.cjs → NumberInput-Dp1vTDkW.cjs} +1 -1
- package/dist/{Pagination-CSI5IzQB.js → Pagination-CpbboRbF.js} +2 -2
- package/dist/{Pagination-ODU-i3gn.cjs → Pagination-DatEegaF.cjs} +1 -1
- package/dist/RadioGroup-DTodR0VJ.cjs +1 -0
- package/dist/RadioGroup-DYjQMXdB.js +136 -0
- package/dist/Select-BHWa_6Q2.js +466 -0
- package/dist/Select-C6O0tmM_.cjs +1 -0
- package/dist/{Slider-BzlZc0p4.js → Slider-CKU03SsT.js} +1 -1
- package/dist/{Slider-DCIUxcBa.cjs → Slider-CU9OS2HB.cjs} +1 -1
- package/dist/{Switch-7yJ-Q_o_.cjs → Switch-CpXDMcPW.cjs} +1 -1
- package/dist/{Switch-DOO2tiYR.js → Switch-CqTFvp-k.js} +1 -1
- package/dist/Table-BNGO_7Rx.cjs +1 -0
- package/dist/Table-Cfs3XJgN.js +531 -0
- package/dist/{Tabs-BhjvKN84.cjs → Tabs-BZ0Zc0bL.cjs} +1 -1
- package/dist/{Tabs-VT6nQ63W.js → Tabs-HWLkyrQR.js} +1 -1
- package/dist/{Textarea-BEd7ToXv.js → Textarea-CA6Vzu7t.js} +1 -1
- package/dist/{Textarea-C2dNYM0F.cjs → Textarea-CEhAvE10.cjs} +1 -1
- package/dist/{TimePicker-CHZsr_jj.js → TimePicker-CYlcUTTM.js} +2 -2
- package/dist/{TimePicker-Cpmvn8tx.cjs → TimePicker-DoGbwfkU.cjs} +1 -1
- package/dist/{Tooltip-Buk5F9f_.js → Tooltip-BKPreZML.js} +2 -2
- package/dist/{Tooltip-CP8rpNYG.cjs → Tooltip-DDjGLjoV.cjs} +1 -1
- package/dist/{Upload-DZC_bt6G.js → Upload-DZ6VaM7r.js} +66 -65
- package/dist/Upload-wHEEoe1c.cjs +1 -0
- package/dist/base.css +1 -1
- package/dist/cjs/Anchor.cjs +1 -1
- package/dist/cjs/Announcement.cjs +1 -1
- package/dist/cjs/Checkbox.cjs +1 -1
- package/dist/cjs/Cron.cjs +1 -1
- package/dist/cjs/DatePicker.cjs +1 -1
- package/dist/cjs/DateTimePicker.cjs +1 -1
- package/dist/cjs/Drawer.cjs +1 -1
- package/dist/cjs/Dropdown.cjs +1 -1
- package/dist/cjs/Form.cjs +1 -1
- package/dist/cjs/Input.cjs +1 -1
- package/dist/cjs/MessageBox.cjs +1 -1
- package/dist/cjs/Modal.cjs +1 -1
- package/dist/cjs/NumberInput.cjs +1 -1
- package/dist/cjs/Pagination.cjs +1 -1
- package/dist/cjs/Radio.cjs +1 -1
- package/dist/cjs/Select.cjs +1 -1
- package/dist/cjs/Slider.cjs +1 -1
- package/dist/cjs/Switch.cjs +1 -1
- package/dist/cjs/Table.cjs +1 -1
- package/dist/cjs/Tabs.cjs +1 -1
- package/dist/cjs/Textarea.cjs +1 -1
- package/dist/cjs/TimePicker.cjs +1 -1
- package/dist/cjs/Tooltip.cjs +1 -1
- package/dist/cjs/Upload.cjs +1 -1
- package/dist/cjs/global.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/register.cjs +1 -1
- package/dist/css/Alert.css +1 -1
- package/dist/css/Announcement.css +1 -1
- package/dist/css/Button.css +1 -1
- package/dist/css/Card.css +1 -1
- package/dist/css/Checkbox.css +1 -1
- package/dist/css/Cron.css +1 -1
- package/dist/css/DatePicker.css +1 -1
- package/dist/css/DateTimePicker.css +1 -1
- package/dist/css/Drawer.css +1 -1
- package/dist/css/Dropdown.css +1 -1
- package/dist/css/Empty.css +1 -1
- package/dist/css/Form.css +1 -1
- package/dist/css/Input.css +1 -1
- package/dist/css/MessageBox.css +1 -1
- package/dist/css/Modal.css +1 -1
- package/dist/css/NumberInput.css +1 -1
- package/dist/css/Progress.css +1 -1
- package/dist/css/Radio.css +1 -1
- package/dist/css/Select.css +1 -1
- package/dist/css/Sidebar.css +1 -1
- package/dist/css/Switch.css +1 -1
- package/dist/css/Tag.css +1 -1
- package/dist/css/Textarea.css +1 -1
- package/dist/css/TimePicker.css +1 -1
- package/dist/css/Tooltip.css +1 -1
- package/dist/css/Upload.css +1 -1
- package/dist/date-picker-Be_1wA3S.cjs +1 -0
- package/dist/date-picker-CHP0eBuL.js +612 -0
- package/dist/{dialog-shell-DehX3PNh.js → dialog-shell-CdYlPT9f.js} +12 -12
- package/dist/dialog-shell-CzeGytVj.cjs +1 -0
- package/dist/es/Anchor.mjs +1 -1
- package/dist/es/Announcement.mjs +1 -1
- package/dist/es/Checkbox.mjs +1 -1
- package/dist/es/Cron.mjs +1 -1
- package/dist/es/DatePicker.mjs +1 -1
- package/dist/es/DateTimePicker.mjs +1 -1
- package/dist/es/Drawer.mjs +1 -1
- package/dist/es/Dropdown.mjs +1 -1
- package/dist/es/Form.mjs +1 -1
- package/dist/es/Input.mjs +1 -1
- package/dist/es/MessageBox.mjs +1 -1
- package/dist/es/Modal.mjs +1 -1
- package/dist/es/NumberInput.mjs +1 -1
- package/dist/es/Pagination.mjs +1 -1
- package/dist/es/Radio.mjs +1 -1
- package/dist/es/Select.mjs +1 -1
- package/dist/es/Slider.mjs +1 -1
- package/dist/es/Switch.mjs +1 -1
- package/dist/es/Table.mjs +1 -1
- package/dist/es/Tabs.mjs +1 -1
- package/dist/es/Textarea.mjs +1 -1
- package/dist/es/TimePicker.mjs +1 -1
- package/dist/es/Tooltip.mjs +1 -1
- package/dist/es/Upload.mjs +1 -1
- package/dist/es/global.mjs +1 -1
- package/dist/es/index.mjs +32 -32
- package/dist/es/register.mjs +1 -1
- package/dist/floating-5PRFyI8D.cjs +1 -0
- package/dist/floating-CqdcJWk2.js +181 -0
- package/dist/index.css +1 -1
- package/dist/registry-BLaletUC.js +83 -0
- package/dist/registry-hU7S5myb.cjs +1 -0
- package/dist/state-BSDh-Ob2.js +22 -0
- package/dist/state-BuUx1onZ.cjs +1 -0
- package/dist/style/Form.cjs +1 -0
- package/dist/style/Form.mjs +1 -0
- package/dist/style/Modal.cjs +1 -0
- package/dist/style/Modal.mjs +1 -0
- package/dist/types/Checkbox/context.d.cts +12 -2
- package/dist/types/Checkbox/context.d.ts +12 -2
- package/dist/types/Checkbox/type.d.cts +33 -3
- package/dist/types/Checkbox/type.d.ts +33 -3
- package/dist/types/Form/FormItem.d.cts +1 -1
- package/dist/types/Form/FormItem.d.ts +1 -1
- package/dist/types/Form/context.d.cts +31 -0
- package/dist/types/Form/context.d.ts +31 -0
- package/dist/types/Form/index.d.cts +2 -2
- package/dist/types/Form/index.d.ts +2 -2
- package/dist/types/Form/type.d.cts +1 -1
- package/dist/types/Form/type.d.ts +1 -1
- package/dist/types/Modal/type.d.cts +3 -3
- package/dist/types/Modal/type.d.ts +3 -3
- package/dist/types/Radio/context.d.cts +12 -2
- package/dist/types/Radio/context.d.ts +12 -2
- package/dist/types/Radio/type.d.cts +33 -3
- package/dist/types/Radio/type.d.ts +33 -3
- package/dist/types/Upload/type.d.cts +4 -0
- package/dist/types/Upload/type.d.ts +4 -0
- package/dist/types/_shared/state.d.cts +3 -0
- package/dist/types/_shared/state.d.ts +3 -0
- package/dist/types/registry.d.cts +1 -1
- package/dist/types/registry.d.ts +1 -1
- package/package.json +1 -1
- package/dist/Checkbox-BCXbK1-8.cjs +0 -1
- package/dist/Checkbox-CQZSg9Xu.cjs +0 -1
- package/dist/Checkbox-CQeqLO0S.js +0 -46
- package/dist/Checkbox-cnXHW9Oz.js +0 -61
- package/dist/Form-7un_DeDk.cjs +0 -1
- package/dist/Form-CwgaAZWr.js +0 -323
- package/dist/Input-CoDZggqc.cjs +0 -1
- package/dist/Modal-i_Do8GsG.cjs +0 -1
- package/dist/Modal-otJ_9ldu.js +0 -210
- package/dist/RadioGroup-BRcNi5Oc.js +0 -98
- package/dist/RadioGroup-q2Aa50NV.cjs +0 -1
- package/dist/Select-BRKxpX-_.cjs +0 -1
- package/dist/Select-QedbJ4pD.js +0 -468
- package/dist/Table-B9NTkptC.js +0 -440
- package/dist/Table-Bqjey5fw.cjs +0 -1
- package/dist/Upload-bxJz2avf.cjs +0 -1
- package/dist/date-picker-BsiNrLZC.js +0 -592
- package/dist/date-picker-DNN0BiRA.cjs +0 -1
- package/dist/dialog-shell-DT1EoKQG.cjs +0 -1
- package/dist/floating-DBAmeQIq.js +0 -157
- package/dist/floating-DXRnx48N.cjs +0 -1
- package/dist/registry-BGNWNSiC.cjs +0 -1
- package/dist/registry-q6UdMOyj.js +0 -83
- package/dist/state-ZBA75xZ_.cjs +0 -1
- package/dist/state-oH-YwB7_.js +0 -15
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
import { t as e } from "./effect-nifYL_rH.js";
|
|
2
|
+
import { n as t, t as n } from "./state-BSDh-Ob2.js";
|
|
3
|
+
import { n as r } from "./number-BN2jHM6Z.js";
|
|
4
|
+
import { t as i } from "./Tooltip-BKPreZML.js";
|
|
5
|
+
import { t as a } from "./Scrollbar-BdMGZrYi.js";
|
|
6
|
+
import { ChevronDown as o, ChevronUp as s } from "lucide-react";
|
|
7
|
+
import { forwardRef as c, memo as l, useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
8
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
9
|
+
//#region components/Table/Table.tsx
|
|
10
|
+
var _ = (e, t) => e.length === t.length && e.every((e, n) => Object.is(e, t[n])), v = (e, t) => {
|
|
11
|
+
let n = [...new Set(e)];
|
|
12
|
+
return t === "radio" ? n.slice(0, 1) : n;
|
|
13
|
+
}, y = new class {
|
|
14
|
+
observers = /* @__PURE__ */ new Map();
|
|
15
|
+
resizeObserver = null;
|
|
16
|
+
resizeListenerAttached = !1;
|
|
17
|
+
handleResize = () => {
|
|
18
|
+
this.observers.forEach((e) => e());
|
|
19
|
+
};
|
|
20
|
+
observe(e, t) {
|
|
21
|
+
this.observers.set(e, t), typeof ResizeObserver < "u" && (this.resizeObserver ||= new ResizeObserver((e) => {
|
|
22
|
+
for (let t of e) this.observers.get(t.target)?.();
|
|
23
|
+
}), this.resizeObserver.observe(e)), typeof window < "u" && !this.resizeListenerAttached && (window.addEventListener("resize", this.handleResize, { passive: !0 }), this.resizeListenerAttached = !0);
|
|
24
|
+
}
|
|
25
|
+
unobserve(e) {
|
|
26
|
+
this.observers.delete(e), this.resizeObserver && (this.resizeObserver.unobserve(e), this.observers.size === 0 && (this.resizeObserver.disconnect(), this.resizeObserver = null)), this.observers.size === 0 && typeof window < "u" && this.resizeListenerAttached && (window.removeEventListener("resize", this.handleResize), this.resizeListenerAttached = !1);
|
|
27
|
+
}
|
|
28
|
+
}(), b = l(({ type: t, checked: n, disabled: r = !1, indeterminate: i = !1, ariaLabel: a, onChange: o }) => {
|
|
29
|
+
let s = p(null);
|
|
30
|
+
e(() => {
|
|
31
|
+
s.current && (s.current.indeterminate = t === "checkbox" && i);
|
|
32
|
+
}, [i, t]);
|
|
33
|
+
let c = (e) => e.stopPropagation();
|
|
34
|
+
return /* @__PURE__ */ g("label", {
|
|
35
|
+
className: [
|
|
36
|
+
"vl-table__selection-control",
|
|
37
|
+
`is-${t}`,
|
|
38
|
+
n ? "is-checked" : "",
|
|
39
|
+
i ? "is-indeterminate" : "",
|
|
40
|
+
r ? "is-disabled" : ""
|
|
41
|
+
].filter(Boolean).join(" "),
|
|
42
|
+
onClick: c,
|
|
43
|
+
onDoubleClick: c,
|
|
44
|
+
children: [/* @__PURE__ */ h("input", {
|
|
45
|
+
ref: s,
|
|
46
|
+
className: "vl-table__selection-input",
|
|
47
|
+
type: t,
|
|
48
|
+
checked: n,
|
|
49
|
+
disabled: r,
|
|
50
|
+
"aria-label": a,
|
|
51
|
+
onChange: o
|
|
52
|
+
}), /* @__PURE__ */ h("span", {
|
|
53
|
+
className: "vl-table__selection-indicator",
|
|
54
|
+
"aria-hidden": "true"
|
|
55
|
+
})]
|
|
56
|
+
});
|
|
57
|
+
}), x = l(({ content: t, tooltipContent: n, showTooltip: r }) => {
|
|
58
|
+
let a = p(null), [o, s] = m(!1), c = u(() => {
|
|
59
|
+
let e = a.current;
|
|
60
|
+
if (!e) return;
|
|
61
|
+
let t = e.scrollWidth > e.clientWidth;
|
|
62
|
+
s((e) => e === t ? e : t);
|
|
63
|
+
}, []);
|
|
64
|
+
return e(() => {
|
|
65
|
+
c();
|
|
66
|
+
let e = a.current;
|
|
67
|
+
return e && y.observe(e, c), () => {
|
|
68
|
+
e && y.unobserve(e);
|
|
69
|
+
};
|
|
70
|
+
}, [t, c]), /* @__PURE__ */ h(i, {
|
|
71
|
+
className: "vl-table__ellipsis-tooltip",
|
|
72
|
+
content: n,
|
|
73
|
+
disabled: !o || !r,
|
|
74
|
+
children: /* @__PURE__ */ h("span", {
|
|
75
|
+
ref: a,
|
|
76
|
+
className: "vl-table__ellipsis-content",
|
|
77
|
+
tabIndex: o && r ? 0 : void 0,
|
|
78
|
+
children: t
|
|
79
|
+
})
|
|
80
|
+
});
|
|
81
|
+
}), ee = (e) => {
|
|
82
|
+
let t = {};
|
|
83
|
+
return e.width !== void 0 && (t.width = r(e.width)), e.minWidth !== void 0 && (t.minWidth = r(e.minWidth)), t;
|
|
84
|
+
}, S = (e, t, n, i = "left", a = !1, o = !1, s = []) => {
|
|
85
|
+
let c = { textAlign: i };
|
|
86
|
+
return e.width !== void 0 && (c.width = r(e.width)), e.minWidth !== void 0 && (c.minWidth = r(e.minWidth)), n && a && (c.position = "sticky", c.top = 0, c.zIndex = e.fixed ? 5 : 4), !e.fixed || e.fixed === "right" && o ? c : (c.position = "sticky", c.zIndex = n ? 5 : 2, e.fixed === "left" ? c.left = s[t]?.left ?? 0 : c.right = s[t]?.right ?? 0, c);
|
|
87
|
+
}, C = (e, t, n, r, i) => {
|
|
88
|
+
let a = e.fixed === "right" && n ? void 0 : e.fixed;
|
|
89
|
+
return [
|
|
90
|
+
a ? `is-fixed is-fixed-${a}` : "",
|
|
91
|
+
a === "left" && t === r ? "is-fixed-edge-left" : "",
|
|
92
|
+
a === "right" && t === i ? "is-fixed-edge-right" : ""
|
|
93
|
+
];
|
|
94
|
+
}, te = (e, t, n, r, i, a) => [
|
|
95
|
+
"vl-table__header-cell",
|
|
96
|
+
e.headerClass || "",
|
|
97
|
+
e.sorter ? "is-sortable" : "",
|
|
98
|
+
n?.columnKey === e.key ? "is-sorted" : "",
|
|
99
|
+
...C(e, t, r, i, a)
|
|
100
|
+
].filter(Boolean).join(" "), ne = (e, t, n, r, i) => [
|
|
101
|
+
"vl-table__cell",
|
|
102
|
+
e.cellClass || "",
|
|
103
|
+
e.ellipsis ? "is-ellipsis" : "",
|
|
104
|
+
...C(e, t, n, r, i)
|
|
105
|
+
].filter(Boolean).join(" "), re = (e, t, n, r, i) => [
|
|
106
|
+
e ? "vl-table__header-cell" : "vl-table__cell",
|
|
107
|
+
"vl-table__selection-cell",
|
|
108
|
+
...C(t, 0, n, r, i)
|
|
109
|
+
].filter(Boolean).join(" "), ie = (e, t) => [
|
|
110
|
+
"vl-table__sort-icons",
|
|
111
|
+
t?.columnKey === e.key && t.order === "asc" ? "is-asc" : "",
|
|
112
|
+
t?.columnKey === e.key && t.order === "desc" ? "is-desc" : ""
|
|
113
|
+
].filter(Boolean).join(" "), ae = (e, t) => {
|
|
114
|
+
if (e.sorter) return t?.columnKey === e.key ? t.order === "asc" ? "ascending" : "descending" : "none";
|
|
115
|
+
}, w = l(({ row: e, rowIndex: t, rowKey: n, selected: r, current: i, controlProps: a, selectionType: o, hasRowSelection: s, highlightCurrentRow: c, columns: l, layoutColumns: u, columnOffset: d, fixedOffsets: f, disableFixedRight: p, lastFixedLeftIndex: m, firstFixedRightIndex: _, hasStickyHeader: v, showHeader: y, canFocusRow: ee, onRowClick: C, onRowDoubleClick: te, onCellClick: ie, onToggleSelection: ae, onMeasureCell: w }) => {
|
|
116
|
+
let oe = s ? r : c ? i : void 0, T = () => {
|
|
117
|
+
C?.(e, t);
|
|
118
|
+
}, E = () => {
|
|
119
|
+
te?.(e, t);
|
|
120
|
+
}, se = (n) => {
|
|
121
|
+
(n.key === "Enter" || n.key === " ") && (n.preventDefault(), C?.(e, t));
|
|
122
|
+
}, D = () => {
|
|
123
|
+
ae(n);
|
|
124
|
+
}, O = (n) => {
|
|
125
|
+
let r = n.render ? n.render(e, t) : e[n.key];
|
|
126
|
+
if (!n.ellipsis) return r;
|
|
127
|
+
let i = typeof n.ellipsis != "object" || n.ellipsis.tooltip, a = i !== !1, o = typeof i == "function" ? i(e, t) : r;
|
|
128
|
+
return /* @__PURE__ */ h(x, {
|
|
129
|
+
content: r,
|
|
130
|
+
tooltipContent: o,
|
|
131
|
+
showTooltip: a
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
return /* @__PURE__ */ g("tr", {
|
|
135
|
+
className: [
|
|
136
|
+
"vl-table__row",
|
|
137
|
+
r ? "is-selected" : "",
|
|
138
|
+
i ? "is-current" : ""
|
|
139
|
+
].filter(Boolean).join(" "),
|
|
140
|
+
tabIndex: ee ? 0 : void 0,
|
|
141
|
+
"aria-selected": oe,
|
|
142
|
+
onClick: T,
|
|
143
|
+
onDoubleClick: E,
|
|
144
|
+
onKeyDown: se,
|
|
145
|
+
children: [s ? /* @__PURE__ */ h("td", {
|
|
146
|
+
ref: (e) => {
|
|
147
|
+
!y && t === 0 && w?.(0, e);
|
|
148
|
+
},
|
|
149
|
+
className: re(!1, u[0], p, m, _),
|
|
150
|
+
style: S(u[0], 0, !1, "center", v, p, f),
|
|
151
|
+
onClick: (e) => e.stopPropagation(),
|
|
152
|
+
onDoubleClick: (e) => e.stopPropagation(),
|
|
153
|
+
children: /* @__PURE__ */ h(b, {
|
|
154
|
+
type: o,
|
|
155
|
+
checked: r,
|
|
156
|
+
disabled: a.disabled,
|
|
157
|
+
ariaLabel: a["aria-label"] ?? `选择第 ${t + 1} 行`,
|
|
158
|
+
onChange: D
|
|
159
|
+
})
|
|
160
|
+
}) : null, l.map((n, r) => {
|
|
161
|
+
let i = r + d;
|
|
162
|
+
return /* @__PURE__ */ h("td", {
|
|
163
|
+
ref: (e) => {
|
|
164
|
+
!y && t === 0 && w?.(i, e);
|
|
165
|
+
},
|
|
166
|
+
className: ne(n, i, p, m, _),
|
|
167
|
+
style: S(n, i, !1, n.align || "left", v, p, f),
|
|
168
|
+
onClick: () => ie?.(e, n, t),
|
|
169
|
+
children: O(n)
|
|
170
|
+
}, n.key);
|
|
171
|
+
})]
|
|
172
|
+
});
|
|
173
|
+
}, (e, t) => {
|
|
174
|
+
if (e.row !== t.row || e.rowIndex !== t.rowIndex || e.rowKey !== t.rowKey || e.selected !== t.selected || e.current !== t.current || e.selectionType !== t.selectionType || e.hasRowSelection !== t.hasRowSelection || e.highlightCurrentRow !== t.highlightCurrentRow || e.canFocusRow !== t.canFocusRow || e.disableFixedRight !== t.disableFixedRight || e.hasStickyHeader !== t.hasStickyHeader || e.showHeader !== t.showHeader || e.columnOffset !== t.columnOffset || e.lastFixedLeftIndex !== t.lastFixedLeftIndex || e.firstFixedRightIndex !== t.firstFixedRightIndex || e.columns !== t.columns || e.layoutColumns !== t.layoutColumns || e.fixedOffsets !== t.fixedOffsets || e.onRowClick !== t.onRowClick || e.onRowDoubleClick !== t.onRowDoubleClick || e.onCellClick !== t.onCellClick || e.onToggleSelection !== t.onToggleSelection || e.onMeasureCell !== t.onMeasureCell) return !1;
|
|
175
|
+
let n = e.controlProps, r = t.controlProps;
|
|
176
|
+
return n === r || n.disabled === r.disabled && n["aria-label"] === r["aria-label"];
|
|
177
|
+
}), oe = ({ renderRows: e, selectedKeySet: t, currentRowKey: n, highlightCurrentRow: r, hasRowSelection: i, selectionType: a, columns: o, layoutColumns: s, columnOffset: c, fixedOffsets: l, disableFixedRight: u, lastFixedLeftIndex: d, firstFixedRightIndex: f, hasStickyHeader: p, showHeader: m, emptyText: g, emptyContent: _, canFocusRow: v, onRowClick: y, onRowDoubleClick: b, onCellClick: x, onToggleSelection: ee, onMeasureCell: S }) => /* @__PURE__ */ h("tbody", {
|
|
178
|
+
className: "vl-table__body",
|
|
179
|
+
children: e.length > 0 ? e.map(({ row: e, index: g, key: _, controlProps: C }) => {
|
|
180
|
+
let te = t.has(_);
|
|
181
|
+
return /* @__PURE__ */ h(w, {
|
|
182
|
+
row: e,
|
|
183
|
+
rowIndex: g,
|
|
184
|
+
rowKey: _,
|
|
185
|
+
selected: te,
|
|
186
|
+
current: r && Object.is(n, _),
|
|
187
|
+
controlProps: C,
|
|
188
|
+
selectionType: a,
|
|
189
|
+
hasRowSelection: i,
|
|
190
|
+
highlightCurrentRow: r,
|
|
191
|
+
columns: o,
|
|
192
|
+
layoutColumns: s,
|
|
193
|
+
columnOffset: c,
|
|
194
|
+
fixedOffsets: l,
|
|
195
|
+
disableFixedRight: u,
|
|
196
|
+
lastFixedLeftIndex: d,
|
|
197
|
+
firstFixedRightIndex: f,
|
|
198
|
+
hasStickyHeader: p,
|
|
199
|
+
showHeader: m,
|
|
200
|
+
canFocusRow: v,
|
|
201
|
+
onRowClick: y,
|
|
202
|
+
onRowDoubleClick: b,
|
|
203
|
+
onCellClick: x,
|
|
204
|
+
onToggleSelection: ee,
|
|
205
|
+
onMeasureCell: S
|
|
206
|
+
}, _);
|
|
207
|
+
}) : /* @__PURE__ */ h("tr", {
|
|
208
|
+
className: "vl-table__empty-row",
|
|
209
|
+
children: /* @__PURE__ */ h("td", {
|
|
210
|
+
className: "vl-table__empty-cell",
|
|
211
|
+
colSpan: s.length,
|
|
212
|
+
children: _ ?? g
|
|
213
|
+
})
|
|
214
|
+
})
|
|
215
|
+
});
|
|
216
|
+
function T(i, c) {
|
|
217
|
+
let { data: l, columns: y, rowKey: x, size: C = "md", bordered: ne = !0, striped: w = !1, highlightCurrentRow: T = !1, showHeader: E = !0, emptyText: se = "暂无数据", maxHeight: D, loading: O = !1, caption: ce, emptyContent: le, loadingContent: ue, tableLayout: de, sortState: fe, defaultSortState: pe = null, rowSelection: k, currentRowKey: me, defaultCurrentRowKey: he = null, className: ge, style: _e, onRowClick: A, onRowDoubleClick: ve, onCellClick: ye, onSortChange: be, onCurrentRowChange: xe, ...Se } = i, Ce = n(i, "sortState"), j = n(i, "currentRowKey"), M = !!(k && n(k, "selectedRowKeys")), N = k?.type ?? "checkbox", P = k?.preserveSelectedRowKeys ?? !1, we = k?.columnWidth ?? 48, F = D != null, [I, Te] = t({
|
|
218
|
+
value: fe ?? null,
|
|
219
|
+
defaultValue: pe,
|
|
220
|
+
controlled: Ce
|
|
221
|
+
}), [L, R] = t({
|
|
222
|
+
value: me ?? null,
|
|
223
|
+
defaultValue: he,
|
|
224
|
+
controlled: j
|
|
225
|
+
}), [Ee, z] = t({
|
|
226
|
+
value: k?.selectedRowKeys ?? [],
|
|
227
|
+
defaultValue: v(k?.defaultSelectedRowKeys ?? [], N),
|
|
228
|
+
controlled: M
|
|
229
|
+
}), De = p(null), B = p([]), Oe = p(/* @__PURE__ */ new Map()), [ke, Ae] = m([]), [V, je] = m(!1), H = f(() => v(Ee, N), [Ee, N]), U = f(() => new Set(H), [H]), W = u((e) => typeof x == "function" ? x(e) : e[x], [x]), G = f(() => {
|
|
230
|
+
let e = /* @__PURE__ */ new Map();
|
|
231
|
+
return l.forEach((t) => e.set(W(t), t)), e;
|
|
232
|
+
}, [l, W]), Me = f(() => {
|
|
233
|
+
if (!I) return l;
|
|
234
|
+
let e = y.find((e) => e.key === I.columnKey);
|
|
235
|
+
if (!e || typeof e.sorter != "function") return l;
|
|
236
|
+
let t = e.sorter, n = I.order === "asc" ? 1 : -1;
|
|
237
|
+
return l.map((e, t) => ({
|
|
238
|
+
row: e,
|
|
239
|
+
index: t
|
|
240
|
+
})).sort((e, r) => t(e.row, r.row) * n || e.index - r.index).map(({ row: e }) => e);
|
|
241
|
+
}, [
|
|
242
|
+
y,
|
|
243
|
+
l,
|
|
244
|
+
I
|
|
245
|
+
]), K = f(() => Me.map((e, t) => ({
|
|
246
|
+
row: e,
|
|
247
|
+
index: t,
|
|
248
|
+
key: W(e),
|
|
249
|
+
controlProps: k?.getControlProps?.(e, t) ?? {}
|
|
250
|
+
})), [
|
|
251
|
+
W,
|
|
252
|
+
k,
|
|
253
|
+
Me
|
|
254
|
+
]);
|
|
255
|
+
d(() => {
|
|
256
|
+
if (P) {
|
|
257
|
+
G.forEach((e, t) => Oe.current.set(t, e));
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
Oe.current = new Map(G);
|
|
261
|
+
}, [G, P]), d(() => {
|
|
262
|
+
if (!k || M) return;
|
|
263
|
+
let e = v(P ? H : H.filter((e) => G.has(e)), N);
|
|
264
|
+
_(H, e) || z(e);
|
|
265
|
+
}, [
|
|
266
|
+
G,
|
|
267
|
+
P,
|
|
268
|
+
k,
|
|
269
|
+
H,
|
|
270
|
+
M,
|
|
271
|
+
N,
|
|
272
|
+
z
|
|
273
|
+
]), d(() => {
|
|
274
|
+
j || L === null || G.has(L) || R(null);
|
|
275
|
+
}, [
|
|
276
|
+
j,
|
|
277
|
+
L,
|
|
278
|
+
G,
|
|
279
|
+
R
|
|
280
|
+
]);
|
|
281
|
+
let q = f(() => K.filter(({ controlProps: e }) => !e.disabled), [K]), Ne = q.length > 0 && q.every(({ key: e }) => U.has(e)), Pe = !Ne && q.some(({ key: e }) => U.has(e)), Fe = !!k, Ie = k?.fixed, J = f(() => [...Fe ? [{
|
|
282
|
+
width: we,
|
|
283
|
+
fixed: Ie ? "left" : void 0
|
|
284
|
+
}] : [], ...y], [
|
|
285
|
+
y,
|
|
286
|
+
Fe,
|
|
287
|
+
Ie,
|
|
288
|
+
we
|
|
289
|
+
]), Le = +!!Fe, Re = f(() => {
|
|
290
|
+
let e = -1;
|
|
291
|
+
return J.forEach((t, n) => {
|
|
292
|
+
t.fixed === "left" && (e = n);
|
|
293
|
+
}), e;
|
|
294
|
+
}, [J]), ze = f(() => J.findIndex((e) => e.fixed === "right"), [J]), Be = J.some((e) => e.fixed !== void 0), Y = F || Be, X = u((e) => {
|
|
295
|
+
let t = e.width ?? e.minWidth;
|
|
296
|
+
return typeof t == "number" && Number.isFinite(t) ? Math.max(0, t) : typeof t == "string" && /^\d+(?:\.\d+)?px$/.test(t.trim()) ? Number.parseFloat(t) : 0;
|
|
297
|
+
}, []), Z = u(() => {
|
|
298
|
+
let e = J.map((e, t) => {
|
|
299
|
+
let n = B.current[t]?.getBoundingClientRect().width ?? 0;
|
|
300
|
+
return n > 0 ? n : X(e);
|
|
301
|
+
}), t = J.map(() => ({})), n = 0;
|
|
302
|
+
J.forEach((r, i) => {
|
|
303
|
+
r.fixed === "left" && (t[i].left = n, n += e[i]);
|
|
304
|
+
});
|
|
305
|
+
let r = 0;
|
|
306
|
+
for (let n = J.length - 1; n >= 0; --n) J[n].fixed === "right" && (t[n].right = r, r += e[n]);
|
|
307
|
+
let i = De.current?.querySelector(".vl-scrollbar__viewport")?.clientWidth ?? 0, a = i > 0 ? i : De.current?.clientWidth ?? 0;
|
|
308
|
+
je(a > 0 && n + r > a), Ae((e) => e.length === t.length && e.every((e, n) => Object.is(e.left, t[n].left) && Object.is(e.right, t[n].right)) ? e : t);
|
|
309
|
+
}, [X, J]);
|
|
310
|
+
e(() => {
|
|
311
|
+
if (!Be) return;
|
|
312
|
+
B.current.length = J.length, Z();
|
|
313
|
+
let e = typeof ResizeObserver > "u" ? null : new ResizeObserver(Z);
|
|
314
|
+
return B.current.forEach((t) => {
|
|
315
|
+
t && e?.observe(t);
|
|
316
|
+
}), window.addEventListener("resize", Z, { passive: !0 }), () => {
|
|
317
|
+
e?.disconnect(), window.removeEventListener("resize", Z);
|
|
318
|
+
};
|
|
319
|
+
}, [
|
|
320
|
+
Be,
|
|
321
|
+
J,
|
|
322
|
+
K.length,
|
|
323
|
+
E,
|
|
324
|
+
Z
|
|
325
|
+
]);
|
|
326
|
+
let Ve = f(() => [
|
|
327
|
+
"vl-table",
|
|
328
|
+
`size-${C}`,
|
|
329
|
+
ne ? "is-bordered" : "",
|
|
330
|
+
w ? "is-striped" : "",
|
|
331
|
+
O ? "is-loading" : "",
|
|
332
|
+
k ? "has-row-selection" : "",
|
|
333
|
+
F ? "has-sticky-header" : "",
|
|
334
|
+
Y ? "has-custom-scrollbar" : "",
|
|
335
|
+
ge || ""
|
|
336
|
+
].filter(Boolean).join(" "), [
|
|
337
|
+
ne,
|
|
338
|
+
ge,
|
|
339
|
+
F,
|
|
340
|
+
O,
|
|
341
|
+
k,
|
|
342
|
+
C,
|
|
343
|
+
w,
|
|
344
|
+
Y
|
|
345
|
+
]), He = f(() => F ? Y ? {
|
|
346
|
+
maxHeight: r(D),
|
|
347
|
+
overflow: "visible"
|
|
348
|
+
} : {
|
|
349
|
+
maxHeight: r(D),
|
|
350
|
+
overflowY: "auto"
|
|
351
|
+
} : {}, [
|
|
352
|
+
F,
|
|
353
|
+
D,
|
|
354
|
+
Y
|
|
355
|
+
]), Ue = [
|
|
356
|
+
"vl-table__wrapper",
|
|
357
|
+
Y ? "is-custom-scrollbar" : "",
|
|
358
|
+
F ? "is-sticky-scrollbar" : ""
|
|
359
|
+
].filter(Boolean).join(" "), We = de ?? (y.some((e) => e.ellipsis) ? "fixed" : "auto"), Ge = f(() => {
|
|
360
|
+
let e = J.map(X);
|
|
361
|
+
return e.length > 0 && e.every((e) => e > 0) ? e.reduce((e, t) => e + t, 0) : 0;
|
|
362
|
+
}, [X, J]), Ke = p(L), qe = p(xe), Je = p(A), Ye = p(ve), Xe = p(ye), Ze = p(H), Qe = p(U), $e = p(N), et = p(k), tt = p(P), Q = p(G), nt = p(T), rt = p(W);
|
|
363
|
+
e(() => {
|
|
364
|
+
Ke.current = L, qe.current = xe, Je.current = A, Ye.current = ve, Xe.current = ye, Ze.current = H, Qe.current = U, $e.current = N, et.current = k, tt.current = P, Q.current = G, nt.current = T, rt.current = W;
|
|
365
|
+
});
|
|
366
|
+
let $ = u((e) => {
|
|
367
|
+
let t = et.current;
|
|
368
|
+
if (!t) return;
|
|
369
|
+
let n = v(e, $e.current);
|
|
370
|
+
z(n);
|
|
371
|
+
let r = tt.current ? Oe.current : Q.current, i = n.map((e) => Q.current.get(e) ?? r.get(e)).filter((e) => e !== void 0);
|
|
372
|
+
t.onChange?.(n, i);
|
|
373
|
+
}, [z]), it = u((e) => {
|
|
374
|
+
let t = $e.current, n = Qe.current, r = Ze.current;
|
|
375
|
+
if (t === "radio") {
|
|
376
|
+
n.has(e) || $([e]);
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
$(n.has(e) ? r.filter((t) => !Object.is(t, e)) : [...r, e]);
|
|
380
|
+
}, [$]), at = u((e, t) => {
|
|
381
|
+
if (nt.current) {
|
|
382
|
+
let t = rt.current(e);
|
|
383
|
+
R(t), Object.is(Ke.current, t) || qe.current?.(t, e);
|
|
384
|
+
}
|
|
385
|
+
Je.current?.(e, t);
|
|
386
|
+
}, [R]), ot = u((e, t) => {
|
|
387
|
+
Ye.current?.(e, t);
|
|
388
|
+
}, []), st = u((e, t, n) => {
|
|
389
|
+
Xe.current?.(e, t, n);
|
|
390
|
+
}, []), ct = u((e, t) => {
|
|
391
|
+
B.current[e] = t;
|
|
392
|
+
}, []), lt = () => {
|
|
393
|
+
let e = q.map(({ key: e }) => e), t = new Set(e);
|
|
394
|
+
if (Ne) {
|
|
395
|
+
$(H.filter((e) => !t.has(e)));
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
$([...H, ...e.filter((e) => !U.has(e))]);
|
|
399
|
+
}, ut = (e) => {
|
|
400
|
+
if (!e.sorter) return;
|
|
401
|
+
let t = {
|
|
402
|
+
columnKey: e.key,
|
|
403
|
+
order: "asc"
|
|
404
|
+
};
|
|
405
|
+
I?.columnKey === e.key && (t = I.order === "asc" ? {
|
|
406
|
+
columnKey: e.key,
|
|
407
|
+
order: "desc"
|
|
408
|
+
} : null), Te(t), be?.(t, e);
|
|
409
|
+
}, dt = /* @__PURE__ */ g("table", {
|
|
410
|
+
className: "vl-table__inner",
|
|
411
|
+
style: {
|
|
412
|
+
tableLayout: We,
|
|
413
|
+
minWidth: Ge || void 0
|
|
414
|
+
},
|
|
415
|
+
children: [
|
|
416
|
+
ce ? /* @__PURE__ */ h("caption", {
|
|
417
|
+
className: "vl-table__caption",
|
|
418
|
+
children: ce
|
|
419
|
+
}) : null,
|
|
420
|
+
/* @__PURE__ */ h("colgroup", { children: J.map((e, t) => /* @__PURE__ */ h("col", { style: ee(e) }, k && t === 0 ? "selection" : y[t - Le].key)) }),
|
|
421
|
+
E ? /* @__PURE__ */ h("thead", {
|
|
422
|
+
className: "vl-table__header",
|
|
423
|
+
children: /* @__PURE__ */ g("tr", { children: [k ? /* @__PURE__ */ h("th", {
|
|
424
|
+
ref: (e) => {
|
|
425
|
+
B.current[0] = e;
|
|
426
|
+
},
|
|
427
|
+
className: re(!0, J[0], V, Re, ze),
|
|
428
|
+
style: S(J[0], 0, !0, "center", F, V, ke),
|
|
429
|
+
scope: "col",
|
|
430
|
+
"aria-label": "行选择",
|
|
431
|
+
children: N === "checkbox" ? /* @__PURE__ */ h(b, {
|
|
432
|
+
type: "checkbox",
|
|
433
|
+
checked: Ne,
|
|
434
|
+
indeterminate: Pe,
|
|
435
|
+
disabled: q.length === 0,
|
|
436
|
+
ariaLabel: "选择全部行",
|
|
437
|
+
onChange: lt
|
|
438
|
+
}) : null
|
|
439
|
+
}) : null, y.map((e, t) => {
|
|
440
|
+
let n = t + Le;
|
|
441
|
+
return /* @__PURE__ */ h("th", {
|
|
442
|
+
ref: (e) => {
|
|
443
|
+
B.current[n] = e;
|
|
444
|
+
},
|
|
445
|
+
className: te(e, n, I, V, Re, ze),
|
|
446
|
+
style: S(e, n, !0, e.align || "left", F, V, ke),
|
|
447
|
+
scope: "col",
|
|
448
|
+
"aria-sort": ae(e, I),
|
|
449
|
+
children: e.sorter ? /* @__PURE__ */ g("button", {
|
|
450
|
+
type: "button",
|
|
451
|
+
className: "vl-table__sort-button",
|
|
452
|
+
onClick: () => ut(e),
|
|
453
|
+
children: [/* @__PURE__ */ h("span", { children: e.title }), /* @__PURE__ */ g("span", {
|
|
454
|
+
className: ie(e, I),
|
|
455
|
+
children: [/* @__PURE__ */ h(s, {
|
|
456
|
+
className: "vl-table__sort-icon--asc",
|
|
457
|
+
size: 14,
|
|
458
|
+
"aria-hidden": "true"
|
|
459
|
+
}), /* @__PURE__ */ h(o, {
|
|
460
|
+
className: "vl-table__sort-icon--desc",
|
|
461
|
+
size: 14,
|
|
462
|
+
"aria-hidden": "true"
|
|
463
|
+
})]
|
|
464
|
+
})]
|
|
465
|
+
}) : /* @__PURE__ */ h("span", {
|
|
466
|
+
className: "vl-table__header-cell-content",
|
|
467
|
+
children: e.title
|
|
468
|
+
})
|
|
469
|
+
}, e.key);
|
|
470
|
+
})] })
|
|
471
|
+
}) : null,
|
|
472
|
+
/* @__PURE__ */ h(oe, {
|
|
473
|
+
renderRows: K,
|
|
474
|
+
selectedKeySet: U,
|
|
475
|
+
currentRowKey: L,
|
|
476
|
+
highlightCurrentRow: T,
|
|
477
|
+
hasRowSelection: !!k,
|
|
478
|
+
selectionType: N,
|
|
479
|
+
columns: y,
|
|
480
|
+
layoutColumns: J,
|
|
481
|
+
columnOffset: Le,
|
|
482
|
+
fixedOffsets: ke,
|
|
483
|
+
disableFixedRight: V,
|
|
484
|
+
lastFixedLeftIndex: Re,
|
|
485
|
+
firstFixedRightIndex: ze,
|
|
486
|
+
hasStickyHeader: F,
|
|
487
|
+
showHeader: E,
|
|
488
|
+
emptyText: se,
|
|
489
|
+
emptyContent: le,
|
|
490
|
+
canFocusRow: !!(A || T),
|
|
491
|
+
onRowClick: at,
|
|
492
|
+
onRowDoubleClick: ot,
|
|
493
|
+
onCellClick: st,
|
|
494
|
+
onToggleSelection: it,
|
|
495
|
+
onMeasureCell: ct
|
|
496
|
+
})
|
|
497
|
+
]
|
|
498
|
+
});
|
|
499
|
+
return /* @__PURE__ */ g("div", {
|
|
500
|
+
ref: c,
|
|
501
|
+
className: Ve,
|
|
502
|
+
style: _e,
|
|
503
|
+
"aria-busy": O || void 0,
|
|
504
|
+
...Se,
|
|
505
|
+
children: [/* @__PURE__ */ h("div", {
|
|
506
|
+
ref: De,
|
|
507
|
+
className: Ue,
|
|
508
|
+
style: He,
|
|
509
|
+
children: Y ? /* @__PURE__ */ h(a, {
|
|
510
|
+
className: "vl-table__scrollbar",
|
|
511
|
+
orientation: F ? "both" : "horizontal",
|
|
512
|
+
style: F ? { "--vl-table-scrollbar-max-height": r(D) } : void 0,
|
|
513
|
+
viewportLabel: "表格内容",
|
|
514
|
+
children: dt
|
|
515
|
+
}) : dt
|
|
516
|
+
}), O ? /* @__PURE__ */ h("div", {
|
|
517
|
+
className: "vl-table__loading",
|
|
518
|
+
role: "status",
|
|
519
|
+
"aria-live": "polite",
|
|
520
|
+
"aria-label": "数据加载中",
|
|
521
|
+
children: ue ?? /* @__PURE__ */ h("span", { className: "vl-table__loading-spinner" })
|
|
522
|
+
}) : null]
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
var E = c(T);
|
|
526
|
+
E.displayName = "VlTable";
|
|
527
|
+
//#endregion
|
|
528
|
+
//#region components/Table/index.ts
|
|
529
|
+
var se = E, D = E;
|
|
530
|
+
//#endregion
|
|
531
|
+
export { se as n, D as t };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./icon-DRLyKu8p.cjs"),t=require("./state-
|
|
1
|
+
const e=require("./icon-DRLyKu8p.cjs"),t=require("./state-BuUx1onZ.cjs"),n=require("./id-CF0zOP1G.cjs");let r=require("react"),i=require("react/jsx-runtime");var a=(0,r.forwardRef)((a,o)=>{let{value:s,defaultValue:c,items:l=[],size:u=`md`,disabled:d=!1,className:f,id:p,"aria-label":m=`Tabs`,onChange:h,...g}=a,_=(0,r.useRef)(null),v=(0,r.useRef)([]),y=(0,r.useRef)(void 0),[b,x]=(0,r.useState)(0),[S,C]=(0,r.useState)(0),w=(0,r.useMemo)(()=>l.find(e=>!e.disabled)?.key,[l]),T=t.t(a,`value`),[E,D]=t.n({value:s,defaultValue:c??w,controlled:T,onChange:e=>{e!==void 0&&h?.(e)}}),O=l.some(e=>e.key===E&&!e.disabled)?E:w,k=n.t(`vl-tabs`,p),A=(0,r.useMemo)(()=>[`vl-tabs`,u?`size-${u}`:``,d?`is-disabled`:``,f||``].filter(Boolean).join(` `),[u,d,f]),j=(0,r.useMemo)(()=>O?l.findIndex(e=>e.key===O):-1,[l,O]),M=(0,r.useMemo)(()=>({transform:`translateX(${b}px)`,width:`${S}px`}),[b,S]),N=(0,r.useCallback)(()=>{let e=_.current;e&&(y.current!==void 0&&window.cancelAnimationFrame(y.current),y.current=window.requestAnimationFrame(()=>{y.current=void 0;let t=e.querySelector(`.vl-tabs__item.is-active`);t&&(x(t.offsetLeft),C(t.offsetWidth))}))},[]);(0,r.useEffect)(()=>()=>{y.current!==void 0&&window.cancelAnimationFrame(y.current)},[]),(0,r.useImperativeHandle)(o,()=>({refresh:N}),[N]),(0,r.useEffect)(()=>{N()},[N,O,l]),(0,r.useEffect)(()=>{let e=_.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>N());return t.observe(e),()=>t.disconnect()},[N]);let P=e=>{e.disabled||d||D(e.key)},F=e=>{let t=l[e];!t||t.disabled||d||(P(t),v.current[e]?.focus())},I=(e,t)=>{if(d)return;let n=l.flatMap((e,t)=>e.disabled?[]:[t]);if(!n.length)return;let r=n.indexOf(t),i;if(e.key===`ArrowRight`)i=n[(r+1+n.length)%n.length];else if(e.key===`ArrowLeft`)i=n[(r-1+n.length)%n.length];else if(e.key===`Home`)i=n[0];else if(e.key===`End`)i=n[n.length-1];else return;e.preventDefault(),i!==void 0&&F(i)};return(0,i.jsxs)(`div`,{ref:_,id:k,className:A,role:`tablist`,"aria-label":m,...g,children:[l.map((t,n)=>(0,i.jsxs)(`button`,{ref:e=>{v.current[n]=e},id:t.id??`${k}-tab-${encodeURIComponent(t.key)}`,type:`button`,role:`tab`,className:[`vl-tabs__item`,O===t.key?`is-active`:``,t.disabled||d?`is-disabled`:``].filter(Boolean).join(` `),"aria-selected":O===t.key,"aria-controls":t.panelId,disabled:t.disabled||d,tabIndex:O===t.key?0:-1,onClick:()=>P(t),onKeyDown:e=>I(e,n),children:[t.icon?e.n(t.icon,`vl-tabs__icon`):null,(0,i.jsx)(`span`,{className:`vl-tabs__label`,children:t.label})]},t.key)),j>=0?(0,i.jsx)(`div`,{className:`vl-tabs__indicator`,style:M}):null]})});a.displayName=`VlTabs`;var o=a,s=a;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as e } from "./icon-Cbvuv4yF.js";
|
|
2
|
-
import { n as t, t as n } from "./state-
|
|
2
|
+
import { n as t, t as n } from "./state-BSDh-Ob2.js";
|
|
3
3
|
import { t as r } from "./id-CHixuHb7.js";
|
|
4
4
|
import { forwardRef as i, useCallback as a, useEffect as o, useImperativeHandle as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
5
5
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./effect-nifYL_rH.js";
|
|
2
|
-
import { n as t, t as n } from "./state-
|
|
2
|
+
import { n as t, t as n } from "./state-BSDh-Ob2.js";
|
|
3
3
|
import { n as r } from "./refs-D5IYOBaf.js";
|
|
4
4
|
import { forwardRef as i, useCallback as a, useMemo as o, useRef as s } from "react";
|
|
5
5
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./effect-BpNxm_06.cjs"),t=require("./state-
|
|
1
|
+
const e=require("./effect-BpNxm_06.cjs"),t=require("./state-BuUx1onZ.cjs"),n=require("./refs-DCqd87V8.cjs");let r=require("react"),i=require("react/jsx-runtime");var a=`--vl-textarea-resize`,o=(0,r.forwardRef)((o,s)=>{let{value:c,defaultValue:l=``,placeholder:u,disabled:d=!1,loading:f=!1,size:p=`md`,rows:m=3,autoSize:h=!1,resize:g=`vertical`,className:_,style:v,children:y,onChange:b,...x}=o,S=(0,r.useRef)(null),C=(0,r.useMemo)(()=>n.n(S,s),[s]),w=t.t(o,`value`),[T,E]=t.n({value:c??``,defaultValue:l,controlled:w,onChange:b}),D=!!y,O=(0,r.useMemo)(()=>[`vl-textarea`,p?`size-${p}`:``,d?`is-disabled`:``,f?`is-loading`:``,h?`is-auto`:``,D?`has-footer`:``,_||``].filter(Boolean).join(` `),[p,d,f,h,D,_]),k=h?`none`:g,A=(0,r.useMemo)(()=>({[a]:k,...v||{}}),[k,v]),j=(0,r.useCallback)(()=>{if(!h||!S.current)return;let e=S.current;e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`},[h]);return e.t(()=>{j()},[T,h,m,j]),(0,i.jsxs)(`div`,{className:O,style:A,children:[(0,i.jsx)(`textarea`,{ref:C,value:T,placeholder:u,disabled:d||f,rows:m,"aria-busy":f||void 0,onInput:e=>{E(e.target.value)},...x}),D?(0,i.jsx)(`div`,{className:`vl-textarea__footer`,children:y}):null]})});o.displayName=`VlTextarea`;var s=o,c=o;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as e, t } from "./state-
|
|
1
|
+
import { n as e, t } from "./state-BSDh-Ob2.js";
|
|
2
2
|
import { t as n } from "./client-pj_wzx28.js";
|
|
3
3
|
import { n as ee } from "./refs-D5IYOBaf.js";
|
|
4
|
-
import { r as te, t as ne } from "./floating-
|
|
4
|
+
import { r as te, t as ne } from "./floating-CqdcJWk2.js";
|
|
5
5
|
import { t as r } from "./id-CHixuHb7.js";
|
|
6
6
|
import { n as re, r as ie, t as ae } from "./layer-DDm97-sb.js";
|
|
7
7
|
import { t as oe } from "./Transition-DiO4GsP3.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./state-
|
|
1
|
+
const e=require("./state-BuUx1onZ.cjs"),t=require("./client-BkoqeUs3.cjs"),n=require("./refs-DCqd87V8.cjs"),r=require("./floating-5PRFyI8D.cjs"),i=require("./id-CF0zOP1G.cjs"),a=require("./layer-BgiUZy_t.cjs"),ee=require("./Transition-X_89ga-e.cjs"),o=require("./time-wheel-BaCcA9nk.cjs");let s=require("lucide-react"),c=require("react"),l=require("react/jsx-runtime"),te=require("react-dom");var u=(0,c.forwardRef)((u,d)=>{let{value:f,defaultValue:ne=null,format:re=`HH:mm:ss`,shortcuts:p=[],minTime:m,maxTime:h,disabledTime:g,placeholder:_=`请选择时间`,disabled:v=!1,clearable:ie=!1,size:ae=`md`,placement:y=`bottom-start`,offset:b=8,zIndex:oe,className:se,style:ce,id:le,"aria-label":ue,"aria-labelledby":x,"aria-describedby":S,onChange:C,onClear:de,onOpen:w,onClose:T,...fe}=u,E=(0,c.useRef)(null),D=(0,c.useRef)(null),O=(0,c.useRef)(null),k=t.t(),A=a.r({defaultZIndex:a.n.popover,zIndex:oe}),pe=e.t(u,`value`),[j,me]=e.n({value:f??null,defaultValue:ne,controlled:pe}),[M,he]=(0,c.useState)(!1),[ge,N]=(0,c.useState)({}),[P,F]=(0,c.useState)(!1),[I,L]=(0,c.useState)(y),_e=i.t(`vl-time-picker-control`,le),R=i.t(`vl-time-picker-panel`),ve=(0,c.useMemo)(()=>n.n(E,d),[d]),z=m?o.y(m):null,B=h?o.y(h):null,V=(0,c.useMemo)(()=>({minSeconds:z,maxSeconds:B,disabledTime:g}),[g,B,z]),H=j&&o.y(j)!==null?j:``,U=H?o.d(o.v(H),re):``,W=o.y(H)??o.y(`00:00:00`)??0,G=Math.floor(W/3600),K=Math.floor(W%3600/60),q=W%60,ye=(0,c.useCallback)(e=>o.i(e,V),[V]),J=(0,c.useCallback)((e,t,n)=>o.n(e,t,n,V),[V]),Y=(0,c.useCallback)(e=>{e&&v||e!==M&&(he(e),e?(F(!1),L(y),N({}),w?.()):T?.())},[v,T,w,M,y]),X=(0,c.useCallback)(()=>{if(!M||!D.current||!O.current)return;let e=r.t({anchorRect:D.current.getBoundingClientRect(),floatingRect:O.current.getBoundingClientRect(),placement:y,offset:b});L(e.placement),N({left:`${Math.round(e.x)}px`,top:`${Math.round(e.y)}px`}),F(!0)},[b,M,y]);(0,c.useEffect)(()=>{M&&k&&X()},[k,M,X]);let be=(0,c.useCallback)(()=>Y(!1),[Y]),xe=(0,c.useCallback)(()=>{Y(!1),D.current?.focus()},[Y]);r.r({active:M&&k,rootRef:E,floatingRef:O,onOutsideClick:be,onEscape:xe,onViewportChange:X}),(0,c.useEffect)(()=>{v&&M&&Y(!1)},[v,M,Y]);let Z=e=>{e!==null&&ye(e)||(me(e),C?.(e))},Se=(e,t)=>{let n=o.o(e,t,{hours:G,minutes:K,seconds:q},J);n!==null&&Z(n)},Q=(0,c.useCallback)((e,t)=>o.a(e,t,{hours:G,minutes:K,seconds:q},J),[J,G,K,q]),Ce=e=>{let t=e.getValue(new Date);t&&o.y(t)!==null&&Z(t)},we=e=>{e?.stopPropagation(),!v&&(Z(null),de?.())},Te=e=>{v||(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),Y(!M))},Ee=[`vl-time-picker`,`size-${ae}`,M?`is-open`:``,v?`is-disabled`:``,se||``].filter(Boolean).join(` `),$=(0,l.jsx)(ee.t,{show:M,name:`vl-time-picker`,deferEffects:!k,children:(0,l.jsxs)(`div`,{ref:O,id:R,className:`vl-time-picker__panel is-${I}${P?` is-positioned`:``}`,style:{...ge,zIndex:A.zIndex,visibility:P?`visible`:`hidden`},role:`dialog`,"aria-label":`时间选择`,children:[(0,l.jsxs)(`div`,{className:`vl-time-picker__controls`,children:[(0,l.jsxs)(`div`,{className:`vl-time-picker__controls-title`,children:[(0,l.jsx)(s.Clock3,{size:16,"aria-hidden":`true`}),(0,l.jsx)(`span`,{children:`时间`})]}),(0,l.jsx)(o.t,{value:{hours:G,minutes:K,seconds:q},isOptionDisabled:Q,onChange:Se})]}),p.length?(0,l.jsx)(`div`,{className:`vl-time-picker__shortcuts`,role:`group`,"aria-label":`快捷选择`,children:p.map(e=>(0,l.jsx)(`button`,{type:`button`,onClick:()=>Ce(e),children:e.label},e.label))}):null]})});return(0,l.jsx)(a.t,{layer:A.layer,children:(0,l.jsxs)(`div`,{ref:ve,className:`vl-time-picker-wrapper`,style:ce,...fe,children:[(0,l.jsxs)(`div`,{ref:D,id:_e,className:Ee,role:`combobox`,"aria-expanded":M,"aria-controls":R,"aria-haspopup":`dialog`,"aria-disabled":v||void 0,"aria-label":ue??(x?void 0:_),"aria-labelledby":x,"aria-describedby":S,tabIndex:v?-1:0,onClick:()=>Y(!M),onKeyDown:Te,children:[(0,l.jsx)(`span`,{className:`vl-time-picker__icon`,"aria-hidden":`true`,children:(0,l.jsx)(s.Clock3,{size:16})}),(0,l.jsx)(`span`,{className:`vl-time-picker__value${U?``:` is-placeholder`}`,children:U||_}),ie&&H&&!v?(0,l.jsx)(`button`,{type:`button`,className:`vl-time-picker__clear`,"aria-label":`清除已选`,onClick:we,onMouseDown:e=>e.preventDefault(),children:(0,l.jsx)(s.X,{size:16,"aria-hidden":`true`})}):null]}),k?(0,te.createPortal)($,document.body):$]})})});u.displayName=`VlTimePicker`;var d=u,f=u;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return f}});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as e, t } from "./state-
|
|
1
|
+
import { n as e, t } from "./state-BSDh-Ob2.js";
|
|
2
2
|
import { t as n } from "./client-pj_wzx28.js";
|
|
3
3
|
import { n as r } from "./refs-D5IYOBaf.js";
|
|
4
4
|
import { t as i } from "./number-BN2jHM6Z.js";
|
|
5
|
-
import { n as ee, r as a } from "./floating-
|
|
5
|
+
import { n as ee, r as a } from "./floating-CqdcJWk2.js";
|
|
6
6
|
import { t as o } from "./id-CHixuHb7.js";
|
|
7
7
|
import { n as s, r as te, t as ne } from "./layer-DDm97-sb.js";
|
|
8
8
|
import { t as re } from "./Transition-DiO4GsP3.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./state-
|
|
1
|
+
const e=require("./state-BuUx1onZ.cjs"),t=require("./client-BkoqeUs3.cjs"),n=require("./refs-DCqd87V8.cjs"),r=require("./number-B7qJF_ZY.cjs"),i=require("./floating-5PRFyI8D.cjs"),a=require("./id-CF0zOP1G.cjs"),o=require("./layer-BgiUZy_t.cjs"),s=require("./Transition-X_89ga-e.cjs"),c=require("./focus-D-h8CbGr.cjs");let l=require("react"),u=require("react/jsx-runtime"),ee=require("react-dom");var d=(0,l.forwardRef)((d,f)=>{let{content:p,placement:m=`top`,trigger:h=`hover`,disabled:g=!1,offset:_=8,showDelay:v=100,hideDelay:y=100,showArrow:te=!0,maxWidth:b=300,zIndex:ne,open:re,defaultOpen:ie=!1,className:x,children:S,onChange:ae,onShow:C,onHide:w,...oe}=d,T=(0,l.useRef)(null),E=(0,l.useRef)(null),D=(0,l.useRef)(null),O=(0,l.useRef)(null),k=(0,l.useRef)(!1),A=(0,l.useRef)(!1),j=(0,l.useRef)(!1),M=(0,l.useRef)(null),N=(0,l.useRef)(null),se=(0,l.useMemo)(()=>n.n(T,f),[f]),P=t.t(),F=o.r({defaultZIndex:o.n.tooltip,zIndex:ne}),ce=e.t(d,`open`),[I,L]=e.n({value:!!re,defaultValue:ie,controlled:ce,onChange:ae}),R=!g&&p!=null,z=R&&I,B=a.t(`vl-tooltip-popup`),[le,V]=(0,l.useState)(m),[H,U]=(0,l.useState)({}),[ue,W]=(0,l.useState)({}),de=(0,l.useMemo)(()=>[`vl-tooltip`,g?`is-disabled`:``,x||``].filter(Boolean).join(` `),[g,x]),fe=`vl-tooltip__popup is-${le}`,G=(0,l.useCallback)(()=>{M.current!==null&&window.clearTimeout(M.current),N.current!==null&&window.clearTimeout(N.current),M.current=null,N.current=null},[]),K=(0,l.useCallback)(()=>{let e=O.current;if(e?.isConnected){e.focus();return}E.current?.querySelector(c.i)?.focus()},[]),q=(0,l.useCallback)((e,t=!1)=>{if(!(e&&!R)){if(I===e){t&&K();return}L(e),e?C?.():(w?.(),t&&window.requestAnimationFrame(K))}},[R,I,L,C,w,K]),J=(0,l.useCallback)(()=>{if(G(),R){if(v<=0){q(!0);return}M.current=window.setTimeout(()=>q(!0),v)}},[G,R,v,q]),Y=(0,l.useCallback)(()=>{if(G(),y<=0){q(!1);return}N.current=window.setTimeout(()=>q(!1),y)},[G,y,q]),X=(0,l.useCallback)(()=>{k.current||A.current||j.current||Y()},[Y]),Z=(0,l.useCallback)(()=>{if(!z)return;let e=E.current,t=D.current;if(!e||!t)return;let n=e.getBoundingClientRect(),a=t.getBoundingClientRect(),{placement:o,x:s,y:c}=i.n({anchorRect:n,floatingRect:a,placement:m,offset:_,edgePadding:8});if(V(o),U({left:`${Math.round(s)}px`,top:`${Math.round(c)}px`}),o.startsWith(`top`)||o.startsWith(`bottom`)){let e=n.left+n.width/2-s;W({left:`${Math.round(r.t(e,10,Math.max(10,a.width-10)))}px`,top:void 0})}else{let e=n.top+n.height/2-c;W({left:void 0,top:`${Math.round(r.t(e,10,Math.max(10,a.height-10)))}px`})}},[z,m,_]),pe=()=>{h===`hover`&&(k.current=!0,J())},me=()=>{h===`hover`&&(k.current=!1,X())},Q=()=>{h===`hover`&&(A.current=!0,G())},he=()=>{h===`hover`&&(A.current=!1,X())},ge=e=>{if(h!==`click`)return;let t=e.target;t.matches(`button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])`)&&(O.current=t),q(!z)},_e=e=>{let t=e.target;t.matches(`button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])`)&&(O.current=t),j.current=!0,(h===`hover`||h===`focus`)&&J()},ve=e=>{e.currentTarget.contains(e.relatedTarget)||(j.current=!1,h===`hover`?X():h===`focus`&&Y())};(0,l.useEffect)(()=>{if(!z||!P)return;let e=window.requestAnimationFrame(()=>{Z(),window.requestAnimationFrame(Z)});return()=>window.cancelAnimationFrame(e)},[z,P,Z]),(0,l.useEffect)(()=>{R||!I||q(!1)},[R,I,q]);let ye=(0,l.useCallback)(()=>q(!1),[q]),be=(0,l.useCallback)(()=>q(!1,!0),[q]);i.r({active:z&&P,rootRef:T,floatingRef:D,closeOnOutsideClick:h===`click`,onOutsideClick:ye,onEscape:be,onViewportChange:Z}),(0,l.useEffect)(()=>()=>G(),[G]);let xe=[(0,l.isValidElement)(S)?S.props[`aria-describedby`]:void 0,B].filter(Boolean).join(` `),Se=(0,l.isValidElement)(S)&&S.type!==l.Fragment?(0,l.cloneElement)(S,{"aria-describedby":xe}):S,Ce={...H,zIndex:F.zIndex,maxWidth:typeof b==`number`?`${b}px`:b},$=(0,u.jsx)(s.t,{show:z,name:`vl-tooltip`,unmountOnExit:!1,deferEffects:!P,children:(0,u.jsxs)(`div`,{ref:D,id:B,className:fe,style:Ce,role:`tooltip`,"aria-hidden":!z||void 0,onMouseEnter:Q,onMouseLeave:he,children:[te?(0,u.jsx)(`span`,{className:`vl-tooltip__arrow`,style:ue,"aria-hidden":`true`}):null,(0,u.jsx)(`div`,{className:`vl-tooltip__content`,children:p})]})});return(0,u.jsx)(o.t,{layer:F.layer,children:(0,u.jsxs)(`div`,{ref:se,className:de,...oe,children:[(0,u.jsx)(`div`,{ref:E,className:`vl-tooltip__trigger`,"aria-describedby":(0,l.isValidElement)(S)?void 0:B,onMouseEnter:pe,onMouseLeave:me,onClick:ge,onFocus:_e,onBlur:ve,children:Se}),P?(0,ee.createPortal)($,document.body):$]})})});d.displayName=`VlTooltip`;var f=d,p=d;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return p}});
|