react-public-components 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/index.cjs +24 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +24 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,8 +27,8 @@ import CollapsibleBox from './CollapseBox';
|
|
|
27
27
|
| `title` | `string` | `'内容区域'` | 标题(当前版本内部隐藏渲染,仅作为占位属性保留) |
|
|
28
28
|
| `direction` | `'horizontal' \| 'vertical'` | `'horizontal'` | 折叠方向:`horizontal` 沿 X 轴收起,`vertical` 沿 Y 轴收起 |
|
|
29
29
|
| `buttonPosition` | `'right' \| 'left' \| 'top' \| 'bottom'` | `'right'` | 切换按钮位置。`horizontal` 时建议 `left`/`right`,`vertical` 时建议 `top`/`bottom` |
|
|
30
|
-
| `defaultWidth` | `number`
|
|
31
|
-
| `defaultHeight` | `number`
|
|
30
|
+
| `defaultWidth` | `number \| string` | `600` | 容器宽度(支持像素数字如 `500` 或百分比字符串如 `'50%'`) |
|
|
31
|
+
| `defaultHeight` | `number \| string` | `300` | 容器高度(支持像素数字如 `300` 或百分比字符串如 `'50%'`) |
|
|
32
32
|
| `contentPadding` | `string` | `'16px'` | 内容区内边距 |
|
|
33
33
|
| `headerHeight` | `number` | `16` | 头部预留高度,用于计算内容区最大高度 |
|
|
34
34
|
|
package/dist/index.cjs
CHANGED
|
@@ -109,7 +109,10 @@ var DownOutlined = ({ style, className }) => /* @__PURE__ */ (0, import_jsx_runt
|
|
|
109
109
|
|
|
110
110
|
// CollapseBox/index.tsx
|
|
111
111
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
112
|
-
var
|
|
112
|
+
var formatDimension = (value) => {
|
|
113
|
+
if (value === void 0 || value === null) return void 0;
|
|
114
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
115
|
+
};
|
|
113
116
|
var ChevronLeft = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LeftOutlined, {});
|
|
114
117
|
var ChevronRight = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RightOutlined, {});
|
|
115
118
|
var ChevronUp = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(UpOutlined, {});
|
|
@@ -125,7 +128,15 @@ var CollapsibleBox = ({
|
|
|
125
128
|
headerHeight = 16
|
|
126
129
|
}) => {
|
|
127
130
|
const [isExpanded, setIsExpanded] = (0, import_react.useState)(true);
|
|
128
|
-
const
|
|
131
|
+
const getContentMaxHeight = () => {
|
|
132
|
+
if (typeof defaultHeight === "number") {
|
|
133
|
+
return `${defaultHeight - headerHeight}px`;
|
|
134
|
+
}
|
|
135
|
+
if (typeof defaultHeight === "string") {
|
|
136
|
+
return headerHeight ? `calc(${defaultHeight} - ${headerHeight}px)` : defaultHeight;
|
|
137
|
+
}
|
|
138
|
+
return "100%";
|
|
139
|
+
};
|
|
129
140
|
const getIcon = () => {
|
|
130
141
|
if (direction === "horizontal") {
|
|
131
142
|
if (buttonPosition === "right") {
|
|
@@ -149,35 +160,38 @@ var CollapsibleBox = ({
|
|
|
149
160
|
}
|
|
150
161
|
};
|
|
151
162
|
const getContainerStyle = () => {
|
|
152
|
-
const resolvedHeight =
|
|
163
|
+
const resolvedHeight = formatDimension(defaultHeight);
|
|
164
|
+
const resolvedWidth = formatDimension(defaultWidth);
|
|
153
165
|
if (direction === "horizontal") {
|
|
154
166
|
return {
|
|
155
|
-
width: isExpanded ?
|
|
167
|
+
width: isExpanded ? resolvedWidth : "0px",
|
|
156
168
|
height: resolvedHeight,
|
|
157
169
|
minWidth: 0
|
|
158
170
|
};
|
|
159
171
|
} else {
|
|
160
172
|
return {
|
|
161
173
|
height: isExpanded ? resolvedHeight : "0px",
|
|
162
|
-
width:
|
|
174
|
+
width: resolvedWidth,
|
|
163
175
|
minHeight: 0
|
|
164
176
|
};
|
|
165
177
|
}
|
|
166
178
|
};
|
|
167
179
|
const wrapperClass = direction === "horizontal" ? "collapsible-wrapper horizontal" : "collapsible-wrapper vertical";
|
|
168
180
|
const containerClass = direction === "horizontal" && buttonPosition === "right" ? "collapsible-container align-right" : "collapsible-container";
|
|
169
|
-
const height =
|
|
181
|
+
const height = getContentMaxHeight();
|
|
170
182
|
const contentStyle = {
|
|
171
|
-
maxHeight: direction === "vertical" ? isExpanded ?
|
|
183
|
+
maxHeight: direction === "vertical" ? isExpanded ? height : "0px" : height,
|
|
172
184
|
overflowY: "auto",
|
|
173
185
|
padding: direction === "vertical" && !isExpanded ? "0px" : contentPadding,
|
|
174
186
|
boxSizing: "border-box"
|
|
175
187
|
};
|
|
176
188
|
const buttonStyle = direction === "vertical" && buttonPosition === "bottom" && !isExpanded ? { top: "0px", bottom: "auto" } : {};
|
|
189
|
+
const formattedWidth = formatDimension(defaultWidth);
|
|
190
|
+
const formattedHeight = formatDimension(defaultHeight);
|
|
177
191
|
const wrapperStyle = direction === "vertical" ? isExpanded ? {
|
|
178
|
-
height:
|
|
179
|
-
width:
|
|
180
|
-
} : { height: 0, width:
|
|
192
|
+
height: formattedHeight,
|
|
193
|
+
width: formattedWidth
|
|
194
|
+
} : { height: 0, width: formattedWidth } : void 0;
|
|
181
195
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: wrapperClass, style: wrapperStyle, children: [
|
|
182
196
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: getContainerStyle(), className: containerClass, children: [
|
|
183
197
|
title && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "collapsible-header", style: { display: "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: title }) }),
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../CollapseBox/index.tsx","../src/icons.tsx","../Splitter/index.tsx"],"sourcesContent":["// 统一入口\nexport { default as CollapseBox } from '../CollapseBox';\nexport type {\n CollapseBoxProps,\n CollapseBoxDirection,\n CollapseBoxButtonPosition,\n} from '../CollapseBox';\n\nexport { default as Splitter } from '../Splitter';\nexport type {\n SplitterProps,\n SplitterPanelProps,\n SplitterSize,\n SplitterOrientation,\n} from '../Splitter';\n","import { useState, type CSSProperties, type ReactNode } from 'react';\nimport { DownOutlined, LeftOutlined, RightOutlined, UpOutlined } from '../src/icons';\nimport './index.less';\n\nexport type CollapseBoxDirection = 'horizontal' | 'vertical';\nexport type CollapseBoxButtonPosition = 'left' | 'right' | 'top' | 'bottom';\n\nexport interface CollapseBoxProps {\n children?: ReactNode;\n title?: string;\n direction?: CollapseBoxDirection;\n buttonPosition?: CollapseBoxButtonPosition;\n defaultWidth?: number;\n defaultHeight?: number;\n contentPadding?: string;\n headerHeight?: number;\n}\n\nconst isNumber = (value: unknown): value is number => typeof value === 'number' && !Number.isNaN(value);\n\nconst ChevronLeft = () => <LeftOutlined />;\n\nconst ChevronRight = () => <RightOutlined />;\n\nconst ChevronUp = () => <UpOutlined />;\n\nconst ChevronDown = () => <DownOutlined />;\n\nconst CollapsibleBox = ({\n children,\n title = '内容区域',\n direction = 'horizontal',\n buttonPosition = 'right',\n defaultWidth = 600,\n defaultHeight = 300,\n contentPadding = '16px',\n headerHeight = 16,\n}: CollapseBoxProps) => {\n const [isExpanded, setIsExpanded] = useState(true);\n const contentMaxHeight = isNumber(defaultHeight) ? defaultHeight - headerHeight : '100%';\n\n const getIcon = () => {\n if (direction === 'horizontal') {\n if (buttonPosition === 'right') {\n return isExpanded ? <ChevronRight /> : <ChevronLeft />;\n } else {\n return isExpanded ? <ChevronLeft /> : <ChevronRight />;\n }\n } else {\n if (buttonPosition === 'bottom') {\n return isExpanded ? <ChevronUp /> : <ChevronDown />;\n } else {\n return isExpanded ? <ChevronDown /> : <ChevronUp />;\n }\n }\n };\n\n const getButtonClass = () => {\n if (direction === 'horizontal') {\n return buttonPosition === 'right' ? 'button-right' : 'button-left';\n } else {\n return buttonPosition === 'bottom' ? 'button-bottom' : 'button-top';\n }\n };\n\n const getContainerStyle = (): CSSProperties => {\n const resolvedHeight = isNumber(defaultHeight) ? `${defaultHeight}px` : defaultHeight;\n if (direction === 'horizontal') {\n return {\n width: isExpanded ? defaultWidth : '0px',\n height: resolvedHeight,\n minWidth: 0,\n };\n } else {\n return {\n height: isExpanded ? resolvedHeight : '0px',\n width: defaultWidth,\n minHeight: 0,\n };\n }\n };\n\n const wrapperClass =\n direction === 'horizontal' ? 'collapsible-wrapper horizontal' : 'collapsible-wrapper vertical';\n\n const containerClass =\n direction === 'horizontal' && buttonPosition === 'right'\n ? 'collapsible-container align-right'\n : 'collapsible-container';\n const height = isNumber(contentMaxHeight) ? contentMaxHeight + 'px' : '100%';\n const contentStyle: CSSProperties = {\n maxHeight: direction === 'vertical' ? (isExpanded ? `${height}` : '0px') : `${height}`,\n overflowY: 'auto',\n padding: direction === 'vertical' && !isExpanded ? '0px' : contentPadding,\n boxSizing: 'border-box',\n };\n\n // 折叠时(纵向 + 底部按钮):按钮需切换为 top:0 定位,使其显示在折叠线下方\n const buttonStyle: CSSProperties =\n direction === 'vertical' && buttonPosition === 'bottom' && !isExpanded\n ? { top: '0px', bottom: 'auto' }\n : {};\n\n // 让 wrapper 高度跟随容器,确保 bottom:0 的按钮贴住容器底部\n // 折叠时 wrapper 高度为 0,配合按钮的 translateY(-100%) 让按钮显示在折叠线上方\n const wrapperStyle: CSSProperties | undefined =\n direction === 'vertical'\n ? isExpanded\n ? {\n height: isNumber(defaultHeight) ? `${defaultHeight}px` : undefined,\n width: defaultWidth,\n }\n : { height: 0, width: defaultWidth }\n : undefined;\n\n return (\n <div className={wrapperClass} style={wrapperStyle}>\n <div style={getContainerStyle()} className={containerClass}>\n {title && (\n <div className=\"collapsible-header\" style={{ display: 'none' }}>\n <h3>{title}</h3>\n </div>\n )}\n\n <div className=\"collapsible-content\" style={contentStyle}>\n {children}\n </div>\n </div>\n\n <div\n onClick={() => setIsExpanded(!isExpanded)}\n className={`toggle-button ${getButtonClass()}`}\n style={buttonStyle}\n title={isExpanded ? '隐藏' : '展开'}\n >\n {getIcon()}\n </div>\n </div>\n );\n};\n\nexport default CollapsibleBox;\n","import type { CSSProperties } from 'react';\n\ninterface IconProps {\n style?: CSSProperties;\n className?: string;\n}\n\nconst baseStyle: CSSProperties = {\n display: 'inline-block',\n width: '1em',\n height: '1em',\n verticalAlign: '-0.125em',\n};\n\nexport const LeftOutlined = ({ style, className }: IconProps) => (\n <svg\n viewBox=\"0 0 1024 1024\"\n focusable=\"false\"\n data-icon=\"left\"\n width=\"1em\"\n height=\"1em\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n style={{ ...baseStyle, ...style }}\n className={className}\n >\n <path d=\"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z\" />\n </svg>\n);\n\nexport const RightOutlined = ({ style, className }: IconProps) => (\n <svg\n viewBox=\"0 0 1024 1024\"\n focusable=\"false\"\n data-icon=\"right\"\n width=\"1em\"\n height=\"1em\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n style={{ ...baseStyle, ...style }}\n className={className}\n >\n <path d=\"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z\" />\n </svg>\n);\n\nexport const UpOutlined = ({ style, className }: IconProps) => (\n <svg\n viewBox=\"0 0 1024 1024\"\n focusable=\"false\"\n data-icon=\"up\"\n width=\"1em\"\n height=\"1em\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n style={{ ...baseStyle, ...style }}\n className={className}\n >\n <path d=\"M890.5 755.3L537.4 268a31.96 31.96 0 00-50.8 0L133.5 755.3a7.95 7.95 0 006.3 12.7h75.5c4.9 0 9.6-2.3 12.6-6.1l281-360 281 360c3 3.8 7.7 6.1 12.6 6.1h75.5c6.7 0 10.4-7.6 6.1-12.7z\" />\n </svg>\n);\n\nexport const DownOutlined = ({ style, className }: IconProps) => (\n <svg\n viewBox=\"0 0 1024 1024\"\n focusable=\"false\"\n data-icon=\"down\"\n width=\"1em\"\n height=\"1em\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n style={{ ...baseStyle, ...style }}\n className={className}\n >\n <path d=\"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 37 17.6 49.8 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z\" />\n </svg>\n);\n","import { DownOutlined, LeftOutlined, RightOutlined, UpOutlined } from '../src/icons';\r\nimport type {\r\n CSSProperties,\r\n ReactElement,\r\n ReactNode,\r\n PointerEvent as ReactPointerEvent,\r\n} from 'react';\r\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\r\n\r\nexport type SplitterSize = number | `${number}%`;\r\nexport type SplitterOrientation = 'horizontal' | 'vertical';\r\n\r\nexport type SplitterPanelProps = {\r\n children?: ReactNode;\r\n collapsible?: boolean;\r\n defaultSize?: SplitterSize;\r\n max?: SplitterSize;\r\n min?: SplitterSize;\r\n resizable?: boolean;\r\n size?: SplitterSize;\r\n style?: CSSProperties;\r\n};\r\n\r\nexport type SplitterProps = {\r\n children: ReactNode;\r\n className?: string;\r\n lazy?: boolean;\r\n onResize?: (sizes: number[]) => void;\r\n onResizeEnd?: (sizes: number[]) => void;\r\n onResizeStart?: (sizes: number[]) => void;\r\n orientation?: SplitterOrientation;\r\n style?: CSSProperties;\r\n vertical?: boolean;\r\n};\r\n\r\ntype SplitterComponent = React.FC<SplitterProps> & {\r\n Panel: React.FC<SplitterPanelProps>;\r\n};\r\n\r\nconst DRAGGER_SIZE = 8;\r\nconst MIN_PANEL_SIZE = 0;\r\n\r\nconst SplitterPanel: React.FC<SplitterPanelProps> = ({ children }) => <>{children}</>;\r\n\r\nconst isPercentSize = (value: SplitterSize): value is `${number}%` =>\r\n typeof value === 'string' && value.endsWith('%');\r\n\r\nconst parseSize = (value: SplitterSize | undefined, total: number, fallback: number) => {\r\n if (value === undefined) {\r\n return fallback;\r\n }\r\n\r\n if (isPercentSize(value)) {\r\n return (Number.parseFloat(value) / 100) * total;\r\n }\r\n\r\n return Number(value);\r\n};\r\n\r\nconst roundSizes = (sizes: number[]) => sizes.map((size) => Math.round(size));\r\n\r\nconst getPointerPosition = (\r\n event: PointerEvent | ReactPointerEvent,\r\n orientation: SplitterOrientation,\r\n) => (orientation === 'horizontal' ? event.clientX : event.clientY);\r\n\r\nconst clamp = (value: number, min: number, max: number) => Math.min(Math.max(value, min), max);\r\n\r\nconst CustomSplitter: SplitterComponent = ({\r\n children,\r\n className,\r\n lazy = false,\r\n onResize,\r\n onResizeEnd,\r\n onResizeStart,\r\n orientation,\r\n style,\r\n vertical = false,\r\n}) => {\r\n const resolvedOrientation = orientation ?? (vertical ? 'vertical' : 'horizontal');\r\n const rootRef = useRef<HTMLDivElement>(null);\r\n const sizesRef = useRef<number[]>([]);\r\n const lastNonZeroSizesRef = useRef<number[]>([]);\r\n const [containerSize, setContainerSize] = useState(0);\r\n const [draggingIndex, setDraggingIndex] = useState<number | null>(null);\r\n const [hoveredIndex, setHoveredIndex] = useState<number | null>(null);\r\n const [sizes, setSizes] = useState<number[]>([]);\r\n\r\n const panels = useMemo(\r\n () =>\r\n React.Children.toArray(children).filter(\r\n React.isValidElement,\r\n ) as ReactElement<SplitterPanelProps>[],\r\n [children],\r\n );\r\n\r\n const trackSize = Math.max(0, containerSize - Math.max(0, panels.length - 1) * DRAGGER_SIZE);\r\n\r\n const getPanelMin = useCallback(\r\n (index: number) => parseSize(panels[index]?.props.min, trackSize, MIN_PANEL_SIZE),\r\n [panels, trackSize],\r\n );\r\n\r\n const getPanelMax = useCallback(\r\n (index: number) => parseSize(panels[index]?.props.max, trackSize, trackSize),\r\n [panels, trackSize],\r\n );\r\n\r\n const normalizeToTrack = useCallback(\r\n (nextSizes: number[]) => {\r\n if (!trackSize || !nextSizes.length) {\r\n return nextSizes;\r\n }\r\n\r\n const normalized = [...nextSizes];\r\n const diff = trackSize - normalized.reduce((sum, size) => sum + size, 0);\r\n const flexibleIndex = normalized.findIndex((size) => size > 0);\r\n normalized[flexibleIndex === -1 ? 0 : flexibleIndex] += diff;\r\n return normalized.map((size, index) => clamp(size, 0, getPanelMax(index)));\r\n },\r\n [getPanelMax, trackSize],\r\n );\r\n\r\n const buildInitialSizes = useCallback(\r\n (previous?: number[]) => {\r\n if (!trackSize || !panels.length) {\r\n return [];\r\n }\r\n\r\n if (previous?.length === panels.length) {\r\n const previousTotal = previous.reduce((sum, size) => sum + size, 0);\r\n if (previousTotal > 0) {\r\n return normalizeToTrack(previous.map((size) => (size / previousTotal) * trackSize));\r\n }\r\n }\r\n\r\n const explicitSizes = panels.map((panel) =>\r\n parseSize(panel.props.size ?? panel.props.defaultSize, trackSize, -1),\r\n );\r\n const usedSize = explicitSizes\r\n .filter((size) => size >= 0)\r\n .reduce((sum, size) => sum + size, 0);\r\n const unsetCount = explicitSizes.filter((size) => size < 0).length;\r\n const fallbackSize = unsetCount ? Math.max(0, (trackSize - usedSize) / unsetCount) : 0;\r\n\r\n return normalizeToTrack(\r\n explicitSizes.map((size, index) =>\r\n clamp(size >= 0 ? size : fallbackSize, getPanelMin(index), getPanelMax(index)),\r\n ),\r\n );\r\n },\r\n [getPanelMax, getPanelMin, normalizeToTrack, panels, trackSize],\r\n );\r\n\r\n const updateSizes = useCallback(\r\n (nextSizes: number[], notify = true) => {\r\n const normalized = normalizeToTrack(nextSizes);\r\n setSizes(normalized);\r\n sizesRef.current = normalized;\r\n normalized.forEach((size, index) => {\r\n if (size > 1) {\r\n lastNonZeroSizesRef.current[index] = size;\r\n }\r\n });\r\n if (notify) {\r\n onResize?.(roundSizes(normalized));\r\n }\r\n },\r\n [normalizeToTrack, onResize],\r\n );\r\n\r\n useEffect(() => {\r\n const node = rootRef.current;\r\n if (!node) {\r\n return undefined;\r\n }\r\n\r\n const syncSize = () => {\r\n const rect = node.getBoundingClientRect();\r\n setContainerSize(resolvedOrientation === 'horizontal' ? rect.width : rect.height);\r\n };\r\n syncSize();\r\n\r\n const observer = new ResizeObserver(syncSize);\r\n observer.observe(node);\r\n return () => observer.disconnect();\r\n }, [resolvedOrientation]);\r\n\r\n useEffect(() => {\r\n setSizes((previous) => {\r\n const nextSizes = buildInitialSizes(previous);\r\n sizesRef.current = nextSizes;\r\n lastNonZeroSizesRef.current = nextSizes.map((size) =>\r\n Math.max(size, trackSize / Math.max(panels.length, 1)),\r\n );\r\n return nextSizes;\r\n });\r\n }, [buildInitialSizes, panels.length, trackSize]);\r\n\r\n const getResizedPair = useCallback(\r\n (sourceSizes: number[], index: number, delta: number) => {\r\n const nextSizes = [...sourceSizes];\r\n const leftSize = nextSizes[index];\r\n const rightSize = nextSizes[index + 1];\r\n const leftMin = getPanelMin(index);\r\n const rightMin = getPanelMin(index + 1);\r\n const leftMax = getPanelMax(index);\r\n const rightMax = getPanelMax(index + 1);\r\n const minDelta = Math.max(leftMin - leftSize, rightSize - rightMax);\r\n const maxDelta = Math.min(leftMax - leftSize, rightSize - rightMin);\r\n const safeDelta = clamp(delta, minDelta, maxDelta);\r\n\r\n nextSizes[index] = leftSize + safeDelta;\r\n nextSizes[index + 1] = rightSize - safeDelta;\r\n return normalizeToTrack(nextSizes);\r\n },\r\n [getPanelMax, getPanelMin, normalizeToTrack],\r\n );\r\n\r\n const resizePair = useCallback(\r\n (index: number, delta: number, notify = true) => {\r\n updateSizes(getResizedPair(sizesRef.current, index, delta), notify);\r\n },\r\n [getResizedPair, updateSizes],\r\n );\r\n\r\n const startResize = (index: number, event: ReactPointerEvent<HTMLDivElement>) => {\r\n if (panels[index].props.resizable === false || panels[index + 1].props.resizable === false) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n const startPosition = getPointerPosition(event, resolvedOrientation);\r\n const startSizes = [...sizesRef.current];\r\n let latestSizes = startSizes;\r\n\r\n setDraggingIndex(index);\r\n onResizeStart?.(roundSizes(startSizes));\r\n\r\n const handlePointerMove = (moveEvent: PointerEvent) => {\r\n const delta = getPointerPosition(moveEvent, resolvedOrientation) - startPosition;\r\n latestSizes = getResizedPair(startSizes, index, delta);\r\n if (!lazy) {\r\n updateSizes(latestSizes, true);\r\n }\r\n };\r\n\r\n const handlePointerUp = () => {\r\n document.removeEventListener('pointermove', handlePointerMove);\r\n document.removeEventListener('pointerup', handlePointerUp);\r\n setDraggingIndex(null);\r\n if (lazy) {\r\n updateSizes(latestSizes, true);\r\n }\r\n onResizeEnd?.(roundSizes(sizesRef.current));\r\n };\r\n\r\n document.addEventListener('pointermove', handlePointerMove);\r\n document.addEventListener('pointerup', handlePointerUp);\r\n };\r\n\r\n const toggleCollapse = (index: number, neighborIndex: number) => {\r\n const nextSizes = [...sizesRef.current];\r\n\r\n if (nextSizes[index] > 1) {\r\n lastNonZeroSizesRef.current[index] = nextSizes[index];\r\n nextSizes[neighborIndex] += nextSizes[index];\r\n nextSizes[index] = 0;\r\n } else {\r\n const restoredSize =\r\n lastNonZeroSizesRef.current[index] ||\r\n parseSize(panels[index].props.defaultSize, trackSize, trackSize / panels.length);\r\n nextSizes[index] = clamp(restoredSize, getPanelMin(index), getPanelMax(index));\r\n nextSizes[neighborIndex] = Math.max(0, nextSizes[neighborIndex] - nextSizes[index]);\r\n }\r\n\r\n updateSizes(nextSizes);\r\n onResizeEnd?.(roundSizes(sizesRef.current));\r\n };\r\n\r\n const resetSizes = () => {\r\n const nextSizes = buildInitialSizes();\r\n updateSizes(nextSizes);\r\n onResizeEnd?.(roundSizes(nextSizes));\r\n };\r\n\r\n const rootStyle: CSSProperties = {\r\n border: '1px solid #f0f0f0',\r\n borderRadius: 8,\r\n display: 'flex',\r\n flexDirection: resolvedOrientation === 'horizontal' ? 'row' : 'column',\r\n height: 360,\r\n minHeight: 0,\r\n overflow: 'hidden',\r\n width: '100%',\r\n ...style,\r\n };\r\n\r\n const renderCollapseButton = (\r\n draggerIndex: number,\r\n panelIndex: number,\r\n direction: 'start' | 'end',\r\n ) => {\r\n const panel = panels[panelIndex];\r\n if (!panel?.props.collapsible) {\r\n return null;\r\n }\r\n\r\n const neighborIndex = direction === 'start' ? panelIndex + 1 : panelIndex - 1;\r\n const isCollapsed = (sizes[panelIndex] ?? 0) <= 1;\r\n const isNeighborCollapsed = (sizes[neighborIndex] ?? 0) <= 1;\r\n\r\n // 自己折叠后隐藏;对侧面板折叠后也隐藏(避免与展开按钮重复/语义冲突)\r\n if (isCollapsed || isNeighborCollapsed) {\r\n return null;\r\n }\r\n\r\n // 展开时箭头指向面板将被折叠到的方向\r\n const Icon =\r\n resolvedOrientation === 'horizontal'\r\n ? direction === 'start'\r\n ? LeftOutlined\r\n : RightOutlined\r\n : direction === 'start'\r\n ? UpOutlined\r\n : DownOutlined;\r\n\r\n return (\r\n <button\r\n aria-label=\"折叠面板\"\r\n title=\"折叠面板\"\r\n onClick={(event) => {\r\n event.stopPropagation();\r\n toggleCollapse(panelIndex, neighborIndex);\r\n }}\r\n style={{\r\n alignItems: 'center',\r\n background: '#fff',\r\n border: '1px solid #d9d9d9',\r\n borderRadius: 4,\r\n color: '#595959',\r\n cursor: 'pointer',\r\n display: 'flex',\r\n height: 20,\r\n justifyContent: 'center',\r\n padding: 0,\r\n width: 20,\r\n fontSize: 12,\r\n }}\r\n type=\"button\"\r\n >\r\n <Icon />\r\n </button>\r\n );\r\n };\r\n\r\n // 渲染\"展开\"按钮:当某个面板被折叠时显示在分隔条上,箭头指向展开方向\r\n const renderExpandButton = (panelIndex: number, direction: 'start' | 'end') => {\r\n const panel = panels[panelIndex];\r\n if (!panel?.props.collapsible) {\r\n return null;\r\n }\r\n\r\n const isCollapsed = (sizes[panelIndex] ?? 0) <= 1;\r\n if (!isCollapsed) {\r\n return null;\r\n }\r\n\r\n const neighborIndex = direction === 'start' ? panelIndex + 1 : panelIndex - 1;\r\n\r\n // 折叠后面板展开的方向与折叠方向相反\r\n const Icon =\r\n resolvedOrientation === 'horizontal'\r\n ? direction === 'start'\r\n ? RightOutlined // 左面板折叠后,展开方向朝右\r\n : LeftOutlined // 右面板折叠后,展开方向朝左\r\n : direction === 'start'\r\n ? DownOutlined\r\n : UpOutlined;\r\n\r\n return (\r\n <button\r\n aria-label=\"展开面板\"\r\n title=\"展开面板\"\r\n onClick={(event) => {\r\n event.stopPropagation();\r\n toggleCollapse(panelIndex, neighborIndex);\r\n }}\r\n style={{\r\n alignItems: 'center',\r\n background: '#fff',\r\n border: '1px solid #d9d9d9',\r\n borderRadius: 4,\r\n color: '#595959',\r\n cursor: 'pointer',\r\n display: 'flex',\r\n height: 20,\r\n justifyContent: 'center',\r\n padding: 0,\r\n width: 20,\r\n fontSize: 12,\r\n }}\r\n type=\"button\"\r\n >\r\n <Icon />\r\n </button>\r\n );\r\n };\r\n\r\n return (\r\n <div className={className} ref={rootRef} style={rootStyle}>\r\n {panels.map((panel, index) => {\r\n const isHidden = sizes[index] <= 1;\r\n\r\n return (\r\n <React.Fragment key={index}>\r\n <div\r\n style={{\r\n background: index % 2 ? '#fff' : '#fafafa',\r\n flex: `0 0 ${sizes[index] ?? 0}px`,\r\n minHeight: 0,\r\n minWidth: 0,\r\n overflow: 'auto',\r\n padding: isHidden ? 0 : 16,\r\n transition: draggingIndex === null ? 'flex-basis 0.2s ease' : undefined,\r\n ...panel.props.style,\r\n }}\r\n >\r\n {!isHidden && panel.props.children}\r\n </div>\r\n\r\n {index < panels.length - 1 && (\r\n <div\r\n aria-orientation={resolvedOrientation}\r\n onDoubleClick={resetSizes}\r\n onKeyDown={(event) => {\r\n const step = event.shiftKey ? 40 : 10;\r\n const directionMap =\r\n resolvedOrientation === 'horizontal'\r\n ? { ArrowLeft: -step, ArrowRight: step }\r\n : { ArrowUp: -step, ArrowDown: step };\r\n const delta = directionMap[event.key as keyof typeof directionMap];\r\n if (delta !== undefined) {\r\n event.preventDefault();\r\n resizePair(index, delta);\r\n }\r\n }}\r\n onPointerDown={(event) => startResize(index, event)}\r\n onPointerEnter={() => setHoveredIndex(index)}\r\n onPointerLeave={() => setHoveredIndex(null)}\r\n role=\"separator\"\r\n style={{\r\n alignItems: 'center',\r\n background:\r\n hoveredIndex === index || draggingIndex === index ? '#e6f4ff' : '#f5f5f5',\r\n cursor: resolvedOrientation === 'horizontal' ? 'col-resize' : 'row-resize',\r\n display: 'flex',\r\n flex: `0 0 ${DRAGGER_SIZE}px`,\r\n justifyContent: 'center',\r\n outline: 'none',\r\n position: 'relative',\r\n userSelect: 'none',\r\n zIndex: 1,\r\n }}\r\n tabIndex={0}\r\n >\r\n <div\r\n style={{\r\n background:\r\n hoveredIndex === index || draggingIndex === index ? '#1677ff' : '#d9d9d9',\r\n borderRadius: 2,\r\n height: resolvedOrientation === 'horizontal' ? 48 : 2,\r\n width: resolvedOrientation === 'horizontal' ? 2 : 48,\r\n }}\r\n />\r\n <div\r\n style={{\r\n position: 'absolute',\r\n display: 'flex',\r\n flexDirection: resolvedOrientation === 'horizontal' ? 'column' : 'row',\r\n gap: 2,\r\n opacity:\r\n hoveredIndex === index ||\r\n (sizes[index] ?? 0) <= 1 ||\r\n (sizes[index + 1] ?? 0) <= 1\r\n ? 1\r\n : 0,\r\n transition: 'opacity 0.15s ease',\r\n pointerEvents:\r\n hoveredIndex === index ||\r\n (sizes[index] ?? 0) <= 1 ||\r\n (sizes[index + 1] ?? 0) <= 1\r\n ? 'auto'\r\n : 'none',\r\n }}\r\n >\r\n {renderCollapseButton(index, index, 'start')}\r\n {renderCollapseButton(index, index + 1, 'end')}\r\n {renderExpandButton(index, 'start')}\r\n {renderExpandButton(index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QAAQ;AAEvB,IAAO,mBAAQ;","names":["import_jsx_runtime","import_react","import_jsx_runtime","React"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../CollapseBox/index.tsx","../src/icons.tsx","../Splitter/index.tsx"],"sourcesContent":["// 统一入口\nexport { default as CollapseBox } from '../CollapseBox';\nexport type {\n CollapseBoxProps,\n CollapseBoxDirection,\n CollapseBoxButtonPosition,\n} from '../CollapseBox';\n\nexport { default as Splitter } from '../Splitter';\nexport type {\n SplitterProps,\n SplitterPanelProps,\n SplitterSize,\n SplitterOrientation,\n} from '../Splitter';\n","import { useState, type CSSProperties, type ReactNode } from 'react';\nimport { DownOutlined, LeftOutlined, RightOutlined, UpOutlined } from '../src/icons';\nimport './index.less';\n\nexport type CollapseBoxDirection = 'horizontal' | 'vertical';\nexport type CollapseBoxButtonPosition = 'left' | 'right' | 'top' | 'bottom';\n\nexport interface CollapseBoxProps {\n children?: ReactNode;\n title?: string;\n direction?: CollapseBoxDirection;\n buttonPosition?: CollapseBoxButtonPosition;\n defaultWidth?: number | string;\n defaultHeight?: number | string;\n contentPadding?: string;\n headerHeight?: number;\n}\n\nconst isNumber = (value: unknown): value is number => typeof value === 'number' && !Number.isNaN(value);\n\nconst formatDimension = (value?: number | string): string | undefined => {\n if (value === undefined || value === null) return undefined;\n return typeof value === 'number' ? `${value}px` : value;\n};\n\nconst ChevronLeft = () => <LeftOutlined />;\n\nconst ChevronRight = () => <RightOutlined />;\n\nconst ChevronUp = () => <UpOutlined />;\n\nconst ChevronDown = () => <DownOutlined />;\n\nconst CollapsibleBox = ({\n children,\n title = '内容区域',\n direction = 'horizontal',\n buttonPosition = 'right',\n defaultWidth = 600,\n defaultHeight = 300,\n contentPadding = '16px',\n headerHeight = 16,\n}: CollapseBoxProps) => {\n const [isExpanded, setIsExpanded] = useState(true);\n\n const getContentMaxHeight = () => {\n if (typeof defaultHeight === 'number') {\n return `${defaultHeight - headerHeight}px`;\n }\n if (typeof defaultHeight === 'string') {\n return headerHeight ? `calc(${defaultHeight} - ${headerHeight}px)` : defaultHeight;\n }\n return '100%';\n };\n\n const getIcon = () => {\n if (direction === 'horizontal') {\n if (buttonPosition === 'right') {\n return isExpanded ? <ChevronRight /> : <ChevronLeft />;\n } else {\n return isExpanded ? <ChevronLeft /> : <ChevronRight />;\n }\n } else {\n if (buttonPosition === 'bottom') {\n return isExpanded ? <ChevronUp /> : <ChevronDown />;\n } else {\n return isExpanded ? <ChevronDown /> : <ChevronUp />;\n }\n }\n };\n\n const getButtonClass = () => {\n if (direction === 'horizontal') {\n return buttonPosition === 'right' ? 'button-right' : 'button-left';\n } else {\n return buttonPosition === 'bottom' ? 'button-bottom' : 'button-top';\n }\n };\n\n const getContainerStyle = (): CSSProperties => {\n const resolvedHeight = formatDimension(defaultHeight);\n const resolvedWidth = formatDimension(defaultWidth);\n if (direction === 'horizontal') {\n return {\n width: isExpanded ? resolvedWidth : '0px',\n height: resolvedHeight,\n minWidth: 0,\n };\n } else {\n return {\n height: isExpanded ? resolvedHeight : '0px',\n width: resolvedWidth,\n minHeight: 0,\n };\n }\n };\n\n const wrapperClass =\n direction === 'horizontal' ? 'collapsible-wrapper horizontal' : 'collapsible-wrapper vertical';\n\n const containerClass =\n direction === 'horizontal' && buttonPosition === 'right'\n ? 'collapsible-container align-right'\n : 'collapsible-container';\n const height = getContentMaxHeight();\n const contentStyle: CSSProperties = {\n maxHeight: direction === 'vertical' ? (isExpanded ? height : '0px') : height,\n overflowY: 'auto',\n padding: direction === 'vertical' && !isExpanded ? '0px' : contentPadding,\n boxSizing: 'border-box',\n };\n\n // 折叠时(纵向 + 底部按钮):按钮需切换为 top:0 定位,使其显示在折叠线下方\n const buttonStyle: CSSProperties =\n direction === 'vertical' && buttonPosition === 'bottom' && !isExpanded\n ? { top: '0px', bottom: 'auto' }\n : {};\n\n // 让 wrapper 高度跟随容器,确保 bottom:0 的按钮贴住容器底部\n // 折叠时 wrapper 高度为 0,配合按钮的 translateY(-100%) 让按钮显示在折叠线上方\n const formattedWidth = formatDimension(defaultWidth);\n const formattedHeight = formatDimension(defaultHeight);\n const wrapperStyle: CSSProperties | undefined =\n direction === 'vertical'\n ? isExpanded\n ? {\n height: formattedHeight,\n width: formattedWidth,\n }\n : { height: 0, width: formattedWidth }\n : undefined;\n\n return (\n <div className={wrapperClass} style={wrapperStyle}>\n <div style={getContainerStyle()} className={containerClass}>\n {title && (\n <div className=\"collapsible-header\" style={{ display: 'none' }}>\n <h3>{title}</h3>\n </div>\n )}\n\n <div className=\"collapsible-content\" style={contentStyle}>\n {children}\n </div>\n </div>\n\n <div\n onClick={() => setIsExpanded(!isExpanded)}\n className={`toggle-button ${getButtonClass()}`}\n style={buttonStyle}\n title={isExpanded ? '隐藏' : '展开'}\n >\n {getIcon()}\n </div>\n </div>\n );\n};\n\nexport default CollapsibleBox;\n","import type { CSSProperties } from 'react';\n\ninterface IconProps {\n style?: CSSProperties;\n className?: string;\n}\n\nconst baseStyle: CSSProperties = {\n display: 'inline-block',\n width: '1em',\n height: '1em',\n verticalAlign: '-0.125em',\n};\n\nexport const LeftOutlined = ({ style, className }: IconProps) => (\n <svg\n viewBox=\"0 0 1024 1024\"\n focusable=\"false\"\n data-icon=\"left\"\n width=\"1em\"\n height=\"1em\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n style={{ ...baseStyle, ...style }}\n className={className}\n >\n <path d=\"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z\" />\n </svg>\n);\n\nexport const RightOutlined = ({ style, className }: IconProps) => (\n <svg\n viewBox=\"0 0 1024 1024\"\n focusable=\"false\"\n data-icon=\"right\"\n width=\"1em\"\n height=\"1em\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n style={{ ...baseStyle, ...style }}\n className={className}\n >\n <path d=\"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z\" />\n </svg>\n);\n\nexport const UpOutlined = ({ style, className }: IconProps) => (\n <svg\n viewBox=\"0 0 1024 1024\"\n focusable=\"false\"\n data-icon=\"up\"\n width=\"1em\"\n height=\"1em\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n style={{ ...baseStyle, ...style }}\n className={className}\n >\n <path d=\"M890.5 755.3L537.4 268a31.96 31.96 0 00-50.8 0L133.5 755.3a7.95 7.95 0 006.3 12.7h75.5c4.9 0 9.6-2.3 12.6-6.1l281-360 281 360c3 3.8 7.7 6.1 12.6 6.1h75.5c6.7 0 10.4-7.6 6.1-12.7z\" />\n </svg>\n);\n\nexport const DownOutlined = ({ style, className }: IconProps) => (\n <svg\n viewBox=\"0 0 1024 1024\"\n focusable=\"false\"\n data-icon=\"down\"\n width=\"1em\"\n height=\"1em\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n style={{ ...baseStyle, ...style }}\n className={className}\n >\n <path d=\"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 37 17.6 49.8 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z\" />\n </svg>\n);\n","import { DownOutlined, LeftOutlined, RightOutlined, UpOutlined } from '../src/icons';\r\nimport type {\r\n CSSProperties,\r\n ReactElement,\r\n ReactNode,\r\n PointerEvent as ReactPointerEvent,\r\n} from 'react';\r\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\r\n\r\nexport type SplitterSize = number | `${number}%`;\r\nexport type SplitterOrientation = 'horizontal' | 'vertical';\r\n\r\nexport type SplitterPanelProps = {\r\n children?: ReactNode;\r\n collapsible?: boolean;\r\n defaultSize?: SplitterSize;\r\n max?: SplitterSize;\r\n min?: SplitterSize;\r\n resizable?: boolean;\r\n size?: SplitterSize;\r\n style?: CSSProperties;\r\n};\r\n\r\nexport type SplitterProps = {\r\n children: ReactNode;\r\n className?: string;\r\n lazy?: boolean;\r\n onResize?: (sizes: number[]) => void;\r\n onResizeEnd?: (sizes: number[]) => void;\r\n onResizeStart?: (sizes: number[]) => void;\r\n orientation?: SplitterOrientation;\r\n style?: CSSProperties;\r\n vertical?: boolean;\r\n};\r\n\r\ntype SplitterComponent = React.FC<SplitterProps> & {\r\n Panel: React.FC<SplitterPanelProps>;\r\n};\r\n\r\nconst DRAGGER_SIZE = 8;\r\nconst MIN_PANEL_SIZE = 0;\r\n\r\nconst SplitterPanel: React.FC<SplitterPanelProps> = ({ children }) => <>{children}</>;\r\n\r\nconst isPercentSize = (value: SplitterSize): value is `${number}%` =>\r\n typeof value === 'string' && value.endsWith('%');\r\n\r\nconst parseSize = (value: SplitterSize | undefined, total: number, fallback: number) => {\r\n if (value === undefined) {\r\n return fallback;\r\n }\r\n\r\n if (isPercentSize(value)) {\r\n return (Number.parseFloat(value) / 100) * total;\r\n }\r\n\r\n return Number(value);\r\n};\r\n\r\nconst roundSizes = (sizes: number[]) => sizes.map((size) => Math.round(size));\r\n\r\nconst getPointerPosition = (\r\n event: PointerEvent | ReactPointerEvent,\r\n orientation: SplitterOrientation,\r\n) => (orientation === 'horizontal' ? event.clientX : event.clientY);\r\n\r\nconst clamp = (value: number, min: number, max: number) => Math.min(Math.max(value, min), max);\r\n\r\nconst CustomSplitter: SplitterComponent = ({\r\n children,\r\n className,\r\n lazy = false,\r\n onResize,\r\n onResizeEnd,\r\n onResizeStart,\r\n orientation,\r\n style,\r\n vertical = false,\r\n}) => {\r\n const resolvedOrientation = orientation ?? (vertical ? 'vertical' : 'horizontal');\r\n const rootRef = useRef<HTMLDivElement>(null);\r\n const sizesRef = useRef<number[]>([]);\r\n const lastNonZeroSizesRef = useRef<number[]>([]);\r\n const [containerSize, setContainerSize] = useState(0);\r\n const [draggingIndex, setDraggingIndex] = useState<number | null>(null);\r\n const [hoveredIndex, setHoveredIndex] = useState<number | null>(null);\r\n const [sizes, setSizes] = useState<number[]>([]);\r\n\r\n const panels = useMemo(\r\n () =>\r\n React.Children.toArray(children).filter(\r\n React.isValidElement,\r\n ) as ReactElement<SplitterPanelProps>[],\r\n [children],\r\n );\r\n\r\n const trackSize = Math.max(0, containerSize - Math.max(0, panels.length - 1) * DRAGGER_SIZE);\r\n\r\n const getPanelMin = useCallback(\r\n (index: number) => parseSize(panels[index]?.props.min, trackSize, MIN_PANEL_SIZE),\r\n [panels, trackSize],\r\n );\r\n\r\n const getPanelMax = useCallback(\r\n (index: number) => parseSize(panels[index]?.props.max, trackSize, trackSize),\r\n [panels, trackSize],\r\n );\r\n\r\n const normalizeToTrack = useCallback(\r\n (nextSizes: number[]) => {\r\n if (!trackSize || !nextSizes.length) {\r\n return nextSizes;\r\n }\r\n\r\n const normalized = [...nextSizes];\r\n const diff = trackSize - normalized.reduce((sum, size) => sum + size, 0);\r\n const flexibleIndex = normalized.findIndex((size) => size > 0);\r\n normalized[flexibleIndex === -1 ? 0 : flexibleIndex] += diff;\r\n return normalized.map((size, index) => clamp(size, 0, getPanelMax(index)));\r\n },\r\n [getPanelMax, trackSize],\r\n );\r\n\r\n const buildInitialSizes = useCallback(\r\n (previous?: number[]) => {\r\n if (!trackSize || !panels.length) {\r\n return [];\r\n }\r\n\r\n if (previous?.length === panels.length) {\r\n const previousTotal = previous.reduce((sum, size) => sum + size, 0);\r\n if (previousTotal > 0) {\r\n return normalizeToTrack(previous.map((size) => (size / previousTotal) * trackSize));\r\n }\r\n }\r\n\r\n const explicitSizes = panels.map((panel) =>\r\n parseSize(panel.props.size ?? panel.props.defaultSize, trackSize, -1),\r\n );\r\n const usedSize = explicitSizes\r\n .filter((size) => size >= 0)\r\n .reduce((sum, size) => sum + size, 0);\r\n const unsetCount = explicitSizes.filter((size) => size < 0).length;\r\n const fallbackSize = unsetCount ? Math.max(0, (trackSize - usedSize) / unsetCount) : 0;\r\n\r\n return normalizeToTrack(\r\n explicitSizes.map((size, index) =>\r\n clamp(size >= 0 ? size : fallbackSize, getPanelMin(index), getPanelMax(index)),\r\n ),\r\n );\r\n },\r\n [getPanelMax, getPanelMin, normalizeToTrack, panels, trackSize],\r\n );\r\n\r\n const updateSizes = useCallback(\r\n (nextSizes: number[], notify = true) => {\r\n const normalized = normalizeToTrack(nextSizes);\r\n setSizes(normalized);\r\n sizesRef.current = normalized;\r\n normalized.forEach((size, index) => {\r\n if (size > 1) {\r\n lastNonZeroSizesRef.current[index] = size;\r\n }\r\n });\r\n if (notify) {\r\n onResize?.(roundSizes(normalized));\r\n }\r\n },\r\n [normalizeToTrack, onResize],\r\n );\r\n\r\n useEffect(() => {\r\n const node = rootRef.current;\r\n if (!node) {\r\n return undefined;\r\n }\r\n\r\n const syncSize = () => {\r\n const rect = node.getBoundingClientRect();\r\n setContainerSize(resolvedOrientation === 'horizontal' ? rect.width : rect.height);\r\n };\r\n syncSize();\r\n\r\n const observer = new ResizeObserver(syncSize);\r\n observer.observe(node);\r\n return () => observer.disconnect();\r\n }, [resolvedOrientation]);\r\n\r\n useEffect(() => {\r\n setSizes((previous) => {\r\n const nextSizes = buildInitialSizes(previous);\r\n sizesRef.current = nextSizes;\r\n lastNonZeroSizesRef.current = nextSizes.map((size) =>\r\n Math.max(size, trackSize / Math.max(panels.length, 1)),\r\n );\r\n return nextSizes;\r\n });\r\n }, [buildInitialSizes, panels.length, trackSize]);\r\n\r\n const getResizedPair = useCallback(\r\n (sourceSizes: number[], index: number, delta: number) => {\r\n const nextSizes = [...sourceSizes];\r\n const leftSize = nextSizes[index];\r\n const rightSize = nextSizes[index + 1];\r\n const leftMin = getPanelMin(index);\r\n const rightMin = getPanelMin(index + 1);\r\n const leftMax = getPanelMax(index);\r\n const rightMax = getPanelMax(index + 1);\r\n const minDelta = Math.max(leftMin - leftSize, rightSize - rightMax);\r\n const maxDelta = Math.min(leftMax - leftSize, rightSize - rightMin);\r\n const safeDelta = clamp(delta, minDelta, maxDelta);\r\n\r\n nextSizes[index] = leftSize + safeDelta;\r\n nextSizes[index + 1] = rightSize - safeDelta;\r\n return normalizeToTrack(nextSizes);\r\n },\r\n [getPanelMax, getPanelMin, normalizeToTrack],\r\n );\r\n\r\n const resizePair = useCallback(\r\n (index: number, delta: number, notify = true) => {\r\n updateSizes(getResizedPair(sizesRef.current, index, delta), notify);\r\n },\r\n [getResizedPair, updateSizes],\r\n );\r\n\r\n const startResize = (index: number, event: ReactPointerEvent<HTMLDivElement>) => {\r\n if (panels[index].props.resizable === false || panels[index + 1].props.resizable === false) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n const startPosition = getPointerPosition(event, resolvedOrientation);\r\n const startSizes = [...sizesRef.current];\r\n let latestSizes = startSizes;\r\n\r\n setDraggingIndex(index);\r\n onResizeStart?.(roundSizes(startSizes));\r\n\r\n const handlePointerMove = (moveEvent: PointerEvent) => {\r\n const delta = getPointerPosition(moveEvent, resolvedOrientation) - startPosition;\r\n latestSizes = getResizedPair(startSizes, index, delta);\r\n if (!lazy) {\r\n updateSizes(latestSizes, true);\r\n }\r\n };\r\n\r\n const handlePointerUp = () => {\r\n document.removeEventListener('pointermove', handlePointerMove);\r\n document.removeEventListener('pointerup', handlePointerUp);\r\n setDraggingIndex(null);\r\n if (lazy) {\r\n updateSizes(latestSizes, true);\r\n }\r\n onResizeEnd?.(roundSizes(sizesRef.current));\r\n };\r\n\r\n document.addEventListener('pointermove', handlePointerMove);\r\n document.addEventListener('pointerup', handlePointerUp);\r\n };\r\n\r\n const toggleCollapse = (index: number, neighborIndex: number) => {\r\n const nextSizes = [...sizesRef.current];\r\n\r\n if (nextSizes[index] > 1) {\r\n lastNonZeroSizesRef.current[index] = nextSizes[index];\r\n nextSizes[neighborIndex] += nextSizes[index];\r\n nextSizes[index] = 0;\r\n } else {\r\n const restoredSize =\r\n lastNonZeroSizesRef.current[index] ||\r\n parseSize(panels[index].props.defaultSize, trackSize, trackSize / panels.length);\r\n nextSizes[index] = clamp(restoredSize, getPanelMin(index), getPanelMax(index));\r\n nextSizes[neighborIndex] = Math.max(0, nextSizes[neighborIndex] - nextSizes[index]);\r\n }\r\n\r\n updateSizes(nextSizes);\r\n onResizeEnd?.(roundSizes(sizesRef.current));\r\n };\r\n\r\n const resetSizes = () => {\r\n const nextSizes = buildInitialSizes();\r\n updateSizes(nextSizes);\r\n onResizeEnd?.(roundSizes(nextSizes));\r\n };\r\n\r\n const rootStyle: CSSProperties = {\r\n border: '1px solid #f0f0f0',\r\n borderRadius: 8,\r\n display: 'flex',\r\n flexDirection: resolvedOrientation === 'horizontal' ? 'row' : 'column',\r\n height: 360,\r\n minHeight: 0,\r\n overflow: 'hidden',\r\n width: '100%',\r\n ...style,\r\n };\r\n\r\n const renderCollapseButton = (\r\n draggerIndex: number,\r\n panelIndex: number,\r\n direction: 'start' | 'end',\r\n ) => {\r\n const panel = panels[panelIndex];\r\n if (!panel?.props.collapsible) {\r\n return null;\r\n }\r\n\r\n const neighborIndex = direction === 'start' ? panelIndex + 1 : panelIndex - 1;\r\n const isCollapsed = (sizes[panelIndex] ?? 0) <= 1;\r\n const isNeighborCollapsed = (sizes[neighborIndex] ?? 0) <= 1;\r\n\r\n // 自己折叠后隐藏;对侧面板折叠后也隐藏(避免与展开按钮重复/语义冲突)\r\n if (isCollapsed || isNeighborCollapsed) {\r\n return null;\r\n }\r\n\r\n // 展开时箭头指向面板将被折叠到的方向\r\n const Icon =\r\n resolvedOrientation === 'horizontal'\r\n ? direction === 'start'\r\n ? LeftOutlined\r\n : RightOutlined\r\n : direction === 'start'\r\n ? UpOutlined\r\n : DownOutlined;\r\n\r\n return (\r\n <button\r\n aria-label=\"折叠面板\"\r\n title=\"折叠面板\"\r\n onClick={(event) => {\r\n event.stopPropagation();\r\n toggleCollapse(panelIndex, neighborIndex);\r\n }}\r\n style={{\r\n alignItems: 'center',\r\n background: '#fff',\r\n border: '1px solid #d9d9d9',\r\n borderRadius: 4,\r\n color: '#595959',\r\n cursor: 'pointer',\r\n display: 'flex',\r\n height: 20,\r\n justifyContent: 'center',\r\n padding: 0,\r\n width: 20,\r\n fontSize: 12,\r\n }}\r\n type=\"button\"\r\n >\r\n <Icon />\r\n </button>\r\n );\r\n };\r\n\r\n // 渲染\"展开\"按钮:当某个面板被折叠时显示在分隔条上,箭头指向展开方向\r\n const renderExpandButton = (panelIndex: number, direction: 'start' | 'end') => {\r\n const panel = panels[panelIndex];\r\n if (!panel?.props.collapsible) {\r\n return null;\r\n }\r\n\r\n const isCollapsed = (sizes[panelIndex] ?? 0) <= 1;\r\n if (!isCollapsed) {\r\n return null;\r\n }\r\n\r\n const neighborIndex = direction === 'start' ? panelIndex + 1 : panelIndex - 1;\r\n\r\n // 折叠后面板展开的方向与折叠方向相反\r\n const Icon =\r\n resolvedOrientation === 'horizontal'\r\n ? direction === 'start'\r\n ? RightOutlined // 左面板折叠后,展开方向朝右\r\n : LeftOutlined // 右面板折叠后,展开方向朝左\r\n : direction === 'start'\r\n ? DownOutlined\r\n : UpOutlined;\r\n\r\n return (\r\n <button\r\n aria-label=\"展开面板\"\r\n title=\"展开面板\"\r\n onClick={(event) => {\r\n event.stopPropagation();\r\n toggleCollapse(panelIndex, neighborIndex);\r\n }}\r\n style={{\r\n alignItems: 'center',\r\n background: '#fff',\r\n border: '1px solid #d9d9d9',\r\n borderRadius: 4,\r\n color: '#595959',\r\n cursor: 'pointer',\r\n display: 'flex',\r\n height: 20,\r\n justifyContent: 'center',\r\n padding: 0,\r\n width: 20,\r\n fontSize: 12,\r\n }}\r\n type=\"button\"\r\n >\r\n <Icon />\r\n </button>\r\n );\r\n };\r\n\r\n return (\r\n <div className={className} ref={rootRef} style={rootStyle}>\r\n {panels.map((panel, index) => {\r\n const isHidden = sizes[index] <= 1;\r\n\r\n return (\r\n <React.Fragment key={index}>\r\n <div\r\n style={{\r\n background: index % 2 ? '#fff' : '#fafafa',\r\n flex: `0 0 ${sizes[index] ?? 0}px`,\r\n minHeight: 0,\r\n minWidth: 0,\r\n overflow: 'auto',\r\n padding: isHidden ? 0 : 16,\r\n transition: draggingIndex === null ? 'flex-basis 0.2s ease' : undefined,\r\n ...panel.props.style,\r\n }}\r\n >\r\n {!isHidden && panel.props.children}\r\n </div>\r\n\r\n {index < panels.length - 1 && (\r\n <div\r\n aria-orientation={resolvedOrientation}\r\n onDoubleClick={resetSizes}\r\n onKeyDown={(event) => {\r\n const step = event.shiftKey ? 40 : 10;\r\n const directionMap =\r\n resolvedOrientation === 'horizontal'\r\n ? { ArrowLeft: -step, ArrowRight: step }\r\n : { ArrowUp: -step, ArrowDown: step };\r\n const delta = directionMap[event.key as keyof typeof directionMap];\r\n if (delta !== undefined) {\r\n event.preventDefault();\r\n resizePair(index, delta);\r\n }\r\n }}\r\n onPointerDown={(event) => startResize(index, event)}\r\n onPointerEnter={() => setHoveredIndex(index)}\r\n onPointerLeave={() => setHoveredIndex(null)}\r\n role=\"separator\"\r\n style={{\r\n alignItems: 'center',\r\n background:\r\n hoveredIndex === index || draggingIndex === index ? '#e6f4ff' : '#f5f5f5',\r\n cursor: resolvedOrientation === 'horizontal' ? 'col-resize' : 'row-resize',\r\n display: 'flex',\r\n flex: `0 0 ${DRAGGER_SIZE}px`,\r\n justifyContent: 'center',\r\n outline: 'none',\r\n position: 'relative',\r\n userSelect: 'none',\r\n zIndex: 1,\r\n }}\r\n tabIndex={0}\r\n >\r\n <div\r\n style={{\r\n background:\r\n hoveredIndex === index || draggingIndex === index ? '#1677ff' : '#d9d9d9',\r\n borderRadius: 2,\r\n height: resolvedOrientation === 'horizontal' ? 48 : 2,\r\n width: resolvedOrientation === 'horizontal' ? 2 : 48,\r\n }}\r\n />\r\n <div\r\n style={{\r\n position: 'absolute',\r\n display: 'flex',\r\n flexDirection: resolvedOrientation === 'horizontal' ? 'column' : 'row',\r\n gap: 2,\r\n opacity:\r\n hoveredIndex === index ||\r\n (sizes[index] ?? 0) <= 1 ||\r\n (sizes[index + 1] ?? 0) <= 1\r\n ? 1\r\n : 0,\r\n transition: 'opacity 0.15s ease',\r\n pointerEvents:\r\n hoveredIndex === index ||\r\n (sizes[index] ?? 0) <= 1 ||\r\n (sizes[index + 1] ?? 0) <= 1\r\n ? 'auto'\r\n : 'none',\r\n }}\r\n >\r\n {renderCollapseButton(index, index, 'start')}\r\n {renderCollapseButton(index, index + 1, 'end')}\r\n {renderExpandButton(index, 'start')}\r\n {renderExpandButton(index + 1, 'end')}\r\n </div>\r\n </div>\r\n )}\r\n </React.Fragment>\r\n );\r\n })}\r\n </div>\r\n );\r\n};\r\n\r\nCustomSplitter.Panel = SplitterPanel;\r\n\r\nexport default CustomSplitter;\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA6D;;;AC0BzD;AAnBJ,IAAM,YAA2B;AAAA,EAC/B,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,eAAe;AACjB;AAEO,IAAM,eAAe,CAAC,EAAE,OAAO,UAAU,MAC9C;AAAA,EAAC;AAAA;AAAA,IACC,SAAQ;AAAA,IACR,WAAU;AAAA,IACV,aAAU;AAAA,IACV,OAAM;AAAA,IACN,QAAO;AAAA,IACP,MAAK;AAAA,IACL,eAAY;AAAA,IACZ,OAAO,EAAE,GAAG,WAAW,GAAG,MAAM;AAAA,IAChC;AAAA,IAEA,sDAAC,UAAK,GAAE,yLAAwL;AAAA;AAClM;AAGK,IAAM,gBAAgB,CAAC,EAAE,OAAO,UAAU,MAC/C;AAAA,EAAC;AAAA;AAAA,IACC,SAAQ;AAAA,IACR,WAAU;AAAA,IACV,aAAU;AAAA,IACV,OAAM;AAAA,IACN,QAAO;AAAA,IACP,MAAK;AAAA,IACL,eAAY;AAAA,IACZ,OAAO,EAAE,GAAG,WAAW,GAAG,MAAM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AA,kBACjE,KAAK;AAAA,kBACL,SACE,iBAAiB,WAChB,WAAM,KAAK,MAAX,YAAgB,MAAM,OACtB,WAAM,QAAQ,CAAC,MAAf,YAAoB,MAAM,IACvB,IACA;AAAA,kBACN,YAAY;AAAA,kBACZ,eACE,iBAAiB,WAChB,WAAM,KAAK,MAAX,YAAgB,MAAM,OACtB,WAAM,QAAQ,CAAC,MAAf,YAAoB,MAAM,IACvB,SACA;AAAA,gBACR;AAAA,gBAEC;AAAA,uCAAqB,OAAO,OAAO,OAAO;AAAA,kBAC1C,qBAAqB,OAAO,QAAQ,GAAG,KAAK;AAAA,kBAC5C,mBAAmB,OAAO,OAAO;AAAA,kBACjC,mBAAmB,QAAQ,GAAG,KAAK;AAAA;AAAA;AAAA,YACtC;AAAA;AAAA;AAAA,MACF;AAAA,SAtFiB,KAwFrB;AAAA,EAEJ,CAAC,GACH;AAEJ;AAEA,eAAe,QAAQ;AAEvB,IAAO,mBAAQ;","names":["import_jsx_runtime","import_react","import_jsx_runtime","React"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -8,8 +8,8 @@ interface CollapseBoxProps {
|
|
|
8
8
|
title?: string;
|
|
9
9
|
direction?: CollapseBoxDirection;
|
|
10
10
|
buttonPosition?: CollapseBoxButtonPosition;
|
|
11
|
-
defaultWidth?: number;
|
|
12
|
-
defaultHeight?: number;
|
|
11
|
+
defaultWidth?: number | string;
|
|
12
|
+
defaultHeight?: number | string;
|
|
13
13
|
contentPadding?: string;
|
|
14
14
|
headerHeight?: number;
|
|
15
15
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ interface CollapseBoxProps {
|
|
|
8
8
|
title?: string;
|
|
9
9
|
direction?: CollapseBoxDirection;
|
|
10
10
|
buttonPosition?: CollapseBoxButtonPosition;
|
|
11
|
-
defaultWidth?: number;
|
|
12
|
-
defaultHeight?: number;
|
|
11
|
+
defaultWidth?: number | string;
|
|
12
|
+
defaultHeight?: number | string;
|
|
13
13
|
contentPadding?: string;
|
|
14
14
|
headerHeight?: number;
|
|
15
15
|
}
|
package/dist/index.js
CHANGED
|
@@ -72,7 +72,10 @@ var DownOutlined = ({ style, className }) => /* @__PURE__ */ jsx(
|
|
|
72
72
|
|
|
73
73
|
// CollapseBox/index.tsx
|
|
74
74
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
75
|
-
var
|
|
75
|
+
var formatDimension = (value) => {
|
|
76
|
+
if (value === void 0 || value === null) return void 0;
|
|
77
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
78
|
+
};
|
|
76
79
|
var ChevronLeft = () => /* @__PURE__ */ jsx2(LeftOutlined, {});
|
|
77
80
|
var ChevronRight = () => /* @__PURE__ */ jsx2(RightOutlined, {});
|
|
78
81
|
var ChevronUp = () => /* @__PURE__ */ jsx2(UpOutlined, {});
|
|
@@ -88,7 +91,15 @@ var CollapsibleBox = ({
|
|
|
88
91
|
headerHeight = 16
|
|
89
92
|
}) => {
|
|
90
93
|
const [isExpanded, setIsExpanded] = useState(true);
|
|
91
|
-
const
|
|
94
|
+
const getContentMaxHeight = () => {
|
|
95
|
+
if (typeof defaultHeight === "number") {
|
|
96
|
+
return `${defaultHeight - headerHeight}px`;
|
|
97
|
+
}
|
|
98
|
+
if (typeof defaultHeight === "string") {
|
|
99
|
+
return headerHeight ? `calc(${defaultHeight} - ${headerHeight}px)` : defaultHeight;
|
|
100
|
+
}
|
|
101
|
+
return "100%";
|
|
102
|
+
};
|
|
92
103
|
const getIcon = () => {
|
|
93
104
|
if (direction === "horizontal") {
|
|
94
105
|
if (buttonPosition === "right") {
|
|
@@ -112,35 +123,38 @@ var CollapsibleBox = ({
|
|
|
112
123
|
}
|
|
113
124
|
};
|
|
114
125
|
const getContainerStyle = () => {
|
|
115
|
-
const resolvedHeight =
|
|
126
|
+
const resolvedHeight = formatDimension(defaultHeight);
|
|
127
|
+
const resolvedWidth = formatDimension(defaultWidth);
|
|
116
128
|
if (direction === "horizontal") {
|
|
117
129
|
return {
|
|
118
|
-
width: isExpanded ?
|
|
130
|
+
width: isExpanded ? resolvedWidth : "0px",
|
|
119
131
|
height: resolvedHeight,
|
|
120
132
|
minWidth: 0
|
|
121
133
|
};
|
|
122
134
|
} else {
|
|
123
135
|
return {
|
|
124
136
|
height: isExpanded ? resolvedHeight : "0px",
|
|
125
|
-
width:
|
|
137
|
+
width: resolvedWidth,
|
|
126
138
|
minHeight: 0
|
|
127
139
|
};
|
|
128
140
|
}
|
|
129
141
|
};
|
|
130
142
|
const wrapperClass = direction === "horizontal" ? "collapsible-wrapper horizontal" : "collapsible-wrapper vertical";
|
|
131
143
|
const containerClass = direction === "horizontal" && buttonPosition === "right" ? "collapsible-container align-right" : "collapsible-container";
|
|
132
|
-
const height =
|
|
144
|
+
const height = getContentMaxHeight();
|
|
133
145
|
const contentStyle = {
|
|
134
|
-
maxHeight: direction === "vertical" ? isExpanded ?
|
|
146
|
+
maxHeight: direction === "vertical" ? isExpanded ? height : "0px" : height,
|
|
135
147
|
overflowY: "auto",
|
|
136
148
|
padding: direction === "vertical" && !isExpanded ? "0px" : contentPadding,
|
|
137
149
|
boxSizing: "border-box"
|
|
138
150
|
};
|
|
139
151
|
const buttonStyle = direction === "vertical" && buttonPosition === "bottom" && !isExpanded ? { top: "0px", bottom: "auto" } : {};
|
|
152
|
+
const formattedWidth = formatDimension(defaultWidth);
|
|
153
|
+
const formattedHeight = formatDimension(defaultHeight);
|
|
140
154
|
const wrapperStyle = direction === "vertical" ? isExpanded ? {
|
|
141
|
-
height:
|
|
142
|
-
width:
|
|
143
|
-
} : { height: 0, width:
|
|
155
|
+
height: formattedHeight,
|
|
156
|
+
width: formattedWidth
|
|
157
|
+
} : { height: 0, width: formattedWidth } : void 0;
|
|
144
158
|
return /* @__PURE__ */ jsxs("div", { className: wrapperClass, style: wrapperStyle, children: [
|
|
145
159
|
/* @__PURE__ */ jsxs("div", { style: getContainerStyle(), className: containerClass, children: [
|
|
146
160
|
title && /* @__PURE__ */ jsx2("div", { className: "collapsible-header", style: { display: "none" }, children: /* @__PURE__ */ jsx2("h3", { children: title }) }),
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../CollapseBox/index.tsx","../src/icons.tsx","../Splitter/index.tsx"],"sourcesContent":["import { useState, type CSSProperties, type ReactNode } from 'react';\nimport { DownOutlined, LeftOutlined, RightOutlined, UpOutlined } from '../src/icons';\nimport './index.less';\n\nexport type CollapseBoxDirection = 'horizontal' | 'vertical';\nexport type CollapseBoxButtonPosition = 'left' | 'right' | 'top' | 'bottom';\n\nexport interface CollapseBoxProps {\n children?: ReactNode;\n title?: string;\n direction?: CollapseBoxDirection;\n buttonPosition?: CollapseBoxButtonPosition;\n defaultWidth?: number;\n defaultHeight?: number;\n contentPadding?: string;\n headerHeight?: number;\n}\n\nconst isNumber = (value: unknown): value is number => typeof value === 'number' && !Number.isNaN(value);\n\nconst ChevronLeft = () => <LeftOutlined />;\n\nconst ChevronRight = () => <RightOutlined />;\n\nconst ChevronUp = () => <UpOutlined />;\n\nconst ChevronDown = () => <DownOutlined />;\n\nconst CollapsibleBox = ({\n children,\n title = '内容区域',\n direction = 'horizontal',\n buttonPosition = 'right',\n defaultWidth = 600,\n defaultHeight = 300,\n contentPadding = '16px',\n headerHeight = 16,\n}: CollapseBoxProps) => {\n const [isExpanded, setIsExpanded] = useState(true);\n const contentMaxHeight = isNumber(defaultHeight) ? defaultHeight - headerHeight : '100%';\n\n const getIcon = () => {\n if (direction === 'horizontal') {\n if (buttonPosition === 'right') {\n return isExpanded ? <ChevronRight /> : <ChevronLeft />;\n } else {\n return isExpanded ? <ChevronLeft /> : <ChevronRight />;\n }\n } else {\n if (buttonPosition === 'bottom') {\n return isExpanded ? <ChevronUp /> : <ChevronDown />;\n } else {\n return isExpanded ? <ChevronDown /> : <ChevronUp />;\n }\n }\n };\n\n const getButtonClass = () => {\n if (direction === 'horizontal') {\n return buttonPosition === 'right' ? 'button-right' : 'button-left';\n } else {\n return buttonPosition === 'bottom' ? 'button-bottom' : 'button-top';\n }\n };\n\n const getContainerStyle = (): CSSProperties => {\n const resolvedHeight = isNumber(defaultHeight) ? `${defaultHeight}px` : defaultHeight;\n if (direction === 'horizontal') {\n return {\n width: isExpanded ? defaultWidth : '0px',\n height: resolvedHeight,\n minWidth: 0,\n };\n } else {\n return {\n height: isExpanded ? resolvedHeight : '0px',\n width: defaultWidth,\n minHeight: 0,\n };\n }\n };\n\n const wrapperClass =\n direction === 'horizontal' ? 'collapsible-wrapper horizontal' : 'collapsible-wrapper vertical';\n\n const containerClass =\n direction === 'horizontal' && buttonPosition === 'right'\n ? 'collapsible-container align-right'\n : 'collapsible-container';\n const height = isNumber(contentMaxHeight) ? contentMaxHeight + 'px' : '100%';\n const contentStyle: CSSProperties = {\n maxHeight: direction === 'vertical' ? (isExpanded ? `${height}` : '0px') : `${height}`,\n overflowY: 'auto',\n padding: direction === 'vertical' && !isExpanded ? '0px' : contentPadding,\n boxSizing: 'border-box',\n };\n\n // 折叠时(纵向 + 底部按钮):按钮需切换为 top:0 定位,使其显示在折叠线下方\n const buttonStyle: CSSProperties =\n direction === 'vertical' && buttonPosition === 'bottom' && !isExpanded\n ? { top: '0px', bottom: 'auto' }\n : {};\n\n // 让 wrapper 高度跟随容器,确保 bottom:0 的按钮贴住容器底部\n // 折叠时 wrapper 高度为 0,配合按钮的 translateY(-100%) 让按钮显示在折叠线上方\n const wrapperStyle: CSSProperties | undefined =\n direction === 'vertical'\n ? isExpanded\n ? {\n height: isNumber(defaultHeight) ? `${defaultHeight}px` : undefined,\n width: defaultWidth,\n }\n : { height: 0, width: defaultWidth }\n : undefined;\n\n return (\n <div className={wrapperClass} style={wrapperStyle}>\n <div style={getContainerStyle()} className={containerClass}>\n {title && (\n <div className=\"collapsible-header\" style={{ display: 'none' }}>\n <h3>{title}</h3>\n </div>\n )}\n\n <div className=\"collapsible-content\" style={contentStyle}>\n {children}\n </div>\n </div>\n\n <div\n onClick={() => setIsExpanded(!isExpanded)}\n className={`toggle-button ${getButtonClass()}`}\n style={buttonStyle}\n title={isExpanded ? '隐藏' : '展开'}\n >\n {getIcon()}\n </div>\n </div>\n );\n};\n\nexport default CollapsibleBox;\n","import type { CSSProperties } from 'react';\n\ninterface IconProps {\n style?: CSSProperties;\n className?: string;\n}\n\nconst baseStyle: CSSProperties = {\n display: 'inline-block',\n width: '1em',\n height: '1em',\n verticalAlign: '-0.125em',\n};\n\nexport const LeftOutlined = ({ style, className }: IconProps) => (\n <svg\n viewBox=\"0 0 1024 1024\"\n focusable=\"false\"\n data-icon=\"left\"\n width=\"1em\"\n height=\"1em\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n style={{ ...baseStyle, ...style }}\n className={className}\n >\n <path d=\"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z\" />\n </svg>\n);\n\nexport const RightOutlined = ({ style, className }: IconProps) => (\n <svg\n viewBox=\"0 0 1024 1024\"\n focusable=\"false\"\n data-icon=\"right\"\n width=\"1em\"\n height=\"1em\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n style={{ ...baseStyle, ...style }}\n className={className}\n >\n <path d=\"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z\" />\n </svg>\n);\n\nexport const UpOutlined = ({ style, className }: IconProps) => (\n <svg\n viewBox=\"0 0 1024 1024\"\n focusable=\"false\"\n data-icon=\"up\"\n width=\"1em\"\n height=\"1em\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n style={{ ...baseStyle, ...style }}\n className={className}\n >\n <path d=\"M890.5 755.3L537.4 268a31.96 31.96 0 00-50.8 0L133.5 755.3a7.95 7.95 0 006.3 12.7h75.5c4.9 0 9.6-2.3 12.6-6.1l281-360 281 360c3 3.8 7.7 6.1 12.6 6.1h75.5c6.7 0 10.4-7.6 6.1-12.7z\" />\n </svg>\n);\n\nexport const DownOutlined = ({ style, className }: IconProps) => (\n <svg\n viewBox=\"0 0 1024 1024\"\n focusable=\"false\"\n data-icon=\"down\"\n width=\"1em\"\n height=\"1em\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n style={{ ...baseStyle, ...style }}\n className={className}\n >\n <path d=\"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 37 17.6 49.8 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z\" />\n </svg>\n);\n","import { DownOutlined, LeftOutlined, RightOutlined, UpOutlined } from '../src/icons';\r\nimport type {\r\n CSSProperties,\r\n ReactElement,\r\n ReactNode,\r\n PointerEvent as ReactPointerEvent,\r\n} from 'react';\r\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\r\n\r\nexport type SplitterSize = number | `${number}%`;\r\nexport type SplitterOrientation = 'horizontal' | 'vertical';\r\n\r\nexport type SplitterPanelProps = {\r\n children?: ReactNode;\r\n collapsible?: boolean;\r\n defaultSize?: SplitterSize;\r\n max?: SplitterSize;\r\n min?: SplitterSize;\r\n resizable?: boolean;\r\n size?: SplitterSize;\r\n style?: CSSProperties;\r\n};\r\n\r\nexport type SplitterProps = {\r\n children: ReactNode;\r\n className?: string;\r\n lazy?: boolean;\r\n onResize?: (sizes: number[]) => void;\r\n onResizeEnd?: (sizes: number[]) => void;\r\n onResizeStart?: (sizes: number[]) => void;\r\n orientation?: SplitterOrientation;\r\n style?: CSSProperties;\r\n vertical?: boolean;\r\n};\r\n\r\ntype SplitterComponent = React.FC<SplitterProps> & {\r\n Panel: React.FC<SplitterPanelProps>;\r\n};\r\n\r\nconst DRAGGER_SIZE = 8;\r\nconst MIN_PANEL_SIZE = 0;\r\n\r\nconst SplitterPanel: React.FC<SplitterPanelProps> = ({ children }) => <>{children}</>;\r\n\r\nconst isPercentSize = (value: SplitterSize): value is `${number}%` =>\r\n typeof value === 'string' && value.endsWith('%');\r\n\r\nconst parseSize = (value: SplitterSize | undefined, total: number, fallback: number) => {\r\n if (value === undefined) {\r\n return fallback;\r\n }\r\n\r\n if (isPercentSize(value)) {\r\n return (Number.parseFloat(value) / 100) * total;\r\n }\r\n\r\n return Number(value);\r\n};\r\n\r\nconst roundSizes = (sizes: number[]) => sizes.map((size) => Math.round(size));\r\n\r\nconst getPointerPosition = (\r\n event: PointerEvent | ReactPointerEvent,\r\n orientation: SplitterOrientation,\r\n) => (orientation === 'horizontal' ? event.clientX : event.clientY);\r\n\r\nconst clamp = (value: number, min: number, max: number) => Math.min(Math.max(value, min), max);\r\n\r\nconst CustomSplitter: SplitterComponent = ({\r\n children,\r\n className,\r\n lazy = false,\r\n onResize,\r\n onResizeEnd,\r\n onResizeStart,\r\n orientation,\r\n style,\r\n vertical = false,\r\n}) => {\r\n const resolvedOrientation = orientation ?? (vertical ? 'vertical' : 'horizontal');\r\n const rootRef = useRef<HTMLDivElement>(null);\r\n const sizesRef = useRef<number[]>([]);\r\n const lastNonZeroSizesRef = useRef<number[]>([]);\r\n const [containerSize, setContainerSize] = useState(0);\r\n const [draggingIndex, setDraggingIndex] = useState<number | null>(null);\r\n const [hoveredIndex, setHoveredIndex] = useState<number | null>(null);\r\n const [sizes, setSizes] = useState<number[]>([]);\r\n\r\n const panels = useMemo(\r\n () =>\r\n React.Children.toArray(children).filter(\r\n React.isValidElement,\r\n ) as ReactElement<SplitterPanelProps>[],\r\n [children],\r\n );\r\n\r\n const trackSize = Math.max(0, containerSize - Math.max(0, panels.length - 1) * DRAGGER_SIZE);\r\n\r\n const getPanelMin = useCallback(\r\n (index: number) => parseSize(panels[index]?.props.min, trackSize, MIN_PANEL_SIZE),\r\n [panels, trackSize],\r\n );\r\n\r\n const getPanelMax = useCallback(\r\n (index: number) => parseSize(panels[index]?.props.max, trackSize, trackSize),\r\n [panels, trackSize],\r\n );\r\n\r\n const normalizeToTrack = useCallback(\r\n (nextSizes: number[]) => {\r\n if (!trackSize || !nextSizes.length) {\r\n return nextSizes;\r\n }\r\n\r\n const normalized = [...nextSizes];\r\n const diff = trackSize - normalized.reduce((sum, size) => sum + size, 0);\r\n const flexibleIndex = normalized.findIndex((size) => size > 0);\r\n normalized[flexibleIndex === -1 ? 0 : flexibleIndex] += diff;\r\n return normalized.map((size, index) => clamp(size, 0, getPanelMax(index)));\r\n },\r\n [getPanelMax, trackSize],\r\n );\r\n\r\n const buildInitialSizes = useCallback(\r\n (previous?: number[]) => {\r\n if (!trackSize || !panels.length) {\r\n return [];\r\n }\r\n\r\n if (previous?.length === panels.length) {\r\n const previousTotal = previous.reduce((sum, size) => sum + size, 0);\r\n if (previousTotal > 0) {\r\n return normalizeToTrack(previous.map((size) => (size / previousTotal) * trackSize));\r\n }\r\n }\r\n\r\n const explicitSizes = panels.map((panel) =>\r\n parseSize(panel.props.size ?? panel.props.defaultSize, trackSize, -1),\r\n );\r\n const usedSize = explicitSizes\r\n .filter((size) => size >= 0)\r\n .reduce((sum, size) => sum + size, 0);\r\n const unsetCount = explicitSizes.filter((size) => size < 0).length;\r\n const fallbackSize = unsetCount ? Math.max(0, (trackSize - usedSize) / unsetCount) : 0;\r\n\r\n return normalizeToTrack(\r\n explicitSizes.map((size, index) =>\r\n clamp(size >= 0 ? size : fallbackSize, getPanelMin(index), getPanelMax(index)),\r\n ),\r\n );\r\n },\r\n [getPanelMax, getPanelMin, normalizeToTrack, panels, trackSize],\r\n );\r\n\r\n const updateSizes = useCallback(\r\n (nextSizes: number[], notify = true) => {\r\n const normalized = normalizeToTrack(nextSizes);\r\n setSizes(normalized);\r\n sizesRef.current = normalized;\r\n normalized.forEach((size, index) => {\r\n if (size > 1) {\r\n lastNonZeroSizesRef.current[index] = size;\r\n }\r\n });\r\n if (notify) {\r\n onResize?.(roundSizes(normalized));\r\n }\r\n },\r\n [normalizeToTrack, onResize],\r\n );\r\n\r\n useEffect(() => {\r\n const node = rootRef.current;\r\n if (!node) {\r\n return undefined;\r\n }\r\n\r\n const syncSize = () => {\r\n const rect = node.getBoundingClientRect();\r\n setContainerSize(resolvedOrientation === 'horizontal' ? rect.width : rect.height);\r\n };\r\n syncSize();\r\n\r\n const observer = new ResizeObserver(syncSize);\r\n observer.observe(node);\r\n return () => observer.disconnect();\r\n }, [resolvedOrientation]);\r\n\r\n useEffect(() => {\r\n setSizes((previous) => {\r\n const nextSizes = buildInitialSizes(previous);\r\n sizesRef.current = nextSizes;\r\n lastNonZeroSizesRef.current = nextSizes.map((size) =>\r\n Math.max(size, trackSize / Math.max(panels.length, 1)),\r\n );\r\n return nextSizes;\r\n });\r\n }, [buildInitialSizes, panels.length, trackSize]);\r\n\r\n const getResizedPair = useCallback(\r\n (sourceSizes: number[], index: number, delta: number) => {\r\n const nextSizes = [...sourceSizes];\r\n const leftSize = nextSizes[index];\r\n const rightSize = nextSizes[index + 1];\r\n const leftMin = getPanelMin(index);\r\n const rightMin = getPanelMin(index + 1);\r\n const leftMax = getPanelMax(index);\r\n const rightMax = getPanelMax(index + 1);\r\n const minDelta = Math.max(leftMin - leftSize, rightSize - rightMax);\r\n const maxDelta = Math.min(leftMax - leftSize, rightSize - rightMin);\r\n const safeDelta = clamp(delta, minDelta, maxDelta);\r\n\r\n nextSizes[index] = leftSize + safeDelta;\r\n nextSizes[index + 1] = rightSize - safeDelta;\r\n return normalizeToTrack(nextSizes);\r\n },\r\n [getPanelMax, getPanelMin, normalizeToTrack],\r\n );\r\n\r\n const resizePair = useCallback(\r\n (index: number, delta: number, notify = true) => {\r\n updateSizes(getResizedPair(sizesRef.current, index, delta), notify);\r\n },\r\n [getResizedPair, updateSizes],\r\n );\r\n\r\n const startResize = (index: number, event: ReactPointerEvent<HTMLDivElement>) => {\r\n if (panels[index].props.resizable === false || panels[index + 1].props.resizable === false) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n const startPosition = getPointerPosition(event, resolvedOrientation);\r\n const startSizes = [...sizesRef.current];\r\n let latestSizes = startSizes;\r\n\r\n setDraggingIndex(index);\r\n onResizeStart?.(roundSizes(startSizes));\r\n\r\n const handlePointerMove = (moveEvent: PointerEvent) => {\r\n const delta = getPointerPosition(moveEvent, resolvedOrientation) - startPosition;\r\n latestSizes = getResizedPair(startSizes, index, delta);\r\n if (!lazy) {\r\n updateSizes(latestSizes, true);\r\n }\r\n };\r\n\r\n const handlePointerUp = () => {\r\n document.removeEventListener('pointermove', handlePointerMove);\r\n document.removeEventListener('pointerup', handlePointerUp);\r\n setDraggingIndex(null);\r\n if (lazy) {\r\n updateSizes(latestSizes, true);\r\n }\r\n onResizeEnd?.(roundSizes(sizesRef.current));\r\n };\r\n\r\n document.addEventListener('pointermove', handlePointerMove);\r\n document.addEventListener('pointerup', handlePointerUp);\r\n };\r\n\r\n const toggleCollapse = (index: number, neighborIndex: number) => {\r\n const nextSizes = [...sizesRef.current];\r\n\r\n if (nextSizes[index] > 1) {\r\n lastNonZeroSizesRef.current[index] = nextSizes[index];\r\n nextSizes[neighborIndex] += nextSizes[index];\r\n nextSizes[index] = 0;\r\n } else {\r\n const restoredSize =\r\n lastNonZeroSizesRef.current[index] ||\r\n parseSize(panels[index].props.defaultSize, trackSize, trackSize / panels.length);\r\n nextSizes[index] = clamp(restoredSize, getPanelMin(index), getPanelMax(index));\r\n nextSizes[neighborIndex] = Math.max(0, nextSizes[neighborIndex] - nextSizes[index]);\r\n }\r\n\r\n updateSizes(nextSizes);\r\n onResizeEnd?.(roundSizes(sizesRef.current));\r\n };\r\n\r\n const resetSizes = () => {\r\n const nextSizes = buildInitialSizes();\r\n updateSizes(nextSizes);\r\n onResizeEnd?.(roundSizes(nextSizes));\r\n };\r\n\r\n const rootStyle: CSSProperties = {\r\n border: '1px solid #f0f0f0',\r\n borderRadius: 8,\r\n display: 'flex',\r\n flexDirection: resolvedOrientation === 'horizontal' ? 'row' : 'column',\r\n height: 360,\r\n minHeight: 0,\r\n overflow: 'hidden',\r\n width: '100%',\r\n ...style,\r\n };\r\n\r\n const renderCollapseButton = (\r\n draggerIndex: number,\r\n panelIndex: number,\r\n direction: 'start' | 'end',\r\n ) => {\r\n const panel = panels[panelIndex];\r\n if (!panel?.props.collapsible) {\r\n return null;\r\n }\r\n\r\n const neighborIndex = direction === 'start' ? panelIndex + 1 : panelIndex - 1;\r\n const isCollapsed = (sizes[panelIndex] ?? 0) <= 1;\r\n const isNeighborCollapsed = (sizes[neighborIndex] ?? 0) <= 1;\r\n\r\n // 自己折叠后隐藏;对侧面板折叠后也隐藏(避免与展开按钮重复/语义冲突)\r\n if (isCollapsed || isNeighborCollapsed) {\r\n return null;\r\n }\r\n\r\n // 展开时箭头指向面板将被折叠到的方向\r\n const Icon =\r\n resolvedOrientation === 'horizontal'\r\n ? direction === 'start'\r\n ? LeftOutlined\r\n : RightOutlined\r\n : direction === 'start'\r\n ? UpOutlined\r\n : DownOutlined;\r\n\r\n return (\r\n <button\r\n aria-label=\"折叠面板\"\r\n title=\"折叠面板\"\r\n onClick={(event) => {\r\n event.stopPropagation();\r\n toggleCollapse(panelIndex, neighborIndex);\r\n }}\r\n style={{\r\n alignItems: 'center',\r\n background: '#fff',\r\n border: '1px solid #d9d9d9',\r\n borderRadius: 4,\r\n color: '#595959',\r\n cursor: 'pointer',\r\n display: 'flex',\r\n height: 20,\r\n justifyContent: 'center',\r\n padding: 0,\r\n width: 20,\r\n fontSize: 12,\r\n }}\r\n type=\"button\"\r\n >\r\n <Icon />\r\n </button>\r\n );\r\n };\r\n\r\n // 渲染\"展开\"按钮:当某个面板被折叠时显示在分隔条上,箭头指向展开方向\r\n const renderExpandButton = (panelIndex: number, direction: 'start' | 'end') => {\r\n const panel = panels[panelIndex];\r\n if (!panel?.props.collapsible) {\r\n return null;\r\n }\r\n\r\n const isCollapsed = (sizes[panelIndex] ?? 0) <= 1;\r\n if (!isCollapsed) {\r\n return null;\r\n }\r\n\r\n const neighborIndex = direction === 'start' ? panelIndex + 1 : panelIndex - 1;\r\n\r\n // 折叠后面板展开的方向与折叠方向相反\r\n const Icon =\r\n resolvedOrientation === 'horizontal'\r\n ? direction === 'start'\r\n ? RightOutlined // 左面板折叠后,展开方向朝右\r\n : LeftOutlined // 右面板折叠后,展开方向朝左\r\n : direction === 'start'\r\n ? DownOutlined\r\n : UpOutlined;\r\n\r\n return (\r\n <button\r\n aria-label=\"展开面板\"\r\n title=\"展开面板\"\r\n onClick={(event) => {\r\n event.stopPropagation();\r\n toggleCollapse(panelIndex, neighborIndex);\r\n }}\r\n style={{\r\n alignItems: 'center',\r\n background: '#fff',\r\n border: '1px solid #d9d9d9',\r\n borderRadius: 4,\r\n color: '#595959',\r\n cursor: 'pointer',\r\n display: 'flex',\r\n height: 20,\r\n justifyContent: 'center',\r\n padding: 0,\r\n width: 20,\r\n fontSize: 12,\r\n }}\r\n type=\"button\"\r\n >\r\n <Icon />\r\n </button>\r\n );\r\n };\r\n\r\n return (\r\n <div className={className} ref={rootRef} style={rootStyle}>\r\n {panels.map((panel, index) => {\r\n const isHidden = sizes[index] <= 1;\r\n\r\n return (\r\n <React.Fragment key={index}>\r\n <div\r\n style={{\r\n background: index % 2 ? '#fff' : '#fafafa',\r\n flex: `0 0 ${sizes[index] ?? 0}px`,\r\n minHeight: 0,\r\n minWidth: 0,\r\n overflow: 'auto',\r\n padding: isHidden ? 0 : 16,\r\n transition: draggingIndex === null ? 'flex-basis 0.2s ease' : undefined,\r\n ...panel.props.style,\r\n }}\r\n >\r\n {!isHidden && panel.props.children}\r\n </div>\r\n\r\n {index < panels.length - 1 && (\r\n <div\r\n aria-orientation={resolvedOrientation}\r\n onDoubleClick={resetSizes}\r\n onKeyDown={(event) => {\r\n const step = event.shiftKey ? 40 : 10;\r\n const directionMap =\r\n resolvedOrientation === 'horizontal'\r\n ? { ArrowLeft: -step, ArrowRight: step }\r\n : { ArrowUp: -step, ArrowDown: step };\r\n const delta = directionMap[event.key as keyof typeof directionMap];\r\n if (delta !== undefined) {\r\n event.preventDefault();\r\n resizePair(index, delta);\r\n }\r\n }}\r\n onPointerDown={(event) => startResize(index, event)}\r\n onPointerEnter={() => setHoveredIndex(index)}\r\n onPointerLeave={() => setHoveredIndex(null)}\r\n role=\"separator\"\r\n style={{\r\n alignItems: 'center',\r\n background:\r\n hoveredIndex === index || draggingIndex === index ? '#e6f4ff' : '#f5f5f5',\r\n cursor: resolvedOrientation === 'horizontal' ? 'col-resize' : 'row-resize',\r\n display: 'flex',\r\n flex: `0 0 ${DRAGGER_SIZE}px`,\r\n justifyContent: 'center',\r\n outline: 'none',\r\n position: 'relative',\r\n userSelect: 'none',\r\n zIndex: 1,\r\n }}\r\n tabIndex={0}\r\n >\r\n <div\r\n style={{\r\n background:\r\n hoveredIndex === index || draggingIndex === index ? '#1677ff' : '#d9d9d9',\r\n borderRadius: 2,\r\n height: resolvedOrientation === 'horizontal' ? 48 : 2,\r\n width: resolvedOrientation === 'horizontal' ? 2 : 48,\r\n }}\r\n />\r\n <div\r\n style={{\r\n position: 'absolute',\r\n display: 'flex',\r\n flexDirection: resolvedOrientation === 'horizontal' ? 'column' : 'row',\r\n gap: 2,\r\n opacity:\r\n hoveredIndex === index ||\r\n (sizes[index] ?? 0) <= 1 ||\r\n (sizes[index + 1] ?? 0) <= 1\r\n ? 1\r\n : 0,\r\n transition: 'opacity 0.15s ease',\r\n pointerEvents:\r\n hoveredIndex === index ||\r\n (sizes[index] ?? 0) <= 1 ||\r\n (sizes[index + 1] ?? 0) <= 1\r\n ? 'auto'\r\n : 'none',\r\n }}\r\n >\r\n {renderCollapseButton(index, index, 'start')}\r\n {renderCollapseButton(index, index + 1, 'end')}\r\n {renderExpandButton(index, 'start')}\r\n {renderExpandButton(index + 1, 'end')}\r\n </div>\r\n </div>\r\n )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AAmB,QAAQ,GAAG,KAAK;AAAA;AAAA;AAAA,YACtC;AAAA;AAAA;AAAA,MACF;AAAA,SAtFiB,KAwFrB;AAAA,EAEJ,CAAC,GACH;AAEJ;AAEA,eAAe,QAAQ;AAEvB,IAAO,mBAAQ;","names":["jsx","useState","jsx","jsxs"]}
|
|
1
|
+
{"version":3,"sources":["../CollapseBox/index.tsx","../src/icons.tsx","../Splitter/index.tsx"],"sourcesContent":["import { useState, type CSSProperties, type ReactNode } from 'react';\nimport { DownOutlined, LeftOutlined, RightOutlined, UpOutlined } from '../src/icons';\nimport './index.less';\n\nexport type CollapseBoxDirection = 'horizontal' | 'vertical';\nexport type CollapseBoxButtonPosition = 'left' | 'right' | 'top' | 'bottom';\n\nexport interface CollapseBoxProps {\n children?: ReactNode;\n title?: string;\n direction?: CollapseBoxDirection;\n buttonPosition?: CollapseBoxButtonPosition;\n defaultWidth?: number | string;\n defaultHeight?: number | string;\n contentPadding?: string;\n headerHeight?: number;\n}\n\nconst isNumber = (value: unknown): value is number => typeof value === 'number' && !Number.isNaN(value);\n\nconst formatDimension = (value?: number | string): string | undefined => {\n if (value === undefined || value === null) return undefined;\n return typeof value === 'number' ? `${value}px` : value;\n};\n\nconst ChevronLeft = () => <LeftOutlined />;\n\nconst ChevronRight = () => <RightOutlined />;\n\nconst ChevronUp = () => <UpOutlined />;\n\nconst ChevronDown = () => <DownOutlined />;\n\nconst CollapsibleBox = ({\n children,\n title = '内容区域',\n direction = 'horizontal',\n buttonPosition = 'right',\n defaultWidth = 600,\n defaultHeight = 300,\n contentPadding = '16px',\n headerHeight = 16,\n}: CollapseBoxProps) => {\n const [isExpanded, setIsExpanded] = useState(true);\n\n const getContentMaxHeight = () => {\n if (typeof defaultHeight === 'number') {\n return `${defaultHeight - headerHeight}px`;\n }\n if (typeof defaultHeight === 'string') {\n return headerHeight ? `calc(${defaultHeight} - ${headerHeight}px)` : defaultHeight;\n }\n return '100%';\n };\n\n const getIcon = () => {\n if (direction === 'horizontal') {\n if (buttonPosition === 'right') {\n return isExpanded ? <ChevronRight /> : <ChevronLeft />;\n } else {\n return isExpanded ? <ChevronLeft /> : <ChevronRight />;\n }\n } else {\n if (buttonPosition === 'bottom') {\n return isExpanded ? <ChevronUp /> : <ChevronDown />;\n } else {\n return isExpanded ? <ChevronDown /> : <ChevronUp />;\n }\n }\n };\n\n const getButtonClass = () => {\n if (direction === 'horizontal') {\n return buttonPosition === 'right' ? 'button-right' : 'button-left';\n } else {\n return buttonPosition === 'bottom' ? 'button-bottom' : 'button-top';\n }\n };\n\n const getContainerStyle = (): CSSProperties => {\n const resolvedHeight = formatDimension(defaultHeight);\n const resolvedWidth = formatDimension(defaultWidth);\n if (direction === 'horizontal') {\n return {\n width: isExpanded ? resolvedWidth : '0px',\n height: resolvedHeight,\n minWidth: 0,\n };\n } else {\n return {\n height: isExpanded ? resolvedHeight : '0px',\n width: resolvedWidth,\n minHeight: 0,\n };\n }\n };\n\n const wrapperClass =\n direction === 'horizontal' ? 'collapsible-wrapper horizontal' : 'collapsible-wrapper vertical';\n\n const containerClass =\n direction === 'horizontal' && buttonPosition === 'right'\n ? 'collapsible-container align-right'\n : 'collapsible-container';\n const height = getContentMaxHeight();\n const contentStyle: CSSProperties = {\n maxHeight: direction === 'vertical' ? (isExpanded ? height : '0px') : height,\n overflowY: 'auto',\n padding: direction === 'vertical' && !isExpanded ? '0px' : contentPadding,\n boxSizing: 'border-box',\n };\n\n // 折叠时(纵向 + 底部按钮):按钮需切换为 top:0 定位,使其显示在折叠线下方\n const buttonStyle: CSSProperties =\n direction === 'vertical' && buttonPosition === 'bottom' && !isExpanded\n ? { top: '0px', bottom: 'auto' }\n : {};\n\n // 让 wrapper 高度跟随容器,确保 bottom:0 的按钮贴住容器底部\n // 折叠时 wrapper 高度为 0,配合按钮的 translateY(-100%) 让按钮显示在折叠线上方\n const formattedWidth = formatDimension(defaultWidth);\n const formattedHeight = formatDimension(defaultHeight);\n const wrapperStyle: CSSProperties | undefined =\n direction === 'vertical'\n ? isExpanded\n ? {\n height: formattedHeight,\n width: formattedWidth,\n }\n : { height: 0, width: formattedWidth }\n : undefined;\n\n return (\n <div className={wrapperClass} style={wrapperStyle}>\n <div style={getContainerStyle()} className={containerClass}>\n {title && (\n <div className=\"collapsible-header\" style={{ display: 'none' }}>\n <h3>{title}</h3>\n </div>\n )}\n\n <div className=\"collapsible-content\" style={contentStyle}>\n {children}\n </div>\n </div>\n\n <div\n onClick={() => setIsExpanded(!isExpanded)}\n className={`toggle-button ${getButtonClass()}`}\n style={buttonStyle}\n title={isExpanded ? '隐藏' : '展开'}\n >\n {getIcon()}\n </div>\n </div>\n );\n};\n\nexport default CollapsibleBox;\n","import type { CSSProperties } from 'react';\n\ninterface IconProps {\n style?: CSSProperties;\n className?: string;\n}\n\nconst baseStyle: CSSProperties = {\n display: 'inline-block',\n width: '1em',\n height: '1em',\n verticalAlign: '-0.125em',\n};\n\nexport const LeftOutlined = ({ style, className }: IconProps) => (\n <svg\n viewBox=\"0 0 1024 1024\"\n focusable=\"false\"\n data-icon=\"left\"\n width=\"1em\"\n height=\"1em\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n style={{ ...baseStyle, ...style }}\n className={className}\n >\n <path d=\"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z\" />\n </svg>\n);\n\nexport const RightOutlined = ({ style, className }: IconProps) => (\n <svg\n viewBox=\"0 0 1024 1024\"\n focusable=\"false\"\n data-icon=\"right\"\n width=\"1em\"\n height=\"1em\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n style={{ ...baseStyle, ...style }}\n className={className}\n >\n <path d=\"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z\" />\n </svg>\n);\n\nexport const UpOutlined = ({ style, className }: IconProps) => (\n <svg\n viewBox=\"0 0 1024 1024\"\n focusable=\"false\"\n data-icon=\"up\"\n width=\"1em\"\n height=\"1em\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n style={{ ...baseStyle, ...style }}\n className={className}\n >\n <path d=\"M890.5 755.3L537.4 268a31.96 31.96 0 00-50.8 0L133.5 755.3a7.95 7.95 0 006.3 12.7h75.5c4.9 0 9.6-2.3 12.6-6.1l281-360 281 360c3 3.8 7.7 6.1 12.6 6.1h75.5c6.7 0 10.4-7.6 6.1-12.7z\" />\n </svg>\n);\n\nexport const DownOutlined = ({ style, className }: IconProps) => (\n <svg\n viewBox=\"0 0 1024 1024\"\n focusable=\"false\"\n data-icon=\"down\"\n width=\"1em\"\n height=\"1em\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n style={{ ...baseStyle, ...style }}\n className={className}\n >\n <path d=\"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 37 17.6 49.8 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z\" />\n </svg>\n);\n","import { DownOutlined, LeftOutlined, RightOutlined, UpOutlined } from '../src/icons';\r\nimport type {\r\n CSSProperties,\r\n ReactElement,\r\n ReactNode,\r\n PointerEvent as ReactPointerEvent,\r\n} from 'react';\r\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\r\n\r\nexport type SplitterSize = number | `${number}%`;\r\nexport type SplitterOrientation = 'horizontal' | 'vertical';\r\n\r\nexport type SplitterPanelProps = {\r\n children?: ReactNode;\r\n collapsible?: boolean;\r\n defaultSize?: SplitterSize;\r\n max?: SplitterSize;\r\n min?: SplitterSize;\r\n resizable?: boolean;\r\n size?: SplitterSize;\r\n style?: CSSProperties;\r\n};\r\n\r\nexport type SplitterProps = {\r\n children: ReactNode;\r\n className?: string;\r\n lazy?: boolean;\r\n onResize?: (sizes: number[]) => void;\r\n onResizeEnd?: (sizes: number[]) => void;\r\n onResizeStart?: (sizes: number[]) => void;\r\n orientation?: SplitterOrientation;\r\n style?: CSSProperties;\r\n vertical?: boolean;\r\n};\r\n\r\ntype SplitterComponent = React.FC<SplitterProps> & {\r\n Panel: React.FC<SplitterPanelProps>;\r\n};\r\n\r\nconst DRAGGER_SIZE = 8;\r\nconst MIN_PANEL_SIZE = 0;\r\n\r\nconst SplitterPanel: React.FC<SplitterPanelProps> = ({ children }) => <>{children}</>;\r\n\r\nconst isPercentSize = (value: SplitterSize): value is `${number}%` =>\r\n typeof value === 'string' && value.endsWith('%');\r\n\r\nconst parseSize = (value: SplitterSize | undefined, total: number, fallback: number) => {\r\n if (value === undefined) {\r\n return fallback;\r\n }\r\n\r\n if (isPercentSize(value)) {\r\n return (Number.parseFloat(value) / 100) * total;\r\n }\r\n\r\n return Number(value);\r\n};\r\n\r\nconst roundSizes = (sizes: number[]) => sizes.map((size) => Math.round(size));\r\n\r\nconst getPointerPosition = (\r\n event: PointerEvent | ReactPointerEvent,\r\n orientation: SplitterOrientation,\r\n) => (orientation === 'horizontal' ? event.clientX : event.clientY);\r\n\r\nconst clamp = (value: number, min: number, max: number) => Math.min(Math.max(value, min), max);\r\n\r\nconst CustomSplitter: SplitterComponent = ({\r\n children,\r\n className,\r\n lazy = false,\r\n onResize,\r\n onResizeEnd,\r\n onResizeStart,\r\n orientation,\r\n style,\r\n vertical = false,\r\n}) => {\r\n const resolvedOrientation = orientation ?? (vertical ? 'vertical' : 'horizontal');\r\n const rootRef = useRef<HTMLDivElement>(null);\r\n const sizesRef = useRef<number[]>([]);\r\n const lastNonZeroSizesRef = useRef<number[]>([]);\r\n const [containerSize, setContainerSize] = useState(0);\r\n const [draggingIndex, setDraggingIndex] = useState<number | null>(null);\r\n const [hoveredIndex, setHoveredIndex] = useState<number | null>(null);\r\n const [sizes, setSizes] = useState<number[]>([]);\r\n\r\n const panels = useMemo(\r\n () =>\r\n React.Children.toArray(children).filter(\r\n React.isValidElement,\r\n ) as ReactElement<SplitterPanelProps>[],\r\n [children],\r\n );\r\n\r\n const trackSize = Math.max(0, containerSize - Math.max(0, panels.length - 1) * DRAGGER_SIZE);\r\n\r\n const getPanelMin = useCallback(\r\n (index: number) => parseSize(panels[index]?.props.min, trackSize, MIN_PANEL_SIZE),\r\n [panels, trackSize],\r\n );\r\n\r\n const getPanelMax = useCallback(\r\n (index: number) => parseSize(panels[index]?.props.max, trackSize, trackSize),\r\n [panels, trackSize],\r\n );\r\n\r\n const normalizeToTrack = useCallback(\r\n (nextSizes: number[]) => {\r\n if (!trackSize || !nextSizes.length) {\r\n return nextSizes;\r\n }\r\n\r\n const normalized = [...nextSizes];\r\n const diff = trackSize - normalized.reduce((sum, size) => sum + size, 0);\r\n const flexibleIndex = normalized.findIndex((size) => size > 0);\r\n normalized[flexibleIndex === -1 ? 0 : flexibleIndex] += diff;\r\n return normalized.map((size, index) => clamp(size, 0, getPanelMax(index)));\r\n },\r\n [getPanelMax, trackSize],\r\n );\r\n\r\n const buildInitialSizes = useCallback(\r\n (previous?: number[]) => {\r\n if (!trackSize || !panels.length) {\r\n return [];\r\n }\r\n\r\n if (previous?.length === panels.length) {\r\n const previousTotal = previous.reduce((sum, size) => sum + size, 0);\r\n if (previousTotal > 0) {\r\n return normalizeToTrack(previous.map((size) => (size / previousTotal) * trackSize));\r\n }\r\n }\r\n\r\n const explicitSizes = panels.map((panel) =>\r\n parseSize(panel.props.size ?? panel.props.defaultSize, trackSize, -1),\r\n );\r\n const usedSize = explicitSizes\r\n .filter((size) => size >= 0)\r\n .reduce((sum, size) => sum + size, 0);\r\n const unsetCount = explicitSizes.filter((size) => size < 0).length;\r\n const fallbackSize = unsetCount ? Math.max(0, (trackSize - usedSize) / unsetCount) : 0;\r\n\r\n return normalizeToTrack(\r\n explicitSizes.map((size, index) =>\r\n clamp(size >= 0 ? size : fallbackSize, getPanelMin(index), getPanelMax(index)),\r\n ),\r\n );\r\n },\r\n [getPanelMax, getPanelMin, normalizeToTrack, panels, trackSize],\r\n );\r\n\r\n const updateSizes = useCallback(\r\n (nextSizes: number[], notify = true) => {\r\n const normalized = normalizeToTrack(nextSizes);\r\n setSizes(normalized);\r\n sizesRef.current = normalized;\r\n normalized.forEach((size, index) => {\r\n if (size > 1) {\r\n lastNonZeroSizesRef.current[index] = size;\r\n }\r\n });\r\n if (notify) {\r\n onResize?.(roundSizes(normalized));\r\n }\r\n },\r\n [normalizeToTrack, onResize],\r\n );\r\n\r\n useEffect(() => {\r\n const node = rootRef.current;\r\n if (!node) {\r\n return undefined;\r\n }\r\n\r\n const syncSize = () => {\r\n const rect = node.getBoundingClientRect();\r\n setContainerSize(resolvedOrientation === 'horizontal' ? rect.width : rect.height);\r\n };\r\n syncSize();\r\n\r\n const observer = new ResizeObserver(syncSize);\r\n observer.observe(node);\r\n return () => observer.disconnect();\r\n }, [resolvedOrientation]);\r\n\r\n useEffect(() => {\r\n setSizes((previous) => {\r\n const nextSizes = buildInitialSizes(previous);\r\n sizesRef.current = nextSizes;\r\n lastNonZeroSizesRef.current = nextSizes.map((size) =>\r\n Math.max(size, trackSize / Math.max(panels.length, 1)),\r\n );\r\n return nextSizes;\r\n });\r\n }, [buildInitialSizes, panels.length, trackSize]);\r\n\r\n const getResizedPair = useCallback(\r\n (sourceSizes: number[], index: number, delta: number) => {\r\n const nextSizes = [...sourceSizes];\r\n const leftSize = nextSizes[index];\r\n const rightSize = nextSizes[index + 1];\r\n const leftMin = getPanelMin(index);\r\n const rightMin = getPanelMin(index + 1);\r\n const leftMax = getPanelMax(index);\r\n const rightMax = getPanelMax(index + 1);\r\n const minDelta = Math.max(leftMin - leftSize, rightSize - rightMax);\r\n const maxDelta = Math.min(leftMax - leftSize, rightSize - rightMin);\r\n const safeDelta = clamp(delta, minDelta, maxDelta);\r\n\r\n nextSizes[index] = leftSize + safeDelta;\r\n nextSizes[index + 1] = rightSize - safeDelta;\r\n return normalizeToTrack(nextSizes);\r\n },\r\n [getPanelMax, getPanelMin, normalizeToTrack],\r\n );\r\n\r\n const resizePair = useCallback(\r\n (index: number, delta: number, notify = true) => {\r\n updateSizes(getResizedPair(sizesRef.current, index, delta), notify);\r\n },\r\n [getResizedPair, updateSizes],\r\n );\r\n\r\n const startResize = (index: number, event: ReactPointerEvent<HTMLDivElement>) => {\r\n if (panels[index].props.resizable === false || panels[index + 1].props.resizable === false) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n const startPosition = getPointerPosition(event, resolvedOrientation);\r\n const startSizes = [...sizesRef.current];\r\n let latestSizes = startSizes;\r\n\r\n setDraggingIndex(index);\r\n onResizeStart?.(roundSizes(startSizes));\r\n\r\n const handlePointerMove = (moveEvent: PointerEvent) => {\r\n const delta = getPointerPosition(moveEvent, resolvedOrientation) - startPosition;\r\n latestSizes = getResizedPair(startSizes, index, delta);\r\n if (!lazy) {\r\n updateSizes(latestSizes, true);\r\n }\r\n };\r\n\r\n const handlePointerUp = () => {\r\n document.removeEventListener('pointermove', handlePointerMove);\r\n document.removeEventListener('pointerup', handlePointerUp);\r\n setDraggingIndex(null);\r\n if (lazy) {\r\n updateSizes(latestSizes, true);\r\n }\r\n onResizeEnd?.(roundSizes(sizesRef.current));\r\n };\r\n\r\n document.addEventListener('pointermove', handlePointerMove);\r\n document.addEventListener('pointerup', handlePointerUp);\r\n };\r\n\r\n const toggleCollapse = (index: number, neighborIndex: number) => {\r\n const nextSizes = [...sizesRef.current];\r\n\r\n if (nextSizes[index] > 1) {\r\n lastNonZeroSizesRef.current[index] = nextSizes[index];\r\n nextSizes[neighborIndex] += nextSizes[index];\r\n nextSizes[index] = 0;\r\n } else {\r\n const restoredSize =\r\n lastNonZeroSizesRef.current[index] ||\r\n parseSize(panels[index].props.defaultSize, trackSize, trackSize / panels.length);\r\n nextSizes[index] = clamp(restoredSize, getPanelMin(index), getPanelMax(index));\r\n nextSizes[neighborIndex] = Math.max(0, nextSizes[neighborIndex] - nextSizes[index]);\r\n }\r\n\r\n updateSizes(nextSizes);\r\n onResizeEnd?.(roundSizes(sizesRef.current));\r\n };\r\n\r\n const resetSizes = () => {\r\n const nextSizes = buildInitialSizes();\r\n updateSizes(nextSizes);\r\n onResizeEnd?.(roundSizes(nextSizes));\r\n };\r\n\r\n const rootStyle: CSSProperties = {\r\n border: '1px solid #f0f0f0',\r\n borderRadius: 8,\r\n display: 'flex',\r\n flexDirection: resolvedOrientation === 'horizontal' ? 'row' : 'column',\r\n height: 360,\r\n minHeight: 0,\r\n overflow: 'hidden',\r\n width: '100%',\r\n ...style,\r\n };\r\n\r\n const renderCollapseButton = (\r\n draggerIndex: number,\r\n panelIndex: number,\r\n direction: 'start' | 'end',\r\n ) => {\r\n const panel = panels[panelIndex];\r\n if (!panel?.props.collapsible) {\r\n return null;\r\n }\r\n\r\n const neighborIndex = direction === 'start' ? panelIndex + 1 : panelIndex - 1;\r\n const isCollapsed = (sizes[panelIndex] ?? 0) <= 1;\r\n const isNeighborCollapsed = (sizes[neighborIndex] ?? 0) <= 1;\r\n\r\n // 自己折叠后隐藏;对侧面板折叠后也隐藏(避免与展开按钮重复/语义冲突)\r\n if (isCollapsed || isNeighborCollapsed) {\r\n return null;\r\n }\r\n\r\n // 展开时箭头指向面板将被折叠到的方向\r\n const Icon =\r\n resolvedOrientation === 'horizontal'\r\n ? direction === 'start'\r\n ? LeftOutlined\r\n : RightOutlined\r\n : direction === 'start'\r\n ? UpOutlined\r\n : DownOutlined;\r\n\r\n return (\r\n <button\r\n aria-label=\"折叠面板\"\r\n title=\"折叠面板\"\r\n onClick={(event) => {\r\n event.stopPropagation();\r\n toggleCollapse(panelIndex, neighborIndex);\r\n }}\r\n style={{\r\n alignItems: 'center',\r\n background: '#fff',\r\n border: '1px solid #d9d9d9',\r\n borderRadius: 4,\r\n color: '#595959',\r\n cursor: 'pointer',\r\n display: 'flex',\r\n height: 20,\r\n justifyContent: 'center',\r\n padding: 0,\r\n width: 20,\r\n fontSize: 12,\r\n }}\r\n type=\"button\"\r\n >\r\n <Icon />\r\n </button>\r\n );\r\n };\r\n\r\n // 渲染\"展开\"按钮:当某个面板被折叠时显示在分隔条上,箭头指向展开方向\r\n const renderExpandButton = (panelIndex: number, direction: 'start' | 'end') => {\r\n const panel = panels[panelIndex];\r\n if (!panel?.props.collapsible) {\r\n return null;\r\n }\r\n\r\n const isCollapsed = (sizes[panelIndex] ?? 0) <= 1;\r\n if (!isCollapsed) {\r\n return null;\r\n }\r\n\r\n const neighborIndex = direction === 'start' ? panelIndex + 1 : panelIndex - 1;\r\n\r\n // 折叠后面板展开的方向与折叠方向相反\r\n const Icon =\r\n resolvedOrientation === 'horizontal'\r\n ? direction === 'start'\r\n ? RightOutlined // 左面板折叠后,展开方向朝右\r\n : LeftOutlined // 右面板折叠后,展开方向朝左\r\n : direction === 'start'\r\n ? DownOutlined\r\n : UpOutlined;\r\n\r\n return (\r\n <button\r\n aria-label=\"展开面板\"\r\n title=\"展开面板\"\r\n onClick={(event) => {\r\n event.stopPropagation();\r\n toggleCollapse(panelIndex, neighborIndex);\r\n }}\r\n style={{\r\n alignItems: 'center',\r\n background: '#fff',\r\n border: '1px solid #d9d9d9',\r\n borderRadius: 4,\r\n color: '#595959',\r\n cursor: 'pointer',\r\n display: 'flex',\r\n height: 20,\r\n justifyContent: 'center',\r\n padding: 0,\r\n width: 20,\r\n fontSize: 12,\r\n }}\r\n type=\"button\"\r\n >\r\n <Icon />\r\n </button>\r\n );\r\n };\r\n\r\n return (\r\n <div className={className} ref={rootRef} style={rootStyle}>\r\n {panels.map((panel, index) => {\r\n const isHidden = sizes[index] <= 1;\r\n\r\n return (\r\n <React.Fragment key={index}>\r\n <div\r\n style={{\r\n background: index % 2 ? '#fff' : '#fafafa',\r\n flex: `0 0 ${sizes[index] ?? 0}px`,\r\n minHeight: 0,\r\n minWidth: 0,\r\n overflow: 'auto',\r\n padding: isHidden ? 0 : 16,\r\n transition: draggingIndex === null ? 'flex-basis 0.2s ease' : undefined,\r\n ...panel.props.style,\r\n }}\r\n >\r\n {!isHidden && panel.props.children}\r\n </div>\r\n\r\n {index < panels.length - 1 && (\r\n <div\r\n aria-orientation={resolvedOrientation}\r\n onDoubleClick={resetSizes}\r\n onKeyDown={(event) => {\r\n const step = event.shiftKey ? 40 : 10;\r\n const directionMap =\r\n resolvedOrientation === 'horizontal'\r\n ? { ArrowLeft: -step, ArrowRight: step }\r\n : { ArrowUp: -step, ArrowDown: step };\r\n const delta = directionMap[event.key as keyof typeof directionMap];\r\n if (delta !== undefined) {\r\n event.preventDefault();\r\n resizePair(index, delta);\r\n }\r\n }}\r\n onPointerDown={(event) => startResize(index, event)}\r\n onPointerEnter={() => setHoveredIndex(index)}\r\n onPointerLeave={() => setHoveredIndex(null)}\r\n role=\"separator\"\r\n style={{\r\n alignItems: 'center',\r\n background:\r\n hoveredIndex === index || draggingIndex === index ? '#e6f4ff' : '#f5f5f5',\r\n cursor: resolvedOrientation === 'horizontal' ? 'col-resize' : 'row-resize',\r\n display: 'flex',\r\n flex: `0 0 ${DRAGGER_SIZE}px`,\r\n justifyContent: 'center',\r\n outline: 'none',\r\n position: 'relative',\r\n userSelect: 'none',\r\n zIndex: 1,\r\n }}\r\n tabIndex={0}\r\n >\r\n <div\r\n style={{\r\n background:\r\n hoveredIndex === index || draggingIndex === index ? '#1677ff' : '#d9d9d9',\r\n borderRadius: 2,\r\n height: resolvedOrientation === 'horizontal' ? 48 : 2,\r\n width: resolvedOrientation === 'horizontal' ? 2 : 48,\r\n }}\r\n />\r\n <div\r\n style={{\r\n position: 'absolute',\r\n display: 'flex',\r\n flexDirection: resolvedOrientation === 'horizontal' ? 'column' : 'row',\r\n gap: 2,\r\n opacity:\r\n hoveredIndex === index ||\r\n (sizes[index] ?? 0) <= 1 ||\r\n (sizes[index + 1] ?? 0) <= 1\r\n ? 1\r\n : 0,\r\n transition: 'opacity 0.15s ease',\r\n pointerEvents:\r\n hoveredIndex === index ||\r\n (sizes[index] ?? 0) <= 1 ||\r\n (sizes[index + 1] ?? 0) <= 1\r\n ? 'auto'\r\n : 'none',\r\n }}\r\n >\r\n {renderCollapseButton(index, index, 'start')}\r\n {renderCollapseButton(index, index + 1, 'end')}\r\n {renderExpandButton(index, 'start')}\r\n {renderExpandButton(index + 1, 'end')}\r\n </div>\r\n </div>\r\n )}\r\n </React.Fragment>\r\n );\r\n })}\r\n </div>\r\n );\r\n};\r\n\r\nCustomSplitter.Panel = SplitterPanel;\r\n\r\nexport default CustomSplitter;\r\n"],"mappings":";AAAA,SAAS,gBAAoD;;;AC0BzD;AAnBJ,IAAM,YAA2B;AAAA,EAC/B,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,eAAe;AACjB;AAEO,IAAM,eAAe,CAAC,EAAE,OAAO,UAAU,MAC9C;AAAA,EAAC;AAAA;AAAA,IACC,SAAQ;AAAA,IACR,WAAU;AAAA,IACV,aAAU;AAAA,IACV,OAAM;AAAA,IACN,QAAO;AAAA,IACP,MAAK;AAAA,IACL,eAAY;AAAA,IACZ,OAAO,EAAE,GAAG,WAAW,GAAG,MAAM;AAAA,IAChC;AAAA,IAEA,8BAAC,UAAK,GAAE,yLAAwL;AAAA;AAClM;AAGK,IAAM,gBAAgB,CAAC,EAAE,OAAO,UAAU,MAC/C;AAAA,EAAC;AAAA;AAAA,IACC,SAAQ;AAAA,IACR,WAAU;AAAA,IACV,aAAU;AAAA,IACV,OAAM;AAAA,IACN,QAAO;AAAA,IACP,MAAK;AAAA,IACL,eAAY;AAAA,IACZ,OAAO,EAAE,GAAG,WAAW,GAAG,MAAM;AAAA,IAChC;AAAA,IAEA,8BAAC,UAAK,GAAE,0LAAyL;AAAA;AACnM;AAGK,IAAM,aAAa,CAAC,EAAE,OAAO,UAAU,MAC5C;AAAA,EAAC;AAAA;AAAA,IACC,SAAQ;AAAA,IAC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