@baishuyun/ai-design 2.0.5 → 2.0.7

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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # @baishuyun/ai-design
2
2
 
3
+ ## 2.0.7
4
+
5
+ ### Patch Changes
6
+
7
+ - fix text and perm
8
+ - Updated dependencies
9
+ - @baishuyun/ai-feat-utils@2.0.7
10
+ - @baishuyun/types@3.0.7
11
+
12
+ ## 2.0.6
13
+
14
+ ### Patch Changes
15
+
16
+ - style udpate
17
+ - Updated dependencies
18
+ - @baishuyun/ai-feat-utils@2.0.6
19
+ - @baishuyun/types@3.0.6
20
+
3
21
  ## 2.0.5
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.5",
3
+ "version": "2.0.7",
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.5",
64
- "@baishuyun/types": "3.0.5"
63
+ "@baishuyun/types": "3.0.7",
64
+ "@baishuyun/ai-feat-utils": "2.0.7"
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.5",
87
- "@baishuyun/types": "3.0.5",
88
- "@baishuyun/typescript-config": "2.0.5"
86
+ "@baishuyun/tailwind-config": "3.0.7",
87
+ "@baishuyun/types": "3.0.7",
88
+ "@baishuyun/typescript-config": "2.0.7"
89
89
  },
90
90
  "keywords": [],
91
91
  "author": "",
@@ -11,7 +11,7 @@ export interface SearchInputProps {
11
11
  export const SearchInput = ({
12
12
  value,
13
13
  onChange,
14
- placeholder = '搜索智能体名称',
14
+ placeholder = '',
15
15
  className,
16
16
  }: SearchInputProps) => {
17
17
  return (
@@ -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 && (
@@ -318,7 +318,7 @@ export function ScrollSlider({
318
318
  className={cn(
319
319
  'flex-1 overflow-x-auto scrollbar-hide flex min-w-0',
320
320
  isTabs
321
- ? 'items-end gap-0 overflow-y-hidden border-b-[#e0e0e0] before:content-[""] before:absolute before:bottom-[0px] before:left-[-200px] before:right-0 before:h-[1px] before:w-[100vw] before:bg-[#e0e0e0]'
321
+ ? 'items-end gap-0 overflow-y-hidden border-b-[#e0e0e0] before:content-[""] before:absolute before:bottom-[0px] before:left-[-200px] before:right-0 before:h-[1px] before:w-[100vw] before:bg-[#e0e0e0] h-full'
322
322
  : 'items-center gap-2.5',
323
323
  )}
324
324
  >
@@ -353,9 +353,9 @@ export function ScrollSlider({
353
353
  transCls,
354
354
  isTabs
355
355
  ? [
356
- 'px-[16px] py-[8px] relative z-10 border-b-none',
356
+ 'px-[16px] py-[8px] relative z-10 border-b-none h-full',
357
357
  isSelected
358
- ? 'border-r border-t border-l border-[#e0e0e0] bg-[#f6f7fa] text-[#0265FF] rounded-t-[8px] rounded-b-none '
358
+ ? 'border-r border-t border-l border-[#e0e0e0] bg-[#f6f7fa] text-[#0265FF] rounded-t-[10px] rounded-b-none '
359
359
  : 'text-[#030303] hover:bg-[#F0F6FF] rounded-t-[8px]',
360
360
  ]
361
361
  : [
@@ -394,9 +394,9 @@ export function ScrollSlider({
394
394
  transCls,
395
395
  isTabs
396
396
  ? [
397
- 'px-[16px] py-[8px] relative z-10',
397
+ 'px-[16px] py-[8px] relative z-10 h-full',
398
398
  isGroupActive
399
- ? 'border-r border-t border-l border-[#e0e0e0] bg-[#f6f7fa] text-[#0265FF] rounded-t-[8px] rounded-b-none '
399
+ ? 'border-r border-t border-l border-[#e0e0e0] bg-[#f6f7fa] text-[#0265FF] rounded-t-[10px] rounded-b-none '
400
400
  : 'text-[#030303] hover:bg-[#F0F6FF] rounded-t-[8px]',
401
401
  ]
402
402
  : [
@@ -456,7 +456,7 @@ export function ScrollSlider({
456
456
  return (
457
457
  <div className={classNames("flex flex-1 min-w-0", tabCls)}>
458
458
  {isTabs ? (
459
- <div className="relative flex items-stretch flex-1 min-w-0">
459
+ <div className="relative flex items-stretch flex-1 min-w-0 h-full">
460
460
  {sliderBody}
461
461
  </div>
462
462
  ) : (
@@ -477,6 +477,7 @@ export function ScrollSlider({
477
477
  )}
478
478
  >
479
479
  <SearchInput
480
+ placeholder='搜索表单名称'
480
481
  value={groupSearchQuery}
481
482
  onChange={setGroupSearchQuery}
482
483
  />
@@ -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 = [360, 500],
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
- const [width, setWidth] = useState<number>(initialWidth ?? maxWidth);
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);