@expcat/tigercat-react 2.1.0 → 2.1.2
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/{chunk-RUAPTIQ7.mjs → chunk-246DAUEF.mjs} +2 -2
- package/dist/{chunk-PU3JY6RE.mjs → chunk-2JMI7TCM.mjs} +1 -1
- package/dist/{chunk-GCY55TBC.mjs → chunk-2XZHYYZ2.mjs} +106 -91
- package/dist/chunk-2YBLMVDT.mjs +428 -0
- package/dist/{chunk-25D5TXZH.mjs → chunk-32MCQMBJ.mjs} +8 -6
- package/dist/{chunk-6MGQAJ62.mjs → chunk-3GPGSNOQ.mjs} +71 -16
- package/dist/{chunk-M5MZWOHF.mjs → chunk-3HHEVMHE.mjs} +1 -1
- package/dist/{chunk-HSBN5MLS.mjs → chunk-3LACOSJQ.mjs} +1 -1
- package/dist/{chunk-F6WV53BS.mjs → chunk-3LDDXHW2.mjs} +28 -11
- package/dist/{chunk-IXQAECFP.mjs → chunk-3QNIFKVF.mjs} +12 -14
- package/dist/{chunk-UD4DTVJZ.mjs → chunk-4C2X5PZO.mjs} +57 -25
- package/dist/chunk-5JETWHLJ.mjs +28 -0
- package/dist/{chunk-VA6PZWOH.mjs → chunk-5SEMRHBD.mjs} +14 -6
- package/dist/{chunk-MXXAJSRS.mjs → chunk-6RMBUZZE.mjs} +11 -11
- package/dist/{chunk-EKILTLUO.mjs → chunk-72CJNKDY.mjs} +1 -1
- package/dist/{chunk-XE4YFBOZ.mjs → chunk-AUD3VOLO.mjs} +1 -1
- package/dist/{chunk-I4MWOYJS.mjs → chunk-AYFKHWJS.mjs} +13 -7
- package/dist/{chunk-RPSHILHD.mjs → chunk-BXAH2GH3.mjs} +8 -2
- package/dist/{chunk-EW5EO7VE.mjs → chunk-BYD7EAWK.mjs} +1 -1
- package/dist/{chunk-L55UK45A.mjs → chunk-CRIEUKMD.mjs} +5 -2
- package/dist/{chunk-DKNVSQSV.mjs → chunk-CUAXRBKO.mjs} +12 -0
- package/dist/{chunk-NWVNTZOP.mjs → chunk-DECUASRW.mjs} +14 -16
- package/dist/{chunk-XMTEMBQV.mjs → chunk-EAAWB3CK.mjs} +16 -13
- package/dist/{chunk-IR7VA6AO.mjs → chunk-EG7EMDKK.mjs} +1 -1
- package/dist/{chunk-HOYBHB7B.mjs → chunk-FNK2VWPP.mjs} +1 -1
- package/dist/{chunk-RJPNBYK5.mjs → chunk-FQS24AUH.mjs} +12 -3
- package/dist/{chunk-LADKKOJT.mjs → chunk-GBEDWXLL.mjs} +16 -10
- package/dist/{chunk-2ENQZECC.mjs → chunk-HAXRHSCN.mjs} +4 -3
- package/dist/{chunk-K4GIKSZE.mjs → chunk-I2BENK5X.mjs} +2 -1
- package/dist/{chunk-DNOPEJ5I.mjs → chunk-JZZPLKTW.mjs} +7 -4
- package/dist/{chunk-7KCQMXJA.mjs → chunk-KDURW5AS.mjs} +4 -3
- package/dist/{chunk-TFMEHUVZ.mjs → chunk-KKN7KLTB.mjs} +0 -1
- package/dist/{chunk-PFL4HNWM.mjs → chunk-M6ZPTGBV.mjs} +1 -2
- package/dist/{chunk-PXRZ6CKY.mjs → chunk-MJVSZ2UJ.mjs} +46 -16
- package/dist/{chunk-LZKBDQE4.mjs → chunk-MYI3FPG4.mjs} +23 -4
- package/dist/{chunk-OIGEBCAS.mjs → chunk-NADODEZX.mjs} +69 -1
- package/dist/{chunk-UKY2EPS3.mjs → chunk-NJWTZ5MO.mjs} +54 -42
- package/dist/{chunk-ASLRAZZN.mjs → chunk-NXJMVH26.mjs} +5 -2
- package/dist/{chunk-773LH7BK.mjs → chunk-O6VYD4E4.mjs} +24 -2
- package/dist/{chunk-G7D4QV7A.mjs → chunk-O7TV5OKS.mjs} +33 -6
- package/dist/{chunk-DPWRXXXW.mjs → chunk-OJ6SHHOZ.mjs} +3 -3
- package/dist/{chunk-UYJJLHVA.mjs → chunk-PMQJ6AYT.mjs} +23 -21
- package/dist/{chunk-KC55B62J.mjs → chunk-PY2VUNEJ.mjs} +143 -46
- package/dist/{chunk-BEJZPJIK.mjs → chunk-QOAOOD53.mjs} +10 -4
- package/dist/{chunk-JQJM65RJ.mjs → chunk-QU3QXUTC.mjs} +49 -23
- package/dist/{chunk-RQ4PUK6G.mjs → chunk-R7YZ6FKP.mjs} +24 -13
- package/dist/{chunk-YI6YWH66.mjs → chunk-RE5ZLA5D.mjs} +6 -6
- package/dist/{chunk-UCBW5RJN.mjs → chunk-RGVU4EMA.mjs} +11 -6
- package/dist/{chunk-IBSOUQGB.mjs → chunk-RRGPDFDI.mjs} +7 -4
- package/dist/{chunk-ZH5ZBLAN.mjs → chunk-RUQ3F3MV.mjs} +34 -7
- package/dist/{chunk-KVCI2346.mjs → chunk-S2V3HGLZ.mjs} +8 -7
- package/dist/{chunk-PGD5RPKF.mjs → chunk-SVIJ2UZA.mjs} +2 -1
- package/dist/{chunk-UETARXIK.mjs → chunk-SXWEFZOF.mjs} +246 -53
- package/dist/{chunk-H6MVW5YD.mjs → chunk-TEVEXDY2.mjs} +24 -13
- package/dist/{chunk-DJOFM2VO.mjs → chunk-TO6MZFNQ.mjs} +52 -40
- package/dist/{chunk-ZCGIZOMT.mjs → chunk-V7HJ5HLC.mjs} +6 -10
- package/dist/{chunk-SIDDYP3O.mjs → chunk-VJWSKJLJ.mjs} +1 -1
- package/dist/{chunk-ZG56T75O.mjs → chunk-WTHWLCRL.mjs} +51 -11
- package/dist/{chunk-KP6DEYWB.mjs → chunk-X4L3W7RQ.mjs} +1 -1
- package/dist/{chunk-ZMRTETN2.mjs → chunk-X6C6MNG5.mjs} +4 -3
- package/dist/{chunk-OGG2TQDG.mjs → chunk-XVHTJQ4T.mjs} +12 -1
- package/dist/{chunk-FSMJLJFL.mjs → chunk-Y6UH3EKE.mjs} +1 -1
- package/dist/{chunk-7EMCZVJ2.mjs → chunk-YH7FKFRM.mjs} +4 -4
- package/dist/chunk-YJ5T4XZN.mjs +81 -0
- package/dist/{chunk-VVNFXJMN.mjs → chunk-YNDPQVEK.mjs} +8 -1
- package/dist/{chunk-QGZ32NFQ.mjs → chunk-Z23KOLNU.mjs} +4 -3
- package/dist/{chunk-5CKMYMTS.mjs → chunk-ZATZRXMW.mjs} +27 -8
- package/dist/components/ActivityFeed.mjs +2 -2
- package/dist/components/Affix.mjs +1 -1
- package/dist/components/Anchor.mjs +1 -1
- package/dist/components/AreaChart.mjs +4 -3
- package/dist/components/AutoComplete.mjs +1 -1
- package/dist/components/BarChart.mjs +4 -3
- package/dist/components/Calendar.mjs +1 -1
- package/dist/components/Cascader.mjs +1 -1
- package/dist/components/ChartCanvas.mjs +1 -1
- package/dist/components/ChatWindow.mjs +3 -3
- package/dist/components/Code.mjs +3 -1
- package/dist/components/CollapsePanel.mjs +1 -1
- package/dist/components/ColorPicker.d.mts +3 -1
- package/dist/components/ColorPicker.mjs +3 -1
- package/dist/components/CommentThread.mjs +2 -2
- package/dist/components/DataExport.mjs +2 -2
- package/dist/components/DataTableWithToolbar.mjs +7 -7
- package/dist/components/DonutChart.mjs +4 -4
- package/dist/components/Dropdown.mjs +1 -1
- package/dist/components/FileManager.mjs +2 -1
- package/dist/components/FloatButton.mjs +1 -1
- package/dist/components/FormItem.mjs +1 -1
- package/dist/components/FormWizard.mjs +1 -1
- package/dist/components/FunnelChart.mjs +3 -3
- package/dist/components/Gantt.d.mts +3 -1
- package/dist/components/Gantt.mjs +2 -2
- package/dist/components/GaugeChart.mjs +2 -2
- package/dist/components/HeatmapChart.mjs +3 -3
- package/dist/components/Image.mjs +4 -4
- package/dist/components/ImageGroup.mjs +2 -2
- package/dist/components/ImagePreview.mjs +1 -1
- package/dist/components/Input.mjs +1 -1
- package/dist/components/InputNumber.d.mts +1 -1
- package/dist/components/InputNumber.mjs +1 -1
- package/dist/components/Kanban.mjs +2 -2
- package/dist/components/LineChart.mjs +4 -3
- package/dist/components/List.mjs +2 -2
- package/dist/components/Loading.mjs +1 -1
- package/dist/components/MarkdownEditor.mjs +1 -1
- package/dist/components/MaskInput.mjs +1 -1
- package/dist/components/NotificationCenter.mjs +4 -4
- package/dist/components/OrgChart.mjs +2 -2
- package/dist/components/Pagination.mjs +1 -1
- package/dist/components/PieChart.mjs +3 -3
- package/dist/components/Popconfirm.mjs +2 -2
- package/dist/components/Popover.mjs +2 -2
- package/dist/components/QRCode.d.mts +2 -2
- package/dist/components/QRCode.mjs +1 -1
- package/dist/components/RadarChart.mjs +3 -3
- package/dist/components/Rate.mjs +1 -1
- package/dist/components/RichTextEditor.mjs +1 -1
- package/dist/components/ScatterChart.mjs +4 -3
- package/dist/components/ScrollSpy.mjs +1 -1
- package/dist/components/Select.mjs +1 -1
- package/dist/components/Signature.mjs +1 -1
- package/dist/components/SplitButton.mjs +2 -2
- package/dist/components/Splitter.mjs +1 -1
- package/dist/components/Stepper.d.mts +2 -0
- package/dist/components/Stepper.mjs +2 -1
- package/dist/components/SunburstChart.mjs +3 -3
- package/dist/components/Switch.d.mts +5 -1
- package/dist/components/Switch.mjs +2 -1
- package/dist/components/Table.mjs +3 -3
- package/dist/components/TaskBoard.mjs +1 -1
- package/dist/components/Textarea.mjs +1 -1
- package/dist/components/Tooltip.mjs +2 -2
- package/dist/components/Tour.mjs +1 -1
- package/dist/components/TreeMapChart.mjs +3 -3
- package/dist/components/TreeSelect.mjs +1 -1
- package/dist/components/Upload.mjs +1 -1
- package/dist/hooks/useChartInteraction.d.mts +5 -0
- package/dist/hooks/useChartInteraction.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +57 -0
- package/package.json +2 -2
- package/dist/chunk-CB4SK5AU.mjs +0 -235
- package/dist/chunk-KPACLRQH.mjs +0 -55
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expcat/tigercat-react",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "React components for Tigercat UI library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Yizhe Wang",
|
|
@@ -897,7 +897,7 @@
|
|
|
897
897
|
"access": "public"
|
|
898
898
|
},
|
|
899
899
|
"dependencies": {
|
|
900
|
-
"@expcat/tigercat-core": "2.1.
|
|
900
|
+
"@expcat/tigercat-core": "2.1.2"
|
|
901
901
|
},
|
|
902
902
|
"devDependencies": {
|
|
903
903
|
"@types/node": "^26.1.1",
|
package/dist/chunk-CB4SK5AU.mjs
DELETED
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChartCanvas
|
|
3
|
-
} from "./chunk-DKNVSQSV.mjs";
|
|
4
|
-
|
|
5
|
-
// src/components/Gantt.tsx
|
|
6
|
-
import { useMemo, useState } from "react";
|
|
7
|
-
import {
|
|
8
|
-
classNames,
|
|
9
|
-
computeGanttLayout,
|
|
10
|
-
ganttAxisTextClasses,
|
|
11
|
-
ganttDependencyClasses,
|
|
12
|
-
ganttLabelClasses,
|
|
13
|
-
ganttProgressClasses,
|
|
14
|
-
ganttRowClasses,
|
|
15
|
-
ganttTodayLineClasses,
|
|
16
|
-
getChartInnerRect,
|
|
17
|
-
getGanttTaskAriaLabel,
|
|
18
|
-
getGanttTaskClasses
|
|
19
|
-
} from "@expcat/tigercat-core";
|
|
20
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
-
function Gantt({
|
|
22
|
-
data,
|
|
23
|
-
width = 760,
|
|
24
|
-
height = 360,
|
|
25
|
-
padding = 24,
|
|
26
|
-
scale = "week",
|
|
27
|
-
rowHeight = 40,
|
|
28
|
-
barHeight = 18,
|
|
29
|
-
taskLabelWidth = 140,
|
|
30
|
-
timelineHeight = 36,
|
|
31
|
-
minDate,
|
|
32
|
-
maxDate,
|
|
33
|
-
minBarWidth = 6,
|
|
34
|
-
showToday = false,
|
|
35
|
-
showProgress = true,
|
|
36
|
-
showDependencies = true,
|
|
37
|
-
hoverable = false,
|
|
38
|
-
selectable = false,
|
|
39
|
-
selectedId,
|
|
40
|
-
activeOpacity = 1,
|
|
41
|
-
inactiveOpacity = 0.35,
|
|
42
|
-
dateFormatter,
|
|
43
|
-
colors,
|
|
44
|
-
title,
|
|
45
|
-
desc,
|
|
46
|
-
ariaLabel = "Gantt chart",
|
|
47
|
-
className,
|
|
48
|
-
onTaskClick,
|
|
49
|
-
onTaskHover,
|
|
50
|
-
onSelectedIdChange
|
|
51
|
-
}) {
|
|
52
|
-
const [innerSelectedId, setInnerSelectedId] = useState(null);
|
|
53
|
-
const [hoveredId, setHoveredId] = useState(null);
|
|
54
|
-
const resolvedSelectedId = selectedId === void 0 ? innerSelectedId : selectedId;
|
|
55
|
-
const innerRect = useMemo(
|
|
56
|
-
() => getChartInnerRect(width, height, padding),
|
|
57
|
-
[height, padding, width]
|
|
58
|
-
);
|
|
59
|
-
const layout = useMemo(
|
|
60
|
-
() => computeGanttLayout(data, {
|
|
61
|
-
width: innerRect.width,
|
|
62
|
-
rowHeight,
|
|
63
|
-
barHeight,
|
|
64
|
-
taskLabelWidth,
|
|
65
|
-
timelineHeight,
|
|
66
|
-
minDate,
|
|
67
|
-
maxDate,
|
|
68
|
-
minBarWidth,
|
|
69
|
-
scale,
|
|
70
|
-
colors,
|
|
71
|
-
today: showToday ? /* @__PURE__ */ new Date() : void 0,
|
|
72
|
-
dateFormatter
|
|
73
|
-
}),
|
|
74
|
-
[
|
|
75
|
-
barHeight,
|
|
76
|
-
colors,
|
|
77
|
-
data,
|
|
78
|
-
dateFormatter,
|
|
79
|
-
innerRect.width,
|
|
80
|
-
maxDate,
|
|
81
|
-
minBarWidth,
|
|
82
|
-
minDate,
|
|
83
|
-
rowHeight,
|
|
84
|
-
scale,
|
|
85
|
-
showToday,
|
|
86
|
-
taskLabelWidth,
|
|
87
|
-
timelineHeight
|
|
88
|
-
]
|
|
89
|
-
);
|
|
90
|
-
const activeId = resolvedSelectedId ?? hoveredId;
|
|
91
|
-
const selectTask = (task) => {
|
|
92
|
-
if (selectable && !task.task.disabled) {
|
|
93
|
-
const nextId = resolvedSelectedId === task.id ? null : task.id;
|
|
94
|
-
if (selectedId === void 0) setInnerSelectedId(nextId);
|
|
95
|
-
onSelectedIdChange?.(nextId);
|
|
96
|
-
}
|
|
97
|
-
onTaskClick?.(task.task);
|
|
98
|
-
};
|
|
99
|
-
const setHoveredTask = (task) => {
|
|
100
|
-
if (!hoverable) return;
|
|
101
|
-
setHoveredId(task?.id ?? null);
|
|
102
|
-
onTaskHover?.(task?.task ?? null);
|
|
103
|
-
};
|
|
104
|
-
const getTaskOpacity = (task) => {
|
|
105
|
-
if (activeId === null) return activeOpacity;
|
|
106
|
-
return activeId === task.id ? activeOpacity : inactiveOpacity;
|
|
107
|
-
};
|
|
108
|
-
return /* @__PURE__ */ jsx(
|
|
109
|
-
ChartCanvas,
|
|
110
|
-
{
|
|
111
|
-
width,
|
|
112
|
-
height,
|
|
113
|
-
padding,
|
|
114
|
-
title,
|
|
115
|
-
desc,
|
|
116
|
-
className: classNames(className),
|
|
117
|
-
role: "img",
|
|
118
|
-
"aria-label": ariaLabel,
|
|
119
|
-
children: /* @__PURE__ */ jsxs("g", { "data-series-type": "gantt", children: [
|
|
120
|
-
/* @__PURE__ */ jsxs("g", { "data-gantt-axis": "true", children: [
|
|
121
|
-
/* @__PURE__ */ jsx(
|
|
122
|
-
"line",
|
|
123
|
-
{
|
|
124
|
-
x1: taskLabelWidth,
|
|
125
|
-
x2: layout.width,
|
|
126
|
-
y1: timelineHeight - 1,
|
|
127
|
-
y2: timelineHeight - 1,
|
|
128
|
-
stroke: "var(--tiger-border,#d1d5db)"
|
|
129
|
-
}
|
|
130
|
-
),
|
|
131
|
-
layout.ticks.map((tick) => /* @__PURE__ */ jsxs("g", { children: [
|
|
132
|
-
/* @__PURE__ */ jsx(
|
|
133
|
-
"line",
|
|
134
|
-
{
|
|
135
|
-
x1: tick.x,
|
|
136
|
-
x2: tick.x,
|
|
137
|
-
y1: 0,
|
|
138
|
-
y2: layout.height,
|
|
139
|
-
stroke: "var(--tiger-border,#e5e7eb)"
|
|
140
|
-
}
|
|
141
|
-
),
|
|
142
|
-
/* @__PURE__ */ jsx("text", { x: tick.x + 4, y: 16, className: ganttAxisTextClasses, children: tick.label })
|
|
143
|
-
] }, `${tick.label}-${tick.x}`))
|
|
144
|
-
] }),
|
|
145
|
-
/* @__PURE__ */ jsx("g", { "data-gantt-rows": "true", children: layout.tasks.map((task) => /* @__PURE__ */ jsx(
|
|
146
|
-
"rect",
|
|
147
|
-
{
|
|
148
|
-
x: 0,
|
|
149
|
-
y: timelineHeight + task.index * rowHeight,
|
|
150
|
-
width: layout.width,
|
|
151
|
-
height: rowHeight,
|
|
152
|
-
className: task.index % 2 === 0 ? ganttRowClasses : void 0,
|
|
153
|
-
opacity: task.index % 2 === 0 ? 0.75 : 0
|
|
154
|
-
},
|
|
155
|
-
`row-${task.id}`
|
|
156
|
-
)) }),
|
|
157
|
-
showToday && layout.todayX !== null ? /* @__PURE__ */ jsx(
|
|
158
|
-
"line",
|
|
159
|
-
{
|
|
160
|
-
x1: layout.todayX,
|
|
161
|
-
x2: layout.todayX,
|
|
162
|
-
y1: 0,
|
|
163
|
-
y2: layout.height,
|
|
164
|
-
className: ganttTodayLineClasses,
|
|
165
|
-
"data-gantt-today": "true"
|
|
166
|
-
}
|
|
167
|
-
) : null,
|
|
168
|
-
showDependencies ? /* @__PURE__ */ jsx("g", { "data-gantt-dependencies": "true", children: layout.dependencies.map((dependency) => /* @__PURE__ */ jsx(
|
|
169
|
-
"path",
|
|
170
|
-
{
|
|
171
|
-
d: dependency.path,
|
|
172
|
-
className: ganttDependencyClasses
|
|
173
|
-
},
|
|
174
|
-
`${dependency.sourceId}-${dependency.targetId}`
|
|
175
|
-
)) }) : null,
|
|
176
|
-
/* @__PURE__ */ jsx("g", { "data-gantt-tasks": "true", children: layout.tasks.map((task) => {
|
|
177
|
-
const selected = resolvedSelectedId === task.id;
|
|
178
|
-
const interactive = (hoverable || selectable) && !task.task.disabled;
|
|
179
|
-
return /* @__PURE__ */ jsxs("g", { opacity: getTaskOpacity(task), children: [
|
|
180
|
-
/* @__PURE__ */ jsx("text", { x: 0, y: task.y + task.height / 2 + 4, className: ganttLabelClasses, children: task.task.label }),
|
|
181
|
-
/* @__PURE__ */ jsxs(
|
|
182
|
-
"g",
|
|
183
|
-
{
|
|
184
|
-
className: getGanttTaskClasses(interactive, selected),
|
|
185
|
-
role: interactive ? "button" : "group",
|
|
186
|
-
tabIndex: interactive ? 0 : void 0,
|
|
187
|
-
"aria-label": getGanttTaskAriaLabel(task.task),
|
|
188
|
-
onMouseEnter: () => setHoveredTask(task),
|
|
189
|
-
onMouseLeave: () => setHoveredTask(null),
|
|
190
|
-
onClick: () => selectTask(task),
|
|
191
|
-
onKeyDown: (event) => {
|
|
192
|
-
if (event.key === "Enter" || event.key === " ") {
|
|
193
|
-
event.preventDefault();
|
|
194
|
-
selectTask(task);
|
|
195
|
-
}
|
|
196
|
-
},
|
|
197
|
-
children: [
|
|
198
|
-
/* @__PURE__ */ jsx(
|
|
199
|
-
"rect",
|
|
200
|
-
{
|
|
201
|
-
x: task.x,
|
|
202
|
-
y: task.y,
|
|
203
|
-
width: task.width,
|
|
204
|
-
height: task.height,
|
|
205
|
-
rx: 4,
|
|
206
|
-
fill: task.color,
|
|
207
|
-
stroke: selected ? "var(--tiger-text,#111827)" : void 0,
|
|
208
|
-
strokeWidth: selected ? 2 : void 0
|
|
209
|
-
}
|
|
210
|
-
),
|
|
211
|
-
showProgress && task.progressWidth > 0 ? /* @__PURE__ */ jsx(
|
|
212
|
-
"rect",
|
|
213
|
-
{
|
|
214
|
-
x: task.x,
|
|
215
|
-
y: task.y,
|
|
216
|
-
width: task.progressWidth,
|
|
217
|
-
height: task.height,
|
|
218
|
-
rx: 4,
|
|
219
|
-
className: ganttProgressClasses
|
|
220
|
-
}
|
|
221
|
-
) : null
|
|
222
|
-
]
|
|
223
|
-
}
|
|
224
|
-
)
|
|
225
|
-
] }, task.id);
|
|
226
|
-
}) })
|
|
227
|
-
] })
|
|
228
|
-
}
|
|
229
|
-
);
|
|
230
|
-
}
|
|
231
|
-
Gantt.displayName = "Gantt";
|
|
232
|
-
|
|
233
|
-
export {
|
|
234
|
-
Gantt
|
|
235
|
-
};
|
package/dist/chunk-KPACLRQH.mjs
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// src/components/Code.tsx
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
import {
|
|
4
|
-
codeBlockPreClasses,
|
|
5
|
-
copyTextToClipboard,
|
|
6
|
-
getCodeBlockContainerClasses,
|
|
7
|
-
getCodeBlockCopyButtonClasses
|
|
8
|
-
} from "@expcat/tigercat-core";
|
|
9
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
var Code = ({
|
|
11
|
-
code,
|
|
12
|
-
copyable = true,
|
|
13
|
-
copyLabel = "\u590D\u5236",
|
|
14
|
-
copiedLabel = "\u5DF2\u590D\u5236",
|
|
15
|
-
onCopy,
|
|
16
|
-
className,
|
|
17
|
-
...props
|
|
18
|
-
}) => {
|
|
19
|
-
const [isCopied, setIsCopied] = useState(false);
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
if (!isCopied) return;
|
|
22
|
-
const timer = window.setTimeout(() => {
|
|
23
|
-
setIsCopied(false);
|
|
24
|
-
}, 1500);
|
|
25
|
-
return () => window.clearTimeout(timer);
|
|
26
|
-
}, [isCopied]);
|
|
27
|
-
const handleCopy = async () => {
|
|
28
|
-
if (!copyable) return;
|
|
29
|
-
const ok = await copyTextToClipboard(code);
|
|
30
|
-
if (!ok) return;
|
|
31
|
-
setIsCopied(true);
|
|
32
|
-
onCopy?.(code);
|
|
33
|
-
};
|
|
34
|
-
const containerClasses = getCodeBlockContainerClasses(className);
|
|
35
|
-
const copyButtonClasses = getCodeBlockCopyButtonClasses(isCopied);
|
|
36
|
-
return /* @__PURE__ */ jsxs("div", { className: containerClasses, ...props, children: [
|
|
37
|
-
/* @__PURE__ */ jsx("pre", { className: codeBlockPreClasses, children: /* @__PURE__ */ jsx("code", { className: "block", children: code }) }),
|
|
38
|
-
copyable && /* @__PURE__ */ jsx(
|
|
39
|
-
"button",
|
|
40
|
-
{
|
|
41
|
-
type: "button",
|
|
42
|
-
className: copyButtonClasses,
|
|
43
|
-
onClick: handleCopy,
|
|
44
|
-
"aria-label": isCopied ? copiedLabel : copyLabel,
|
|
45
|
-
children: isCopied ? copiedLabel : copyLabel
|
|
46
|
-
}
|
|
47
|
-
)
|
|
48
|
-
] });
|
|
49
|
-
};
|
|
50
|
-
var Code_default = Code;
|
|
51
|
-
|
|
52
|
-
export {
|
|
53
|
-
Code,
|
|
54
|
-
Code_default
|
|
55
|
-
};
|