dishui 0.0.84 → 0.0.91
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/components/Input/index.js +52 -62
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/LayoutSuite/index.d.ts +10 -0
- package/dist/components/LayoutSuite/index.js +27 -18
- package/dist/components/LayoutSuite/index.js.map +1 -1
- package/dist/components/Markdown/markdownComponents.js +1 -0
- package/dist/components/Markdown/markdownComponents.js.map +1 -1
- package/dist/components/Markdown/useMarkdownSource.js +46 -31
- package/dist/components/Markdown/useMarkdownSource.js.map +1 -1
- package/dist/components/Markdown/useMarkmapRenderer.js +44 -31
- package/dist/components/Markdown/useMarkmapRenderer.js.map +1 -1
- package/dist/components/Markdown/useMermaidRenderer.js +49 -31
- package/dist/components/Markdown/useMermaidRenderer.js.map +1 -1
- package/dist/components/ProtectedRoute/index.d.ts +2 -1
- package/dist/components/ProtectedRoute/index.js +16 -6
- package/dist/components/ProtectedRoute/index.js.map +1 -1
- package/dist/components/Select/index.d.ts +6 -0
- package/dist/components/Select/index.js +166 -136
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/Table/index.d.ts +23 -2
- package/dist/components/Table/index.js +153 -101
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Tabs/index.d.ts +12 -1
- package/dist/components/Tabs/index.js +42 -17
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/pro/ArticleContextMenu/index.js +7 -7
- package/dist/components/pro/CodeEditor/editors/CodeEditor.js +200 -189
- package/dist/components/pro/CodeEditor/editors/CodeEditor.js.map +1 -1
- package/dist/components/pro/CodeEditor/types.d.ts +3 -0
- package/dist/components/pro/DataTable/DataTable.d.ts +1 -1
- package/dist/components/pro/DataTable/DataTable.js +124 -247
- package/dist/components/pro/DataTable/DataTable.js.map +1 -1
- package/dist/components/pro/DataTable/components/TableBody.d.ts +3 -1
- package/dist/components/pro/DataTable/components/TableBody.js +41 -41
- package/dist/components/pro/DataTable/components/TableBody.js.map +1 -1
- package/dist/components/pro/DataTable/components/TablePagination.d.ts +3 -9
- package/dist/components/pro/DataTable/components/TablePagination.js +29 -25
- package/dist/components/pro/DataTable/components/TablePagination.js.map +1 -1
- package/dist/components/pro/DataTable/components/TableToolbar.d.ts +2 -1
- package/dist/components/pro/DataTable/components/TableToolbar.js +25 -19
- package/dist/components/pro/DataTable/components/TableToolbar.js.map +1 -1
- package/dist/components/pro/DataTable/index.d.ts +1 -1
- package/dist/components/pro/DataTable/rowDetailExtension.js +1 -1
- package/dist/components/pro/DataTable/rowDetailExtension.js.map +1 -1
- package/dist/components/pro/DataTable/tanstack-table.d.ts +2 -2
- package/dist/components/pro/DataTable/tanstack-table.js +29 -21
- package/dist/components/pro/DataTable/tanstack-table.js.map +1 -1
- package/dist/components/pro/DataTable/treeDataUtils.d.ts +2 -0
- package/dist/components/pro/DataTable/treeDataUtils.js +18 -19
- package/dist/components/pro/DataTable/treeDataUtils.js.map +1 -1
- package/dist/components/pro/DataTable/types.d.ts +43 -0
- package/dist/components/pro/DataTable/useDataTableModel.d.ts +16 -0
- package/dist/components/pro/DataTable/useDataTableModel.js +148 -0
- package/dist/components/pro/DataTable/useDataTableModel.js.map +1 -0
- package/dist/components/pro/FileExplorer/Breadcrumb.js +12 -12
- package/dist/components/pro/Flow/nodes/DataNodeView.js +87 -82
- package/dist/components/pro/Flow/nodes/DataNodeView.js.map +1 -1
- package/dist/components/pro/Flow/nodes/MediaContent.js +1 -1
- package/dist/components/pro/Flow/nodes/MediaContent.js.map +1 -1
- package/dist/components/pro/Flow/nodes/MediaOverlay.js +1 -1
- package/dist/components/pro/Flow/nodes/MediaOverlay.js.map +1 -1
- package/dist/components/pro/Flow/nodes/Model3DView.js +69 -63
- package/dist/components/pro/Flow/nodes/Model3DView.js.map +1 -1
- package/dist/components/pro/Flow/nodes/chartGeometryBudget.d.ts +14 -0
- package/dist/components/pro/Flow/nodes/chartGeometryBudget.js +76 -0
- package/dist/components/pro/Flow/nodes/chartGeometryBudget.js.map +1 -0
- package/dist/components/pro/Flow/nodes/demandRender.d.ts +11 -0
- package/dist/components/pro/Flow/nodes/demandRender.js +26 -0
- package/dist/components/pro/Flow/nodes/demandRender.js.map +1 -0
- package/dist/components/pro/RichTextEditor/SlashMenu.js +68 -58
- package/dist/components/pro/RichTextEditor/SlashMenu.js.map +1 -1
- package/dist/contexts/AppContext.d.ts +1 -0
- package/dist/contexts/AppContext.js +144 -145
- package/dist/contexts/AppContext.js.map +1 -1
- package/dist/contexts/authentication.d.ts +7 -0
- package/dist/contexts/authentication.js +22 -0
- package/dist/contexts/authentication.js.map +1 -0
- package/dist/data-table.js.map +1 -1
- package/dist/dishui.css +1 -1
- package/dist/hooks/useControllableState.d.ts +6 -14
- package/dist/hooks/useControllableState.js +21 -15
- package/dist/hooks/useControllableState.js.map +1 -1
- package/dist/hooks/useTableColumns.d.ts +3 -3
- package/dist/hooks/useTableColumns.js +2 -2
- package/dist/hooks/useTableColumns.js.map +1 -1
- package/dist/hooks/useTableData.d.ts +11 -4
- package/dist/hooks/useTableData.js +44 -26
- package/dist/hooks/useTableData.js.map +1 -1
- package/dist/index-nostyled.d.ts +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +97 -97
- package/dist/lite.d.ts +2 -0
- package/dist/lite.js +22 -21
- package/dist/utils/i18n.js +1 -1
- package/dist/utils/i18n.js.map +1 -1
- package/dist/utils/routerBuilder.d.ts +7 -5
- package/dist/utils/routerBuilder.js +11 -15
- package/dist/utils/routerBuilder.js.map +1 -1
- package/dist/utils/safeStorage.d.ts +8 -0
- package/dist/utils/safeStorage.js +45 -0
- package/dist/utils/safeStorage.js.map +1 -0
- package/package.json +22 -5
|
@@ -1,117 +1,169 @@
|
|
|
1
1
|
import { cn as e } from "../../utils/cn.js";
|
|
2
|
-
|
|
3
|
-
import
|
|
2
|
+
/* empty css */
|
|
3
|
+
import t from "react";
|
|
4
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
5
|
//#region src/components/Table/index.tsx
|
|
5
|
-
var
|
|
6
|
-
let
|
|
7
|
-
return /* @__PURE__ */
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
var i = t.createContext(null), a = t.createContext(!1), o = {}, s = ({ children: t, className: r = "", card: s = !1, cardOptions: c = o, onClick: l, onMouseEnter: u, onMouseLeave: d, ...f }) => {
|
|
7
|
+
let p = e("table", s && "blade-table-card", r);
|
|
8
|
+
return /* @__PURE__ */ n(i.Provider, {
|
|
9
|
+
value: s ? c : null,
|
|
10
|
+
children: /* @__PURE__ */ n(a.Provider, {
|
|
11
|
+
value: !1,
|
|
12
|
+
children: /* @__PURE__ */ n("table", {
|
|
13
|
+
role: s ? "table" : void 0,
|
|
14
|
+
...f,
|
|
15
|
+
className: p,
|
|
16
|
+
onClick: l,
|
|
17
|
+
onMouseEnter: u,
|
|
18
|
+
onMouseLeave: d,
|
|
19
|
+
children: t
|
|
20
|
+
})
|
|
21
|
+
})
|
|
14
22
|
});
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
23
|
+
}, c = {
|
|
24
|
+
Caption: (e) => /* @__PURE__ */ n("caption", { ...e }),
|
|
25
|
+
Footer: (e) => {
|
|
26
|
+
let r = t.useContext(i);
|
|
27
|
+
return /* @__PURE__ */ n("tfoot", {
|
|
28
|
+
role: r ? "rowgroup" : void 0,
|
|
29
|
+
...e
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
Head: ({ children: r, className: a = "", ...o }) => {
|
|
33
|
+
let s = t.useContext(i), c = e("table-header-group", a);
|
|
34
|
+
return /* @__PURE__ */ n("thead", {
|
|
35
|
+
role: s ? "rowgroup" : void 0,
|
|
36
|
+
...o,
|
|
37
|
+
className: c,
|
|
38
|
+
children: r
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
Body: ({ children: r, className: o = "", style: s, ...c }) => {
|
|
42
|
+
let l = t.useContext(i), u = e("table-row-group", l && "blade-table-card__grid", l?.gridClassName, o);
|
|
43
|
+
return /* @__PURE__ */ n(a.Provider, {
|
|
44
|
+
value: !0,
|
|
45
|
+
children: /* @__PURE__ */ n("tbody", {
|
|
46
|
+
role: l ? "rowgroup" : void 0,
|
|
47
|
+
...c,
|
|
48
|
+
className: u,
|
|
49
|
+
style: l ? {
|
|
50
|
+
...l.gridStyle,
|
|
51
|
+
...s
|
|
52
|
+
} : s,
|
|
53
|
+
children: r
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
Row: ({ children: r, className: o = "", selected: s = !1, style: c, onClick: l, onDoubleClick: u, onMouseEnter: d, onMouseLeave: f, ...p }) => {
|
|
58
|
+
let m = t.useContext(i), h = t.useContext(a) ? m : null, g = e("table-row", s && "bg-base-200", "hover:bg-base-100", h && "blade-table-card__row", h?.className, o);
|
|
59
|
+
return /* @__PURE__ */ n("tr", {
|
|
60
|
+
role: m ? "row" : void 0,
|
|
61
|
+
"data-card-selected": h && s ? "true" : void 0,
|
|
62
|
+
style: h ? {
|
|
63
|
+
...h.style,
|
|
64
|
+
...c
|
|
65
|
+
} : c,
|
|
66
|
+
className: g,
|
|
67
|
+
onClick: l,
|
|
68
|
+
onDoubleClick: u,
|
|
69
|
+
onMouseEnter: d,
|
|
70
|
+
onMouseLeave: f,
|
|
71
|
+
...p,
|
|
72
|
+
children: r
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
Cell: ({ children: o, label: s, className: c = "", onClick: l, colSpan: u, style: d, onDoubleClick: f, onMouseEnter: p, onMouseLeave: m, ...h }) => {
|
|
76
|
+
let g = t.useContext(i), _ = t.useContext(a) ? g : null, v = e("table-cell", _ && "blade-table-card__field", _?.fieldClassName, c);
|
|
77
|
+
return /* @__PURE__ */ r("td", {
|
|
78
|
+
role: g ? "cell" : void 0,
|
|
79
|
+
...h,
|
|
80
|
+
className: v,
|
|
81
|
+
onClick: l,
|
|
82
|
+
colSpan: u,
|
|
83
|
+
style: _ ? {
|
|
84
|
+
..._.fieldStyle,
|
|
85
|
+
...d
|
|
86
|
+
} : d,
|
|
87
|
+
onDoubleClick: f,
|
|
88
|
+
onMouseEnter: p,
|
|
89
|
+
onMouseLeave: m,
|
|
90
|
+
children: [_ && s != null ? /* @__PURE__ */ n("div", {
|
|
91
|
+
className: e("blade-table-card__label", _.labelClassName),
|
|
92
|
+
style: _.labelStyle,
|
|
93
|
+
children: s
|
|
94
|
+
}) : null, o]
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
HeaderCell: ({ children: o, className: s = "", style: c, onClick: l, sortable: u = !1, sortDirection: d = null, draggable: f, onDragStart: p, onDragOver: m, onDrop: h, onMouseEnter: g, onMouseLeave: _, ...v }) => {
|
|
98
|
+
let y = t.useContext(i), b = t.useContext(a), x = b ? y : null, S = e("table-cell font-medium", u && "cursor-pointer", x && "blade-table-card__field", x?.fieldClassName, s);
|
|
99
|
+
return /* @__PURE__ */ n("th", {
|
|
100
|
+
role: y ? v.scope === "row" || v.scope === "rowgroup" || b && !v.scope ? "rowheader" : "columnheader" : void 0,
|
|
101
|
+
...v,
|
|
102
|
+
style: x ? {
|
|
103
|
+
...x.fieldStyle,
|
|
104
|
+
...c
|
|
105
|
+
} : c,
|
|
106
|
+
className: S,
|
|
107
|
+
onClick: l,
|
|
108
|
+
draggable: f,
|
|
109
|
+
onDragStart: p,
|
|
110
|
+
onDragOver: m,
|
|
111
|
+
onDrop: h,
|
|
112
|
+
onMouseEnter: g,
|
|
113
|
+
onMouseLeave: _,
|
|
114
|
+
children: u ? /* @__PURE__ */ r("div", {
|
|
115
|
+
className: "flex items-center gap-2",
|
|
116
|
+
children: [o, u && /* @__PURE__ */ n("div", {
|
|
117
|
+
className: "flex flex-col",
|
|
118
|
+
children: d === "asc" ? /* @__PURE__ */ n("svg", {
|
|
96
119
|
xmlns: "http://www.w3.org/2000/svg",
|
|
97
120
|
className: "h-4 w-4",
|
|
98
121
|
fill: "none",
|
|
99
122
|
viewBox: "0 0 24 24",
|
|
100
123
|
stroke: "currentColor",
|
|
101
|
-
children: /* @__PURE__ */
|
|
124
|
+
children: /* @__PURE__ */ n("path", {
|
|
102
125
|
strokeLinecap: "round",
|
|
103
126
|
strokeLinejoin: "round",
|
|
104
127
|
strokeWidth: "2",
|
|
105
|
-
d: "
|
|
128
|
+
d: "M5 15l7-7 7 7"
|
|
129
|
+
})
|
|
130
|
+
}) : d === "desc" ? /* @__PURE__ */ n("svg", {
|
|
131
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
132
|
+
className: "h-4 w-4",
|
|
133
|
+
fill: "none",
|
|
134
|
+
viewBox: "0 0 24 24",
|
|
135
|
+
stroke: "currentColor",
|
|
136
|
+
children: /* @__PURE__ */ n("path", {
|
|
137
|
+
strokeLinecap: "round",
|
|
138
|
+
strokeLinejoin: "round",
|
|
139
|
+
strokeWidth: "2",
|
|
140
|
+
d: "M19 9l-7 7-7-7"
|
|
141
|
+
})
|
|
142
|
+
}) : /* @__PURE__ */ n("div", {
|
|
143
|
+
className: "h-4 w-4 opacity-30",
|
|
144
|
+
children: /* @__PURE__ */ n("svg", {
|
|
145
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
146
|
+
className: "h-4 w-4",
|
|
147
|
+
fill: "none",
|
|
148
|
+
viewBox: "0 0 24 24",
|
|
149
|
+
stroke: "currentColor",
|
|
150
|
+
children: /* @__PURE__ */ n("path", {
|
|
151
|
+
strokeLinecap: "round",
|
|
152
|
+
strokeLinejoin: "round",
|
|
153
|
+
strokeWidth: "2",
|
|
154
|
+
d: "M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"
|
|
155
|
+
})
|
|
106
156
|
})
|
|
107
157
|
})
|
|
108
|
-
})
|
|
109
|
-
})
|
|
110
|
-
})
|
|
111
|
-
}
|
|
112
|
-
}, l = (
|
|
113
|
-
|
|
158
|
+
})]
|
|
159
|
+
}) : o
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}, l = Object.assign(s, c, { Card: Object.assign((e) => /* @__PURE__ */ n(s, {
|
|
163
|
+
...e,
|
|
164
|
+
card: !0
|
|
165
|
+
}), c) });
|
|
114
166
|
//#endregion
|
|
115
|
-
export {
|
|
167
|
+
export { l as default };
|
|
116
168
|
|
|
117
169
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Table/index.tsx"],"sourcesContent":["import React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type TableProps = {\n children: React.ReactNode;\n className?: string;\n onClick?: (e: React.MouseEvent) => void;\n onMouseEnter?: (e: React.MouseEvent) => void;\n onMouseLeave?: (e: React.MouseEvent) => void;\n} & React.TableHTMLAttributes<HTMLTableElement>;\n\nconst Table = ({\n children,\n className = '',\n onClick,\n onMouseEnter,\n onMouseLeave,\n ...rest\n}: TableProps) => {\n const baseClass = 'table';\n \n const tableClasses = cn(baseClass, className);\n\n return (\n <table \n {...rest}\n className={tableClasses}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n >\n {children}\n </table>\n );\n};\n\n// Table.Head 组件\nexport type TableHeadProps = React.HTMLAttributes<HTMLTableSectionElement>;\n\nconst TableHead = ({\n children,\n className = '',\n ...rest\n}: TableHeadProps) => {\n const baseClass = 'table-header-group';\n \n const headClasses = cn(baseClass, className);\n\n return (\n <thead {...rest} className={headClasses}>\n {children}\n </thead>\n );\n};\n\n// Table.Body 组件\nexport type TableBodyProps = React.HTMLAttributes<HTMLTableSectionElement>;\n\nconst TableBody = ({\n children,\n className = '',\n ...rest\n}: TableBodyProps) => {\n const baseClass = 'table-row-group';\n \n const bodyClasses = cn(baseClass, className);\n\n return (\n <tbody {...rest} className={bodyClasses}>\n {children}\n </tbody>\n );\n};\n\n// Table.Row 组件\nexport type TableRowProps = {\n children: React.ReactNode;\n className?: string;\n selected?: boolean;\n onClick?: (e: React.MouseEvent) => void;\n onDoubleClick?: (e: React.MouseEvent) => void;\n onMouseEnter?: (e: React.MouseEvent) => void;\n onMouseLeave?: (e: React.MouseEvent) => void;\n} & Omit<\n React.HTMLAttributes<HTMLTableRowElement>,\n 'className' | 'onClick' | 'onDoubleClick' | 'onMouseEnter' | 'onMouseLeave'\n>;\n\nconst TableRow = ({\n children,\n className = '',\n selected = false,\n onClick,\n onDoubleClick,\n onMouseEnter,\n onMouseLeave,\n ...rest\n}: TableRowProps) => {\n const baseClass = 'table-row';\n\n const rowClasses = cn(\n baseClass,\n selected && 'bg-base-200',\n 'hover:bg-base-100',\n className\n );\n\n return (\n <tr \n className={rowClasses}\n onClick={onClick}\n onDoubleClick={onDoubleClick}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n {...rest}\n >\n {children}\n </tr>\n );\n};\n\n// Table.Cell 组件\nexport type TableCellProps = {\n children?: React.ReactNode;\n className?: string;\n onClick?: (e: React.MouseEvent) => void;\n colSpan?: number;\n style?: React.CSSProperties;\n \n // 添加鼠标事件\n onDoubleClick?: (e: React.MouseEvent) => void;\n onMouseEnter?: (e: React.MouseEvent) => void;\n onMouseLeave?: (e: React.MouseEvent) => void;\n} & React.TdHTMLAttributes<HTMLTableCellElement>;\n\nconst TableCell = ({\n children,\n className = '',\n onClick,\n colSpan,\n style,\n onDoubleClick,\n onMouseEnter,\n onMouseLeave,\n ...rest\n}: TableCellProps) => {\n const baseClass = 'table-cell';\n \n const cellClasses = cn(baseClass, className);\n\n return (\n <td\n {...rest}\n className={cellClasses}\n onClick={onClick}\n colSpan={colSpan}\n style={style}\n onDoubleClick={onDoubleClick}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n >\n {children}\n </td>\n );\n};\n\n// Table.HeaderCell 组件\nexport type TableHeaderCellProps = {\n children: React.ReactNode;\n className?: string;\n onClick?: (e: React.MouseEvent) => void;\n sortable?: boolean;\n sortDirection?: 'asc' | 'desc' | null;\n \n // 拖拽相关属性\n draggable?: boolean;\n onDragStart?: (e: React.DragEvent) => void;\n onDragOver?: (e: React.DragEvent) => void;\n onDrop?: (e: React.DragEvent) => void;\n \n // 鼠标事件\n onMouseEnter?: (e: React.MouseEvent) => void;\n onMouseLeave?: (e: React.MouseEvent) => void;\n} & React.ThHTMLAttributes<HTMLTableCellElement>;\n\nconst TableHeaderCell = ({\n children,\n className = '',\n onClick,\n sortable = false,\n sortDirection = null,\n \n // 拖拽相关属性\n draggable,\n onDragStart,\n onDragOver,\n onDrop,\n \n // 鼠标事件\n onMouseEnter,\n onMouseLeave,\n ...rest\n}: TableHeaderCellProps) => {\n const baseClass = 'table-cell font-medium';\n \n const headerCellClasses = cn(\n baseClass,\n sortable && 'cursor-pointer',\n className\n );\n\n return (\n <th\n {...rest}\n className={headerCellClasses}\n onClick={onClick}\n draggable={draggable}\n onDragStart={onDragStart}\n onDragOver={onDragOver}\n onDrop={onDrop}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n >\n {sortable ? <div className=\"flex items-center gap-2\">\n {children}\n {sortable && (\n <div className=\"flex flex-col\">\n {sortDirection === 'asc' ? (\n <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-4 w-4\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\" d=\"M5 15l7-7 7 7\" />\n </svg>\n ) : sortDirection === 'desc' ? (\n <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-4 w-4\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\" d=\"M19 9l-7 7-7-7\" />\n </svg>\n ) : (\n <div className=\"h-4 w-4 opacity-30\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-4 w-4\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\" d=\"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4\" />\n </svg>\n </div>\n )}\n </div>\n )}\n </div> : children}\n </th>\n );\n};\n\nexport type TableCaptionProps = React.HTMLAttributes<HTMLTableCaptionElement>;\nexport type TableFooterProps = React.HTMLAttributes<HTMLTableSectionElement>;\nconst TableCaption = (props: TableCaptionProps) => <caption {...props} />;\nconst TableFooter = (props: TableFooterProps) => <tfoot {...props} />;\n\n// 扩展Table组件,添加子组件\ninterface TableCompound extends React.FC<TableProps> {\n Caption: React.FC<TableCaptionProps>;\n Footer: React.FC<TableFooterProps>;\n Head: React.FC<TableHeadProps>;\n Body: React.FC<TableBodyProps>;\n Row: React.FC<TableRowProps>;\n Cell: React.FC<TableCellProps>;\n HeaderCell: React.FC<TableHeaderCellProps>;\n}\n\nconst TableWithCompounds = Table as TableCompound;\nTableWithCompounds.Caption = TableCaption;\nTableWithCompounds.Footer = TableFooter;\nTableWithCompounds.Head = TableHead;\nTableWithCompounds.Body = TableBody;\nTableWithCompounds.Row = TableRow;\nTableWithCompounds.Cell = TableCell;\nTableWithCompounds.HeaderCell = TableHeaderCell;\n\nexport default TableWithCompounds; "],"mappings":";;;;AAWA,IAAM,KAAS,EACb,aACA,eAAY,IACZ,YACA,iBACA,iBACA,GAAG,QACa;CAGhB,IAAM,IAAe,EAAG,SAAW,CAAS;CAE5C,OACE,kBAAC,SAAD;EACE,GAAI;EACJ,WAAW;EACF;EACK;EACA;EAEb;CACI,CAAA;AAEX,GAKM,KAAa,EACjB,aACA,eAAY,IACZ,GAAG,QACiB;CAGpB,IAAM,IAAc,EAAG,sBAAW,CAAS;CAE3C,OACE,kBAAC,SAAD;EAAO,GAAI;EAAM,WAAW;EACzB;CACI,CAAA;AAEX,GAKM,KAAa,EACjB,aACA,eAAY,IACZ,GAAG,QACiB;CAGpB,IAAM,IAAc,EAAG,mBAAW,CAAS;CAE3C,OACE,kBAAC,SAAD;EAAO,GAAI;EAAM,WAAW;EACzB;CACI,CAAA;AAEX,GAgBM,KAAY,EAChB,aACA,eAAY,IACZ,cAAW,IACX,YACA,kBACA,iBACA,iBACA,GAAG,QACgB;CAGnB,IAAM,IAAa,EACjB,aACA,KAAY,eACZ,qBACA,CACF;CAEA,OACE,kBAAC,MAAD;EACE,WAAW;EACF;EACM;EACD;EACA;EACd,GAAI;EAEH;CACC,CAAA;AAER,GAg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AA;AAER,GAIM,KAAgB,MAA6B,kBAAC,WAAD,EAAS,GAAI,EAAQ,CAAA,GAClE,KAAe,MAA4B,kBAAC,SAAD,EAAO,GAAI,EAAQ,CAAA,GAa9D,IAAqB;AAC3B,EAAmB,UAAU,GAC7B,EAAmB,SAAS,GAC5B,EAAmB,OAAO,GAC1B,EAAmB,OAAO,GAC1B,EAAmB,MAAM,GACzB,EAAmB,OAAO,GAC1B,EAAmB,aAAa"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Table/index.tsx"],"sourcesContent":["import React from 'react';\nimport { cn } from '../../utils/cn';\nimport './Table.css';\n\nexport type TableCardOptions = {\n /** Applied to each Table.Body grid. */\n gridClassName?: string;\n gridStyle?: React.CSSProperties;\n /** Applied to each body row card. */\n className?: string;\n style?: React.CSSProperties;\n fieldClassName?: string;\n fieldStyle?: React.CSSProperties;\n labelClassName?: string;\n labelStyle?: React.CSSProperties;\n};\n\nconst CardContext = React.createContext<TableCardOptions | null>(null);\nconst BodyContext = React.createContext(false);\nconst defaultCardOptions: TableCardOptions = {};\n\nexport type TableProps = {\n children: React.ReactNode;\n card?: boolean;\n cardOptions?: TableCardOptions;\n className?: string;\n onClick?: (e: React.MouseEvent) => void;\n onMouseEnter?: (e: React.MouseEvent) => void;\n onMouseLeave?: (e: React.MouseEvent) => void;\n} & React.TableHTMLAttributes<HTMLTableElement>;\n\nconst Table = ({\n children,\n className = '',\n card = false,\n cardOptions = defaultCardOptions,\n onClick,\n onMouseEnter,\n onMouseLeave,\n ...rest\n}: TableProps) => {\n const baseClass = 'table';\n \n const tableClasses = cn(baseClass, card && 'blade-table-card', className);\n\n return (\n <CardContext.Provider value={card ? cardOptions : null}>\n <BodyContext.Provider value={false}>\n <table\n role={card ? 'table' : undefined}\n {...rest}\n className={tableClasses}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n >\n {children}\n </table>\n </BodyContext.Provider>\n </CardContext.Provider>\n );\n};\n\n// Table.Head 组件\nexport type TableHeadProps = React.HTMLAttributes<HTMLTableSectionElement>;\n\nconst TableHead = ({\n children,\n className = '',\n ...rest\n}: TableHeadProps) => {\n const options = React.useContext(CardContext);\n const baseClass = 'table-header-group';\n \n const headClasses = cn(baseClass, className);\n\n return (\n <thead role={options ? 'rowgroup' : undefined} {...rest} className={headClasses}>\n {children}\n </thead>\n );\n};\n\n// Table.Body 组件\nexport type TableBodyProps = React.HTMLAttributes<HTMLTableSectionElement>;\n\nconst TableBody = ({\n children,\n className = '',\n style,\n ...rest\n}: TableBodyProps) => {\n const options = React.useContext(CardContext);\n const bodyClasses = cn('table-row-group', options && 'blade-table-card__grid', options?.gridClassName, className);\n\n return (\n <BodyContext.Provider value={true}>\n <tbody\n role={options ? 'rowgroup' : undefined}\n {...rest}\n className={bodyClasses}\n style={options ? { ...options.gridStyle, ...style } : style}\n >\n {children}\n </tbody>\n </BodyContext.Provider>\n );\n};\n\n// Table.Row 组件\nexport type TableRowProps = {\n children: React.ReactNode;\n className?: string;\n selected?: boolean;\n onClick?: (e: React.MouseEvent) => void;\n onDoubleClick?: (e: React.MouseEvent) => void;\n onMouseEnter?: (e: React.MouseEvent) => void;\n onMouseLeave?: (e: React.MouseEvent) => void;\n} & Omit<\n React.HTMLAttributes<HTMLTableRowElement>,\n 'className' | 'onClick' | 'onDoubleClick' | 'onMouseEnter' | 'onMouseLeave'\n>;\n\nconst TableRow = ({\n children,\n className = '',\n selected = false,\n style,\n onClick,\n onDoubleClick,\n onMouseEnter,\n onMouseLeave,\n ...rest\n}: TableRowProps) => {\n const cardOptions = React.useContext(CardContext);\n const inBody = React.useContext(BodyContext);\n const options = inBody ? cardOptions : null;\n const baseClass = 'table-row';\n\n const rowClasses = cn(\n baseClass,\n selected && 'bg-base-200',\n 'hover:bg-base-100',\n options && 'blade-table-card__row',\n options?.className,\n className\n );\n\n return (\n <tr\n role={cardOptions ? 'row' : undefined}\n data-card-selected={options && selected ? 'true' : undefined}\n style={options ? { ...options.style, ...style } : style}\n className={rowClasses}\n onClick={onClick}\n onDoubleClick={onDoubleClick}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n {...rest}\n >\n {children}\n </tr>\n );\n};\n\n// Table.Cell 组件\nexport type TableCellProps = {\n children?: React.ReactNode;\n /** Visible field label in card body cells only. */\n label?: React.ReactNode;\n className?: string;\n onClick?: (e: React.MouseEvent) => void;\n colSpan?: number;\n style?: React.CSSProperties;\n \n // 添加鼠标事件\n onDoubleClick?: (e: React.MouseEvent) => void;\n onMouseEnter?: (e: React.MouseEvent) => void;\n onMouseLeave?: (e: React.MouseEvent) => void;\n} & React.TdHTMLAttributes<HTMLTableCellElement>;\n\nconst TableCell = ({\n children,\n label,\n className = '',\n onClick,\n colSpan,\n style,\n onDoubleClick,\n onMouseEnter,\n onMouseLeave,\n ...rest\n}: TableCellProps) => {\n const cardOptions = React.useContext(CardContext);\n const inBody = React.useContext(BodyContext);\n const options = inBody ? cardOptions : null;\n const cellClasses = cn('table-cell', options && 'blade-table-card__field', options?.fieldClassName, className);\n\n return (\n <td\n role={cardOptions ? 'cell' : undefined}\n {...rest}\n className={cellClasses}\n onClick={onClick}\n colSpan={colSpan}\n style={options ? { ...options.fieldStyle, ...style } : style}\n onDoubleClick={onDoubleClick}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n >\n {/* Keep children in a fixed slot so mode/label changes preserve local state. */}\n {options && label !== null && label !== undefined ? <div className={cn('blade-table-card__label', options.labelClassName)} style={options.labelStyle}>{label}</div> : null}\n {children}\n </td>\n );\n};\n\n// Table.HeaderCell 组件\nexport type TableHeaderCellProps = {\n children: React.ReactNode;\n className?: string;\n onClick?: (e: React.MouseEvent) => void;\n sortable?: boolean;\n sortDirection?: 'asc' | 'desc' | null;\n \n // 拖拽相关属性\n draggable?: boolean;\n onDragStart?: (e: React.DragEvent) => void;\n onDragOver?: (e: React.DragEvent) => void;\n onDrop?: (e: React.DragEvent) => void;\n \n // 鼠标事件\n onMouseEnter?: (e: React.MouseEvent) => void;\n onMouseLeave?: (e: React.MouseEvent) => void;\n} & React.ThHTMLAttributes<HTMLTableCellElement>;\n\nconst TableHeaderCell = ({\n children,\n className = '',\n style,\n onClick,\n sortable = false,\n sortDirection = null,\n \n // 拖拽相关属性\n draggable,\n onDragStart,\n onDragOver,\n onDrop,\n \n // 鼠标事件\n onMouseEnter,\n onMouseLeave,\n ...rest\n}: TableHeaderCellProps) => {\n const cardOptions = React.useContext(CardContext);\n const inBody = React.useContext(BodyContext);\n const options = inBody ? cardOptions : null;\n const baseClass = 'table-cell font-medium';\n \n const headerCellClasses = cn(\n baseClass,\n sortable && 'cursor-pointer',\n options && 'blade-table-card__field',\n options?.fieldClassName,\n className\n );\n\n return (\n <th\n role={cardOptions ? (rest.scope === 'row' || rest.scope === 'rowgroup' || (inBody && !rest.scope) ? 'rowheader' : 'columnheader') : undefined}\n {...rest}\n style={options ? { ...options.fieldStyle, ...style } : style}\n className={headerCellClasses}\n onClick={onClick}\n draggable={draggable}\n onDragStart={onDragStart}\n onDragOver={onDragOver}\n onDrop={onDrop}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n >\n {sortable ? <div className=\"flex items-center gap-2\">\n {children}\n {sortable && (\n <div className=\"flex flex-col\">\n {sortDirection === 'asc' ? (\n <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-4 w-4\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\" d=\"M5 15l7-7 7 7\" />\n </svg>\n ) : sortDirection === 'desc' ? (\n <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-4 w-4\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\" d=\"M19 9l-7 7-7-7\" />\n </svg>\n ) : (\n <div className=\"h-4 w-4 opacity-30\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-4 w-4\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\" d=\"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4\" />\n </svg>\n </div>\n )}\n </div>\n )}\n </div> : children}\n </th>\n );\n};\n\nexport type TableCaptionProps = React.HTMLAttributes<HTMLTableCaptionElement>;\nexport type TableFooterProps = React.HTMLAttributes<HTMLTableSectionElement>;\nconst TableCaption = (props: TableCaptionProps) => <caption {...props} />;\nconst TableFooter = (props: TableFooterProps) => {\n const options = React.useContext(CardContext);\n return <tfoot role={options ? 'rowgroup' : undefined} {...props} />;\n};\n\n// 扩展Table组件,添加子组件\nexport type TableCardProps = Omit<TableProps, 'card'>;\n\ninterface TableSubcomponents {\n Caption: React.FC<TableCaptionProps>;\n Footer: React.FC<TableFooterProps>;\n Head: React.FC<TableHeadProps>;\n Body: React.FC<TableBodyProps>;\n Row: React.FC<TableRowProps>;\n Cell: React.FC<TableCellProps>;\n HeaderCell: React.FC<TableHeaderCellProps>;\n}\n\nconst subcomponents: TableSubcomponents = {\n Caption: TableCaption,\n Footer: TableFooter,\n Head: TableHead,\n Body: TableBody,\n Row: TableRow,\n Cell: TableCell,\n HeaderCell: TableHeaderCell,\n};\n\nconst TableCard = (props: TableCardProps) => <Table {...props} card />;\nconst TableWithCompounds = Object.assign(Table, subcomponents, {\n Card: Object.assign(TableCard, subcomponents),\n});\n\nexport default TableWithCompounds; "],"mappings":";;;;;AAiBA,IAAM,IAAc,EAAM,cAAuC,IAAI,GAC/D,IAAc,EAAM,cAAc,EAAK,GACvC,IAAuC,CAAC,GAYxC,KAAS,EACb,aACA,eAAY,IACZ,UAAO,IACP,iBAAc,GACd,YACA,iBACA,iBACA,GAAG,QACa;CAGhB,IAAM,IAAe,EAAG,SAAW,KAAQ,oBAAoB,CAAS;CAExE,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ACJ,OAAO,IAAU;IAAE,GAAG,EAAQ;IAAY,GAAG;GAAM,IAAI;GACvD,WAAW;GACF;GACE;GACE;GACD;GACJ;GACM;GACA;GAEb,UAAA,IAAW,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACT,GACA,KACC,kBAAC,OAAD;KAAK,WAAU;KACZ,UAAA,MAAkB,QACjB,kBAAC,OAAD;MAAK,OAAM;MAA6B,WAAU;MAAU,MAAK;MAAO,SAAQ;MAAY,QAAO;MACjG,UAAA,kBAAC,QAAD;OAAM,eAAc;OAAQ,gBAAe;OAAQ,aAAY;OAAI,GAAE;MAAiB,CAAA;KACnF,CAAA,IACH,MAAkB,SACpB,kBAAC,OAAD;MAAK,OAAM;MAA6B,WAAU;MAAU,MAAK;MAAO,SAAQ;MAAY,QAAO;MACjG,UAAA,kBAAC,QAAD;OAAM,eAAc;OAAQ,gBAAe;OAAQ,aAAY;OAAI,GAAE;MAAkB,CAAA;KACpF,CAAA,IAEL,kBAAC,OAAD;MAAK,WAAU;MACb,UAAA,kBAAC,OAAD;OAAK,OAAM;OAA6B,WAAU;OAAU,MAAK;OAAO,SAAQ;OAAY,QAAO;OACjG,UAAA,kBAAC,QAAD;QAAM,eAAc;QAAQ,gBAAe;QAAQ,aAAY;QAAI,GAAE;OAAoD,CAAA;MACtH,CAAA;KACF,CAAA;IAEJ,CAAA,CAEJ;GAAI,CAAA,IAAA;EACP,CAAA;CAER;AA+BA,GAGM,IAAqB,OAAO,OAAO,GAAO,GAAe,EAC7D,MAAM,OAAO,QAFI,MAA0B,kBAAC,GAAD;CAAO,GAAI;CAAO,MAAA;AAAM,CAAA,GAEpC,CAAa,EAC9C,CAAC"}
|
|
@@ -6,6 +6,10 @@ export type TabItem<T extends string = string> = {
|
|
|
6
6
|
icon?: React.ReactNode;
|
|
7
7
|
/** 禁用该标签 */
|
|
8
8
|
disabled?: boolean;
|
|
9
|
+
/** Stable tab ID; use as the external panel's aria-labelledby. Generated when omitted. */
|
|
10
|
+
id?: string;
|
|
11
|
+
/** ID of a caller-rendered role="tabpanel". Omit when used only as a filter. */
|
|
12
|
+
panelId?: string;
|
|
9
13
|
};
|
|
10
14
|
export type TabsProps<T extends string = string> = {
|
|
11
15
|
items: readonly TabItem<T>[];
|
|
@@ -25,11 +29,18 @@ export type TabsProps<T extends string = string> = {
|
|
|
25
29
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
26
30
|
/** 占满可用宽度,各标签平分 */
|
|
27
31
|
block?: boolean;
|
|
32
|
+
/** Tablist ID and prefix for generated tab IDs. */
|
|
33
|
+
id?: string;
|
|
34
|
+
'aria-label'?: string;
|
|
35
|
+
'aria-labelledby'?: string;
|
|
36
|
+
orientation?: 'horizontal' | 'vertical';
|
|
37
|
+
/** Manual (default): arrows move focus; Enter/Space activate. Automatic: arrows also activate. */
|
|
38
|
+
activationMode?: 'manual' | 'automatic';
|
|
28
39
|
className?: string;
|
|
29
40
|
};
|
|
30
41
|
/**
|
|
31
42
|
* 标签页切换条。基于 daisyUI 5 的 `tabs` 系列修饰类,
|
|
32
43
|
* 支持 box / border / lift / pill 四种外观、五档尺寸与等宽(block)模式。
|
|
33
44
|
*/
|
|
34
|
-
declare function Tabs<T extends string = string>({ items, value, onChange, variant, size, block, className, }: TabsProps<T>): React.JSX.Element;
|
|
45
|
+
declare function Tabs<T extends string = string>({ items, value, onChange, variant, size, block, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, orientation, activationMode, className, }: TabsProps<T>): React.JSX.Element;
|
|
35
46
|
export default Tabs;
|
|
@@ -1,34 +1,59 @@
|
|
|
1
1
|
import { cn as e } from "../../utils/cn.js";
|
|
2
|
-
import "react";
|
|
3
|
-
import { jsx as
|
|
2
|
+
import { useId as t, useRef as n, useState as r } from "react";
|
|
3
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/Tabs/index.tsx
|
|
5
|
-
var
|
|
5
|
+
var o = {
|
|
6
6
|
xs: "tabs-xs",
|
|
7
7
|
sm: "tabs-sm",
|
|
8
8
|
md: "tabs-md",
|
|
9
9
|
lg: "tabs-lg",
|
|
10
10
|
xl: "tabs-xl"
|
|
11
11
|
};
|
|
12
|
-
function
|
|
13
|
-
let
|
|
14
|
-
|
|
12
|
+
function s({ items: s, value: c, onChange: l, variant: u = "box", size: d = "sm", block: f = !1, id: p, "aria-label": m, "aria-labelledby": h, orientation: g = "horizontal", activationMode: _ = "manual", className: v = "" }) {
|
|
13
|
+
let y = t(), b = p ?? `tabs-${y}`, x = n(/* @__PURE__ */ new Map()), [S, C] = r(null), w = s.filter((e) => !e.disabled), T = w.find((e) => e.key === S)?.key ?? w.find((e) => e.key === c)?.key ?? w[0]?.key, E = (e, t) => {
|
|
14
|
+
if (e.target !== e.currentTarget || e.defaultPrevented || e.nativeEvent.isComposing || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
15
|
+
let n = g === "vertical" ? "ArrowUp" : "ArrowLeft", r = g === "vertical" ? "ArrowDown" : "ArrowRight", i = w.findIndex((e) => e.key === t), a;
|
|
16
|
+
if (e.key === "Home") a = w[0];
|
|
17
|
+
else if (e.key === "End") a = w[w.length - 1];
|
|
18
|
+
else if (e.key === n || e.key === r) {
|
|
19
|
+
let t = e.key === r ? 1 : -1;
|
|
20
|
+
a = w[(i + t + w.length) % w.length];
|
|
21
|
+
} else return;
|
|
22
|
+
e.preventDefault(), e.stopPropagation(), a && (x.current.get(a.key)?.focus(), _ === "automatic" && a.key !== c && l(a.key));
|
|
23
|
+
}, D = u === "border" ? "tabs-border" : u === "lift" ? "tabs-lift" : u === "pill" ? "tabs-box dishui-tabs-pill" : "tabs-box";
|
|
24
|
+
return /* @__PURE__ */ i("div", {
|
|
25
|
+
id: b,
|
|
15
26
|
role: "tablist",
|
|
16
|
-
|
|
17
|
-
|
|
27
|
+
"aria-label": m,
|
|
28
|
+
"aria-labelledby": h,
|
|
29
|
+
"aria-orientation": g,
|
|
30
|
+
onBlur: (e) => {
|
|
31
|
+
e.currentTarget.contains(e.relatedTarget) || C(null);
|
|
32
|
+
},
|
|
33
|
+
className: e("tabs h-auto min-h-0", o[d], D, f && "w-full", g === "vertical" && "flex flex-col", v),
|
|
34
|
+
children: s.map((t) => /* @__PURE__ */ a("button", {
|
|
35
|
+
ref: (e) => {
|
|
36
|
+
e ? x.current.set(t.key, e) : x.current.delete(t.key);
|
|
37
|
+
},
|
|
38
|
+
id: t.id ?? `${b}-tab-${encodeURIComponent(t.key)}`,
|
|
18
39
|
role: "tab",
|
|
19
40
|
type: "button",
|
|
20
|
-
"aria-selected":
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
41
|
+
"aria-selected": c === t.key,
|
|
42
|
+
"aria-controls": t.panelId,
|
|
43
|
+
tabIndex: !t.disabled && t.key === T ? 0 : -1,
|
|
44
|
+
disabled: t.disabled,
|
|
45
|
+
onFocus: () => C(t.key),
|
|
46
|
+
onKeyDown: (e) => E(e, t.key),
|
|
47
|
+
onClick: () => l(t.key),
|
|
48
|
+
className: e("tab min-h-0 gap-1.5", f && "flex-1", c === t.key && "tab-active", t.disabled && "tab-disabled"),
|
|
49
|
+
children: [t.icon && /* @__PURE__ */ i("span", {
|
|
25
50
|
className: "[&>svg]:h-[1.1em] [&>svg]:w-[1.1em]",
|
|
26
|
-
children:
|
|
27
|
-
}),
|
|
28
|
-
},
|
|
51
|
+
children: t.icon
|
|
52
|
+
}), t.label]
|
|
53
|
+
}, t.key))
|
|
29
54
|
});
|
|
30
55
|
}
|
|
31
56
|
//#endregion
|
|
32
|
-
export {
|
|
57
|
+
export { s as default };
|
|
33
58
|
|
|
34
59
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Tabs/index.tsx"],"sourcesContent":["import React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type TabItem<T extends string = string> = {\n key: T;\n label: React.ReactNode;\n /** 可选:标签前的图标 */\n icon?: React.ReactNode;\n /** 禁用该标签 */\n disabled?: boolean;\n};\n\nexport type TabsProps<T extends string = string> = {\n items: readonly TabItem<T>[];\n /** 当前激活的 tab key */\n value: T;\n /** 切换回调 */\n onChange: (key: T) => void;\n /**\n * 外观(基于 daisyUI 5 的 tabs 修饰类):\n * - `box` 实心分段(tabs-box)\n * - `border` 底部下划线(tabs-border)\n * - `lift` 抬升的文件夹页签(tabs-lift)\n * - `pill` 胶囊/圆角实心(DishUI 扩展)\n */\n variant?: 'box' | 'border' | 'lift' | 'pill';\n /** 尺寸:xs / sm / md / lg / xl */\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n /** 占满可用宽度,各标签平分 */\n block?: boolean;\n className?: string;\n};\n\nconst SIZE_CLASS: Record<NonNullable<TabsProps['size']>, string> = {\n xs: 'tabs-xs',\n sm: 'tabs-sm',\n md: 'tabs-md',\n lg: 'tabs-lg',\n xl: 'tabs-xl',\n};\n\n/**\n * 标签页切换条。基于 daisyUI 5 的 `tabs` 系列修饰类,\n * 支持 box / border / lift / pill 四种外观、五档尺寸与等宽(block)模式。\n */\nfunction Tabs<T extends string = string>({\n items,\n value,\n onChange,\n variant = 'box',\n size = 'sm',\n block = false,\n className = '',\n}: TabsProps<T>) {\n // pill 是 DishUI 扩展:在 tabs-box 基础上追加胶囊圆角类(见 components.css)\n const variantClass =\n variant === 'border' ? 'tabs-border'\n : variant === 'lift' ? 'tabs-lift'\n : variant === 'pill' ? 'tabs-box dishui-tabs-pill'\n : 'tabs-box';\n\n return (\n <div\n role=\"tablist\"\n className={cn(\n 'tabs h-auto min-h-0',\n SIZE_CLASS[size],\n variantClass,\n block && 'w-full',\n className,\n )}\n >\n {items.map((item) => (\n <button\n key={item.key}\n role=\"tab\"\n type=\"button\"\n aria-selected={value === item.key}\n disabled={item.disabled}\n onClick={() => onChange(item.key)}\n className={cn(\n 'tab min-h-0 gap-1.5',\n block && 'flex-1',\n value === item.key && 'tab-active',\n item.disabled && 'tab-disabled',\n )}\n >\n {item.icon && <span className=\"[&>svg]:h-[1.1em] [&>svg]:w-[1.1em]\">{item.icon}</span>}\n {item.label}\n </button>\n ))}\n </div>\n );\n}\n\nexport default Tabs;\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Tabs/index.tsx"],"sourcesContent":["import React, { useId, useRef, useState } from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type TabItem<T extends string = string> = {\n key: T;\n label: React.ReactNode;\n /** 可选:标签前的图标 */\n icon?: React.ReactNode;\n /** 禁用该标签 */\n disabled?: boolean;\n /** Stable tab ID; use as the external panel's aria-labelledby. Generated when omitted. */\n id?: string;\n /** ID of a caller-rendered role=\"tabpanel\". Omit when used only as a filter. */\n panelId?: string;\n};\n\nexport type TabsProps<T extends string = string> = {\n items: readonly TabItem<T>[];\n /** 当前激活的 tab key */\n value: T;\n /** 切换回调 */\n onChange: (key: T) => void;\n /**\n * 外观(基于 daisyUI 5 的 tabs 修饰类):\n * - `box` 实心分段(tabs-box)\n * - `border` 底部下划线(tabs-border)\n * - `lift` 抬升的文件夹页签(tabs-lift)\n * - `pill` 胶囊/圆角实心(DishUI 扩展)\n */\n variant?: 'box' | 'border' | 'lift' | 'pill';\n /** 尺寸:xs / sm / md / lg / xl */\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n /** 占满可用宽度,各标签平分 */\n block?: boolean;\n /** Tablist ID and prefix for generated tab IDs. */\n id?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n orientation?: 'horizontal' | 'vertical';\n /** Manual (default): arrows move focus; Enter/Space activate. Automatic: arrows also activate. */\n activationMode?: 'manual' | 'automatic';\n className?: string;\n};\n\nconst SIZE_CLASS: Record<NonNullable<TabsProps['size']>, string> = {\n xs: 'tabs-xs',\n sm: 'tabs-sm',\n md: 'tabs-md',\n lg: 'tabs-lg',\n xl: 'tabs-xl',\n};\n\n/**\n * 标签页切换条。基于 daisyUI 5 的 `tabs` 系列修饰类,\n * 支持 box / border / lift / pill 四种外观、五档尺寸与等宽(block)模式。\n */\nfunction Tabs<T extends string = string>({\n items,\n value,\n onChange,\n variant = 'box',\n size = 'sm',\n block = false,\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n orientation = 'horizontal',\n activationMode = 'manual',\n className = '',\n}: TabsProps<T>) {\n const generatedId = useId();\n const listId = id ?? `tabs-${generatedId}`;\n const buttons = useRef(new Map<T, HTMLButtonElement>());\n const [focusedKey, setFocusedKey] = useState<T | null>(null);\n const enabledItems = items.filter(item => !item.disabled);\n const tabStop = enabledItems.find(item => item.key === focusedKey)?.key\n ?? enabledItems.find(item => item.key === value)?.key\n ?? enabledItems[0]?.key;\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>, key: T) => {\n if (event.target !== event.currentTarget || event.defaultPrevented || event.nativeEvent.isComposing || event.altKey || event.ctrlKey || event.metaKey) return;\n const previous = orientation === 'vertical' ? 'ArrowUp' : 'ArrowLeft';\n const next = orientation === 'vertical' ? 'ArrowDown' : 'ArrowRight';\n const index = enabledItems.findIndex(item => item.key === key);\n let target: TabItem<T> | undefined;\n if (event.key === 'Home') target = enabledItems[0];\n else if (event.key === 'End') target = enabledItems[enabledItems.length - 1];\n else if (event.key === previous || event.key === next) {\n const step = event.key === next ? 1 : -1;\n target = enabledItems[(index + step + enabledItems.length) % enabledItems.length];\n } else return; // Native button Enter/Space activation goes through onClick once.\n event.preventDefault();\n event.stopPropagation();\n if (!target) return;\n buttons.current.get(target.key)?.focus();\n if (activationMode === 'automatic' && target.key !== value) onChange(target.key);\n };\n // pill 是 DishUI 扩展:在 tabs-box 基础上追加胶囊圆角类(见 components.css)\n const variantClass =\n variant === 'border' ? 'tabs-border'\n : variant === 'lift' ? 'tabs-lift'\n : variant === 'pill' ? 'tabs-box dishui-tabs-pill'\n : 'tabs-box';\n\n return (\n <div\n id={listId}\n role=\"tablist\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-orientation={orientation}\n onBlur={event => {\n if (!event.currentTarget.contains(event.relatedTarget as Node | null)) setFocusedKey(null);\n }}\n className={cn(\n 'tabs h-auto min-h-0',\n SIZE_CLASS[size],\n variantClass,\n block && 'w-full',\n orientation === 'vertical' && 'flex flex-col',\n className,\n )}\n >\n {items.map((item) => (\n <button\n key={item.key}\n ref={element => {\n if (element) buttons.current.set(item.key, element);\n else buttons.current.delete(item.key);\n }}\n id={item.id ?? `${listId}-tab-${encodeURIComponent(item.key)}`}\n role=\"tab\"\n type=\"button\"\n aria-selected={value === item.key}\n aria-controls={item.panelId}\n tabIndex={!item.disabled && item.key === tabStop ? 0 : -1}\n disabled={item.disabled}\n onFocus={() => setFocusedKey(item.key)}\n onKeyDown={event => handleKeyDown(event, item.key)}\n onClick={() => onChange(item.key)}\n className={cn(\n 'tab min-h-0 gap-1.5',\n block && 'flex-1',\n value === item.key && 'tab-active',\n item.disabled && 'tab-disabled',\n )}\n >\n {item.icon && <span className=\"[&>svg]:h-[1.1em] [&>svg]:w-[1.1em]\">{item.icon}</span>}\n {item.label}\n </button>\n ))}\n </div>\n );\n}\n\nexport default Tabs;\n"],"mappings":";;;;AA4CA,IAAM,IAA6D;CAC/D,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACR;AAMA,SAAS,EAAgC,EACrC,UACA,UACA,aACA,aAAU,OACV,UAAO,MACP,WAAQ,IACR,OACA,cAAc,GACd,mBAAmB,GACnB,iBAAc,cACd,oBAAiB,UACjB,eAAY,MACC;CACb,IAAM,IAAc,EAAM,GACpB,IAAS,KAAM,QAAQ,KACvB,IAAU,kBAAO,IAAI,IAA0B,CAAC,GAChD,CAAC,GAAY,KAAiB,EAAmB,IAAI,GACrD,IAAe,EAAM,QAAO,MAAQ,CAAC,EAAK,QAAQ,GAClD,IAAU,EAAa,MAAK,MAAQ,EAAK,QAAQ,CAAU,CAAC,EAAE,OAC7D,EAAa,MAAK,MA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EAAK,MAAM,GAAG,EAAO,OAAO,mBAAmB,EAAK,GAAG;GAC3D,MAAK;GACL,MAAK;GACL,iBAAe,MAAU,EAAK;GAC9B,iBAAe,EAAK;GACpB,UAAU,CAAC,EAAK,YAAY,EAAK,QAAQ,IAAU,IAAI;GACvD,UAAU,EAAK;GACf,eAAe,EAAc,EAAK,GAAG;GACrC,YAAW,MAAS,EAAc,GAAO,EAAK,GAAG;GACjD,eAAe,EAAS,EAAK,GAAG;GAChC,WAAW,EACP,uBACA,KAAS,UACT,MAAU,EAAK,OAAO,cACtB,EAAK,YAAY,cACrB;GArBJ,UAAA,CAuBK,EAAK,QAAQ,kBAAC,QAAD;IAAM,WAAU;IAAuC,UAAA,EAAK;GAAW,CAAA,GACpF,EAAK,KACF;EAxBC,GAAA,EAAK,GAwBN,CACX;CACA,CAAA;AAEb"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { useContainerElement as e } from "../../../hooks/useContainerElement.js";
|
|
2
|
+
import { getMarkdownContent as t, getSelectionInfo as n } from "../../../utils/selection.js";
|
|
3
|
+
import { useClickOutside as r } from "../../../hooks/useClickOutside.js";
|
|
4
4
|
import { useCallback as i, useEffect as a, useRef as o, useState as s } from "react";
|
|
5
5
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/pro/ArticleContextMenu/index.tsx
|
|
@@ -8,8 +8,8 @@ var u = ({ targetId: u, targetRef: d, menuItems: f, className: p = "", enabled:
|
|
|
8
8
|
let [h, g] = s(!1), [_, v] = s({
|
|
9
9
|
x: 0,
|
|
10
10
|
y: 0
|
|
11
|
-
}), [y, b] = s(!1), x = o(null), S =
|
|
12
|
-
|
|
11
|
+
}), [y, b] = s(!1), x = o(null), S = e(u, d);
|
|
12
|
+
r(x, i(() => g(!1), []), h);
|
|
13
13
|
let C = i((e) => {
|
|
14
14
|
if (!m || !S) return;
|
|
15
15
|
let t = e.target, n = !1;
|
|
@@ -31,8 +31,8 @@ var u = ({ targetId: u, targetRef: d, menuItems: f, className: p = "", enabled:
|
|
|
31
31
|
}), g(!0);
|
|
32
32
|
}, [m, S]), w = i((e) => {
|
|
33
33
|
if (e.disabled) return;
|
|
34
|
-
let
|
|
35
|
-
e.action(
|
|
34
|
+
let r = t(S), i = n(S);
|
|
35
|
+
e.action(r, i), g(!1);
|
|
36
36
|
}, [S]);
|
|
37
37
|
return a(() => {
|
|
38
38
|
if (!h) return;
|