@baishuyun/ai-design 2.0.6 → 2.0.8
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/CHANGELOG.md +18 -0
- package/package.json +6 -6
- package/src/components/agent-helper/search-input/index.tsx +1 -1
- package/src/components/bs-entry-select/entry-popover.tsx +1 -1
- package/src/components/bs-entry-select/scroll-slider.tsx +1 -0
- package/src/components/bs-entry-select/search-input.tsx +1 -1
- package/src/components/office-container.tsx +7 -2
- package/src/hooks/use-resizable-width.ts +31 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @baishuyun/ai-design
|
|
2
2
|
|
|
3
|
+
## 2.0.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- bugfix
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @baishuyun/ai-feat-utils@2.0.8
|
|
10
|
+
- @baishuyun/types@3.0.8
|
|
11
|
+
|
|
12
|
+
## 2.0.7
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- fix text and perm
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
- @baishuyun/ai-feat-utils@2.0.7
|
|
19
|
+
- @baishuyun/types@3.0.7
|
|
20
|
+
|
|
3
21
|
## 2.0.6
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baishuyun/ai-design",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"description": "AI 功能 UI 组件库 - 所有 AI 功能的 UI 表现唯一真相来源",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"tw-animate-css": "^1.4.0",
|
|
61
61
|
"vaul": "^1.1.2",
|
|
62
62
|
"zod": "^4.1.13",
|
|
63
|
-
"@baishuyun/ai-feat-utils": "2.0.
|
|
64
|
-
"@baishuyun/types": "3.0.
|
|
63
|
+
"@baishuyun/ai-feat-utils": "2.0.8",
|
|
64
|
+
"@baishuyun/types": "3.0.8"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"react": "^19.0.0",
|
|
@@ -83,9 +83,9 @@
|
|
|
83
83
|
"typescript": "^5.5.0",
|
|
84
84
|
"vite": "^5.1.4",
|
|
85
85
|
"vite-plugin-dts": "^4.5.4",
|
|
86
|
-
"@baishuyun/tailwind-config": "3.0.
|
|
87
|
-
"@baishuyun/types": "3.0.
|
|
88
|
-
"@baishuyun/typescript-config": "2.0.
|
|
86
|
+
"@baishuyun/tailwind-config": "3.0.8",
|
|
87
|
+
"@baishuyun/types": "3.0.8",
|
|
88
|
+
"@baishuyun/typescript-config": "2.0.8"
|
|
89
89
|
},
|
|
90
90
|
"keywords": [],
|
|
91
91
|
"author": "",
|
|
@@ -44,7 +44,7 @@ export function EntryPopover({
|
|
|
44
44
|
transCls,
|
|
45
45
|
)}
|
|
46
46
|
>
|
|
47
|
-
<SearchInput value={searchQuery} onChange={onSearchChange} />
|
|
47
|
+
<SearchInput value={searchQuery} onChange={onSearchChange} placeholder='搜索表单名称' />
|
|
48
48
|
|
|
49
49
|
<div className="flex flex-col gap-0 max-h-[400px] overflow-y-auto">
|
|
50
50
|
{hasCurrentApp && (
|
|
@@ -2,4 +2,4 @@ import { SearchInput as BaseSearch, type SearchInputProps} from '../agent-helper
|
|
|
2
2
|
|
|
3
3
|
export type { SearchInputProps };
|
|
4
4
|
|
|
5
|
-
export const SearchInput = (props: SearchInputProps) => <BaseSearch {...props} placeholder="
|
|
5
|
+
export const SearchInput = (props: SearchInputProps) => <BaseSearch {...props} placeholder="搜索表单" />;
|
|
@@ -25,7 +25,10 @@ export interface IOfficeContainerProps {
|
|
|
25
25
|
|
|
26
26
|
children?: React.ReactNode;
|
|
27
27
|
|
|
28
|
-
onResize?: (leftColWid: number, rightColWid: number) => void;
|
|
28
|
+
onResize?: (leftColWid: number, rightColWid: number) => void;
|
|
29
|
+
|
|
30
|
+
/** localStorage 键名,用于持久化用户拖拽的列宽偏好 */
|
|
31
|
+
storageKey?: string;
|
|
29
32
|
|
|
30
33
|
className?: string;
|
|
31
34
|
}
|
|
@@ -34,7 +37,7 @@ export interface IOfficeContainerProps {
|
|
|
34
37
|
export const OfficeContainer: FC<IOfficeContainerProps> = ({
|
|
35
38
|
headerHeight = 64,
|
|
36
39
|
hideLeftCol = false,
|
|
37
|
-
leftColWidthRange = [
|
|
40
|
+
leftColWidthRange = [340, 500],
|
|
38
41
|
rightColWidthRange,
|
|
39
42
|
leftColCls,
|
|
40
43
|
rightColCls,
|
|
@@ -46,6 +49,7 @@ export const OfficeContainer: FC<IOfficeContainerProps> = ({
|
|
|
46
49
|
fullscreenPart = 'none',
|
|
47
50
|
className,
|
|
48
51
|
onResize,
|
|
52
|
+
storageKey,
|
|
49
53
|
}) => {
|
|
50
54
|
const isRightResizable = !!rightColWidthRange;
|
|
51
55
|
const activeRange = rightColWidthRange ?? leftColWidthRange;
|
|
@@ -57,6 +61,7 @@ export const OfficeContainer: FC<IOfficeContainerProps> = ({
|
|
|
57
61
|
range: activeRange,
|
|
58
62
|
initialWidth: activeRange[0],
|
|
59
63
|
invertDrag: isRightResizable,
|
|
64
|
+
storageKey,
|
|
60
65
|
});
|
|
61
66
|
|
|
62
67
|
const isLeftFullscreen = fullscreenPart === 'leftCol';
|
|
@@ -7,6 +7,8 @@ interface UseResizableWidthOptions {
|
|
|
7
7
|
initialWidth?: number;
|
|
8
8
|
/** 反转拖拽方向:拖拽鼠标向右时宽度减小而非增大 */
|
|
9
9
|
invertDrag?: boolean;
|
|
10
|
+
/** localStorage 键名,用于持久化用户拖拽偏好。提供后会在 mount 时读取、drag end 时保存 */
|
|
11
|
+
storageKey?: string;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
interface UseResizableWidthResult {
|
|
@@ -29,9 +31,26 @@ export const useResizableWidth = ({
|
|
|
29
31
|
range,
|
|
30
32
|
initialWidth,
|
|
31
33
|
invertDrag,
|
|
34
|
+
storageKey,
|
|
32
35
|
}: UseResizableWidthOptions): UseResizableWidthResult => {
|
|
33
36
|
const [minWidth, maxWidth] = range;
|
|
34
|
-
|
|
37
|
+
|
|
38
|
+
const resolveInitialWidth = (): number => {
|
|
39
|
+
if (storageKey) {
|
|
40
|
+
try {
|
|
41
|
+
const stored = localStorage.getItem(storageKey);
|
|
42
|
+
if (stored !== null) {
|
|
43
|
+
const parsed = Number(stored);
|
|
44
|
+
if (!Number.isNaN(parsed) && parsed >= minWidth && parsed <= maxWidth) {
|
|
45
|
+
return parsed;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
} catch { /* localStorage unavailable */ }
|
|
49
|
+
}
|
|
50
|
+
return initialWidth ?? maxWidth;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const [width, setWidth] = useState<number>(resolveInitialWidth);
|
|
35
54
|
const [isDragging, setIsDragging] = useState(false);
|
|
36
55
|
|
|
37
56
|
const stateRef = useRef({
|
|
@@ -53,16 +72,26 @@ export const useResizableWidth = ({
|
|
|
53
72
|
[minWidth, maxWidth, invertDrag]
|
|
54
73
|
);
|
|
55
74
|
|
|
75
|
+
const hasDraggedRef = useRef(false);
|
|
76
|
+
|
|
56
77
|
const handleMouseUp = useCallback(() => {
|
|
57
78
|
setIsDragging(false);
|
|
79
|
+
hasDraggedRef.current = true;
|
|
58
80
|
document.body.style.userSelect = '';
|
|
59
81
|
document.removeEventListener('mousemove', handleMouseMove);
|
|
60
82
|
document.removeEventListener('mouseup', handleMouseUp);
|
|
61
83
|
|
|
62
84
|
window.dispatchEvent(new Event('resize'));
|
|
63
|
-
document.body.style.cursor = '';
|
|
85
|
+
document.body.style.cursor = '';
|
|
64
86
|
}, [handleMouseMove]);
|
|
65
87
|
|
|
88
|
+
// Persist width to localStorage after drag ends
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (!isDragging && hasDraggedRef.current && storageKey) {
|
|
91
|
+
try { localStorage.setItem(storageKey, String(width)); } catch { /* unavailable */ }
|
|
92
|
+
}
|
|
93
|
+
}, [isDragging, storageKey, width]);
|
|
94
|
+
|
|
66
95
|
const handleMouseDown = useCallback(
|
|
67
96
|
(e: React.MouseEvent) => {
|
|
68
97
|
setIsDragging(true);
|