@mxmweb/zui 1.1.13 → 1.3.0

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.
Files changed (130) hide show
  1. package/README.md +61 -3
  2. package/assets/style.css +1 -0
  3. package/cluster_enter.d.ts +25 -0
  4. package/index.js +33 -0
  5. package/package.json +24 -39
  6. package/.editorconfig +0 -38
  7. package/.prettierignore +0 -16
  8. package/.prettierrc +0 -17
  9. package/.releaserc.json +0 -36
  10. package/CHANGELOG.md +0 -58
  11. package/CONTRIBUTING.md +0 -111
  12. package/NPMREADME.md +0 -0
  13. package/bash.exe.stackdump +0 -40
  14. package/components.json +0 -21
  15. package/dist/Preview.d.ts +0 -3
  16. package/dist/README.md +0 -4
  17. package/dist/assets/style.css +0 -1
  18. package/dist/containers/DashboardContainer.d.ts +0 -35
  19. package/dist/containers/DockContainer.d.ts +0 -24
  20. package/dist/elements/Button.d.ts +0 -17
  21. package/dist/elements/CustomDock.d.ts +0 -25
  22. package/dist/elements/DropDownButton.d.ts +0 -24
  23. package/dist/elements/DropdownMenu.d.ts +0 -17
  24. package/dist/elements/GoggleNavbar.d.ts +0 -31
  25. package/dist/elements/Uploader/UploadItem.d.ts +0 -35
  26. package/dist/elements/Uploader/example.d.ts +0 -7
  27. package/dist/elements/Uploader/index.d.ts +0 -9
  28. package/dist/elements/Uploader/styles.d.ts +0 -65
  29. package/dist/elements/Uploader/types.d.ts +0 -87
  30. package/dist/elements/Uploader/utils.d.ts +0 -31
  31. package/dist/elements/Uploader.d.ts +0 -2
  32. package/dist/examples/DockContainerExample.d.ts +0 -3
  33. package/dist/icons/Icon.d.ts +0 -7
  34. package/dist/icons/Icon.tsx +0 -82
  35. package/dist/icons/index.d.ts +0 -13
  36. package/dist/icons/index.tsx +0 -92
  37. package/dist/icons/lazyIndex.d.ts +0 -7
  38. package/dist/icons/lazyIndex.tsx +0 -49
  39. package/dist/icons/rag/csv.svg +0 -3
  40. package/dist/icons/rag/document.svg +0 -3
  41. package/dist/icons/rag/excel.svg +0 -3
  42. package/dist/icons/rag/file.svg +0 -3
  43. package/dist/icons/rag/folder.svg +0 -5
  44. package/dist/icons/rag/json.svg +0 -3
  45. package/dist/icons/rag/knowledgebase.svg +0 -3
  46. package/dist/icons/rag/netretrive.svg +0 -3
  47. package/dist/icons/rag/odf.svg +0 -7
  48. package/dist/icons/rag/pdf.svg +0 -3
  49. package/dist/icons/rag/pic.svg +0 -3
  50. package/dist/icons/rag/ppt.svg +0 -3
  51. package/dist/icons/rag/think.svg +0 -6
  52. package/dist/icons/rag/txt.svg +0 -3
  53. package/dist/icons/rag/url.svg +0 -3
  54. package/dist/icons/rag/word.svg +0 -3
  55. package/dist/icons/rag/wps.svg +0 -3
  56. package/dist/icons/rag/zip.svg +0 -7
  57. package/dist/index.js +0 -2299
  58. package/dist/lib_enter.d.ts +0 -13
  59. package/dist/main.d.ts +0 -1
  60. package/dist/mock.csv +0 -16
  61. package/dist/mock_/345/211/257/346/234/254.csv +0 -16
  62. package/dist/package.json +0 -30
  63. package/dist/theme/styledTheme.d.ts +0 -101
  64. package/dist/vite.svg +0 -1
  65. package/eslint.config.js +0 -92
  66. package/index.html +0 -13
  67. package/postcss.config.cjs +0 -19
  68. package/public/mock.csv +0 -16
  69. package/public/mock_/345/211/257/346/234/254.csv +0 -16
  70. package/public/vite.svg +0 -1
  71. package/src/Preview.tsx +0 -15
  72. package/src/assets/img/excel.png +0 -0
  73. package/src/assets/img/img.png +0 -0
  74. package/src/assets/img/pdf.png +0 -0
  75. package/src/assets/img/ppt.png +0 -0
  76. package/src/assets/img/txt.png +0 -0
  77. package/src/assets/img/word.png +0 -0
  78. package/src/containers/DashboardContainer.tsx +0 -507
  79. package/src/containers/DockContainer.tsx +0 -186
  80. package/src/containers/style.css +0 -37
  81. package/src/elements/Button.tsx +0 -118
  82. package/src/elements/CustomDock.tsx +0 -287
  83. package/src/elements/DropDownButton.tsx +0 -249
  84. package/src/elements/DropdownMenu.tsx +0 -184
  85. package/src/elements/GoggleNavbar.tsx +0 -184
  86. package/src/elements/Uploader/README.md +0 -249
  87. package/src/elements/Uploader/UploadItem.tsx +0 -298
  88. package/src/elements/Uploader/example.tsx +0 -95
  89. package/src/elements/Uploader/index.tsx +0 -702
  90. package/src/elements/Uploader/styles.tsx +0 -291
  91. package/src/elements/Uploader/types.ts +0 -119
  92. package/src/elements/Uploader/utils.ts +0 -200
  93. package/src/elements/Uploader.tsx +0 -3
  94. package/src/examples/DockContainerExample.tsx +0 -237
  95. package/src/icons/Icon.tsx +0 -82
  96. package/src/icons/index.tsx +0 -92
  97. package/src/icons/lazyIndex.tsx +0 -49
  98. package/src/icons/rag/csv.svg +0 -3
  99. package/src/icons/rag/document.svg +0 -3
  100. package/src/icons/rag/excel.svg +0 -3
  101. package/src/icons/rag/file.svg +0 -3
  102. package/src/icons/rag/folder.svg +0 -5
  103. package/src/icons/rag/json.svg +0 -3
  104. package/src/icons/rag/knowledgebase.svg +0 -3
  105. package/src/icons/rag/netretrive.svg +0 -3
  106. package/src/icons/rag/odf.svg +0 -7
  107. package/src/icons/rag/pdf.svg +0 -3
  108. package/src/icons/rag/pic.svg +0 -3
  109. package/src/icons/rag/ppt.svg +0 -3
  110. package/src/icons/rag/think.svg +0 -6
  111. package/src/icons/rag/txt.svg +0 -3
  112. package/src/icons/rag/url.svg +0 -3
  113. package/src/icons/rag/word.svg +0 -3
  114. package/src/icons/rag/wps.svg +0 -3
  115. package/src/icons/rag/zip.svg +0 -7
  116. package/src/lib_enter.ts +0 -27
  117. package/src/main.tsx +0 -11
  118. package/src/style.css +0 -9
  119. package/src/theme/styledTheme.tsx +0 -253
  120. package/src/type.d.ts +0 -0
  121. package/src/types/images.d.ts +0 -12
  122. package/src/types/svg-modules.d.ts +0 -24
  123. package/src/vite-env.d.ts +0 -11
  124. package/tailwind.config.js +0 -170
  125. package/tsconfig.app.json +0 -29
  126. package/tsconfig.app.tsbuildinfo +0 -11
  127. package/tsconfig.json +0 -13
  128. package/tsconfig.node.json +0 -22
  129. package/tsconfig.node.tsbuildinfo +0 -1
  130. package/vite.config.ts +0 -165
@@ -1,35 +0,0 @@
1
- import { default as React } from 'react';
2
- import { AppTheme } from '../theme/styledTheme';
3
- import { DockItem, ActiveMode } from '../elements/CustomDock';
4
- export interface BreadcrumbItem {
5
- id: string;
6
- label: string;
7
- path?: string;
8
- onClick?: () => void;
9
- }
10
- export interface EventsEmit {
11
- onBreadcrumbClick?: (item: BreadcrumbItem, index: number) => void;
12
- onGoBack?: () => void;
13
- onTitleClick?: () => void;
14
- onDockItemClick?: (item: DockItem, index: number) => void;
15
- onDockActiveChange?: (activeId: string | null, item: DockItem | null) => void;
16
- onDockActiveChangeMultiple?: (activeIds: string[], items: DockItem[]) => void;
17
- [key: string]: any;
18
- }
19
- interface DashboardContainerProps {
20
- children?: React.ReactNode;
21
- goBack?: () => void;
22
- title?: string;
23
- description?: string;
24
- breadcrumbs?: BreadcrumbItem[];
25
- dockItems?: DockItem[];
26
- dockActiveMode?: ActiveMode;
27
- defaultDockActiveId?: string;
28
- defaultDockActiveIds?: string[];
29
- styles?: {
30
- theme?: AppTheme;
31
- };
32
- eventsEmit?: EventsEmit;
33
- }
34
- declare const DashboardContainer: React.FC<DashboardContainerProps>;
35
- export default DashboardContainer;
@@ -1,24 +0,0 @@
1
- import { default as React } from 'react';
2
- import { AppTheme } from '../theme/styledTheme';
3
- import { DockItem, ActiveMode } from '../elements/CustomDock';
4
- export interface FullScreenContainerProps {
5
- children?: React.ReactNode;
6
- backgroundImage?: string;
7
- backgroundColor?: string;
8
- header?: React.ReactNode;
9
- dockItems?: DockItem[];
10
- dockActiveMode?: ActiveMode;
11
- defaultDockActiveId?: string;
12
- defaultDockActiveIds?: string[];
13
- styles?: {
14
- theme?: AppTheme;
15
- };
16
- eventsEmit?: {
17
- onDockItemClick?: (item: DockItem, index: number) => void;
18
- onDockActiveChange?: (activeId: string | null, item: DockItem | null) => void;
19
- onDockActiveChangeMultiple?: (activeIds: string[], items: DockItem[]) => void;
20
- [key: string]: any;
21
- };
22
- }
23
- declare const DockContainer: React.FC<FullScreenContainerProps>;
24
- export default DockContainer;
@@ -1,17 +0,0 @@
1
- import { default as React } from 'react';
2
- import { Styles } from '../theme/styledTheme';
3
- export type ButtonType = 'primary' | 'default' | 'error' | 'text';
4
- export interface ButtonProps {
5
- mode?: ButtonType;
6
- label?: string;
7
- styles?: Styles;
8
- icon?: React.ReactNode;
9
- disabled?: boolean;
10
- loading?: boolean;
11
- onClick?: () => void;
12
- style?: React.CSSProperties;
13
- className?: string;
14
- children?: React.ReactNode;
15
- }
16
- declare const Button: React.FC<ButtonProps>;
17
- export default Button;
@@ -1,25 +0,0 @@
1
- import { default as React } from 'react';
2
- export interface DockItem {
3
- id: string;
4
- label: string;
5
- icon: string;
6
- onClick?: () => void;
7
- isActive?: boolean;
8
- }
9
- export type ActiveMode = 'single' | 'multiple';
10
- export interface CustomDockProps {
11
- items: DockItem[];
12
- itemWidth?: number;
13
- itemHeight?: number;
14
- magnification?: number;
15
- itemGap?: number;
16
- activeMode?: ActiveMode;
17
- defaultActiveId?: string;
18
- defaultActiveIds?: string[];
19
- onItemClick?: (item: DockItem, index: number) => void;
20
- onActiveChange?: (activeId: string | null, item: DockItem | null) => void;
21
- onActiveChangeMultiple?: (activeIds: string[], items: DockItem[]) => void;
22
- className?: string;
23
- }
24
- declare const CustomDock: React.FC<CustomDockProps>;
25
- export default CustomDock;
@@ -1,24 +0,0 @@
1
- import { default as React } from 'react';
2
- import { Styles } from '../theme/styledTheme';
3
- export interface DropDownButtonAction {
4
- key: string;
5
- label?: string;
6
- component?: React.ReactNode;
7
- type?: 'divider' | 'action';
8
- icon?: React.ReactNode;
9
- onClick?: () => void;
10
- }
11
- export interface DropDownButtonProps {
12
- mode?: 'primary' | 'default' | 'error' | 'text';
13
- label?: string;
14
- actions: DropDownButtonAction[];
15
- styles?: Styles;
16
- icon?: React.ReactNode;
17
- disabled?: boolean;
18
- style?: React.CSSProperties;
19
- className?: string;
20
- children?: React.ReactNode;
21
- eventEmit?: (eventName: string, data?: any, innerFn?: any) => void;
22
- }
23
- declare const DropDownButton: React.FC<DropDownButtonProps>;
24
- export default DropDownButton;
@@ -1,17 +0,0 @@
1
- import { Styles } from '../theme/styledTheme';
2
- import * as React from 'react';
3
- export interface DropdownMenuAction {
4
- key: string;
5
- label?: string;
6
- type?: 'divider' | 'action';
7
- icon?: React.ReactNode;
8
- onClick?: () => void;
9
- }
10
- interface DropdownMenuProps {
11
- actions: DropdownMenuAction[];
12
- onAction: (key: string) => void;
13
- direction?: 'top' | 'bottom';
14
- styles?: Styles;
15
- }
16
- declare const DropdownMenu: React.FC<DropdownMenuProps>;
17
- export default DropdownMenu;
@@ -1,31 +0,0 @@
1
- import { default as React } from 'react';
2
- import { Styles } from '../theme/styledTheme';
3
- export interface GoggleNavItem {
4
- key: string | number;
5
- name: string;
6
- disabled?: boolean;
7
- icon?: string | React.ReactNode;
8
- activeIcon?: string | React.ReactNode;
9
- path?: string;
10
- badge?: number;
11
- }
12
- export interface GoggleNavbarProps {
13
- items: GoggleNavItem[];
14
- /** 当前激活路径,控制激活态渲染 */
15
- activePath?: string;
16
- /** 初始展开状态(非受控) */
17
- defaultOpen?: boolean;
18
- /** 受控展开状态 */
19
- open?: boolean;
20
- /** 展开状态变化回调(用于受控) */
21
- onOpenChange?: (open: boolean) => void;
22
- /** 点击项回调 */
23
- onItemClick?: (item: GoggleNavItem) => void;
24
- /** 顶部 Logo 图,可以是图片地址或 ReactNode */
25
- logo?: string | React.ReactNode;
26
- className?: string;
27
- style?: React.CSSProperties;
28
- styles?: Styles;
29
- }
30
- declare const GoggleNavbar: React.FC<GoggleNavbarProps>;
31
- export default GoggleNavbar;
@@ -1,35 +0,0 @@
1
- import { default as React } from 'react';
2
- import { UploadItem as UploadItemType } from './types';
3
- import { AppTheme } from '../../theme/styledTheme';
4
- interface UploadItemProps {
5
- item: UploadItemType;
6
- index: number;
7
- theme: AppTheme;
8
- itemForm: any[];
9
- onRemove: (id: string) => void;
10
- onToggleExpand: (id: string) => void;
11
- onFormDataChange: (id: string, formData: Record<string, any>) => void;
12
- icons?: {
13
- itemStatus?: {
14
- pending?: React.ReactNode;
15
- uploading?: React.ReactNode;
16
- success?: React.ReactNode;
17
- error?: React.ReactNode;
18
- };
19
- fileType?: {
20
- default?: React.ReactNode;
21
- image?: React.ReactNode;
22
- document?: React.ReactNode;
23
- spreadsheet?: React.ReactNode;
24
- archive?: React.ReactNode;
25
- video?: React.ReactNode;
26
- audio?: React.ReactNode;
27
- };
28
- };
29
- }
30
- /**
31
- * 独立的上传项组件
32
- * 每个上传项都有独立的表单数据管理,展开/收起时保持数据状态
33
- */
34
- declare const UploadItem: React.FC<UploadItemProps>;
35
- export default UploadItem;
@@ -1,7 +0,0 @@
1
- import { default as React } from 'react';
2
- /**
3
- * Uploader组件使用示例
4
- * 展示如何配置独立表单数据管理
5
- */
6
- declare const UploaderExample: React.FC;
7
- export default UploaderExample;
@@ -1,9 +0,0 @@
1
- import { default as React } from 'react';
2
- import { UploaderProps } from './types';
3
- /**
4
- * 文件上传器组件
5
- * 支持拖拽上传、多文件上传、独立表单数据管理
6
- * 每个上传项都有独立的表单,上传完成后自动填充文件名
7
- */
8
- declare const Uploader: React.FC<UploaderProps>;
9
- export default Uploader;
@@ -1,65 +0,0 @@
1
- import { AppTheme } from '../../theme/styledTheme';
2
- import { UploadStatus } from './types';
3
- export declare const UploaderContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
4
- $theme: AppTheme;
5
- $isDragOver: boolean;
6
- }>> & string;
7
- export declare const UploadIcon: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
8
- $theme: AppTheme;
9
- }>> & string;
10
- export declare const UploadText: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
11
- $theme: AppTheme;
12
- }>> & string;
13
- export declare const UploadHint: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
14
- $theme: AppTheme;
15
- }>> & string;
16
- export declare const FileInput: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, never>> & string;
17
- export declare const UploadList: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
18
- $theme: AppTheme;
19
- }>> & string;
20
- export declare const UploadItem: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('styled-components').FastOmit<import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
21
- ref?: ((instance: HTMLDivElement | null) => void | import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import('react').RefObject<HTMLDivElement> | null | undefined;
22
- }>, never>, {
23
- $theme: AppTheme;
24
- $status: UploadStatus;
25
- $hasForm?: boolean;
26
- }>> & string;
27
- export declare const FileIcon: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
28
- $theme: AppTheme;
29
- }>> & string;
30
- export declare const FileInfo: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
31
- export declare const FileName: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
32
- $theme: AppTheme;
33
- }>> & string;
34
- export declare const FileSize: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
35
- $theme: AppTheme;
36
- }>> & string;
37
- export declare const ProgressBar: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
38
- $theme: AppTheme;
39
- $progress: number;
40
- }>> & string;
41
- export declare const StatusIcon: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
42
- $theme: AppTheme;
43
- $status: UploadStatus;
44
- }>> & string;
45
- export declare const RemoveButton: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
46
- $theme: AppTheme;
47
- }>> & string;
48
- export declare const AddButton: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
49
- $theme: AppTheme;
50
- }>> & string;
51
- export declare const ExpandButton: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
52
- $theme: AppTheme;
53
- }>> & string;
54
- export declare const FormContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
55
- $theme: AppTheme;
56
- $hasError?: boolean;
57
- }>> & string;
58
- export declare const MetadataInput: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, {
59
- $theme: AppTheme;
60
- }>> & string;
61
- export declare const UploadItemContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
62
- $theme: AppTheme;
63
- $status: UploadStatus;
64
- $hasForm: boolean;
65
- }>> & string;
@@ -1,87 +0,0 @@
1
- import { Styles } from '../../theme/styledTheme';
2
- export type UploadStatus = 'pending' | 'uploading' | 'success' | 'error' | 'cancelled';
3
- export interface UploadItem {
4
- id: string;
5
- file: File;
6
- name: string;
7
- size: number;
8
- type: string;
9
- status: UploadStatus;
10
- progress: number;
11
- error?: string;
12
- uploadApiRes?: any;
13
- headers?: Record<string, any>;
14
- metadata?: Record<string, any>;
15
- formData?: Record<string, any>;
16
- isExpanded?: boolean;
17
- }
18
- export type UploaderEventName = 'uploader:start' | 'uploader:progress' | 'uploader:success' | 'uploader:error' | 'uploader:complete' | 'uploader:formDataChange' | 'uploader:toggleExpand' | 'uploader:remove' | 'uploader:dataChange' | 'uploader:clear' | 'uploader:errorSet' | 'uploader:errorCleared';
19
- export interface UploaderMethods {
20
- getUploadItems: () => UploadItem[];
21
- getUploadItemsData: (options?: {
22
- includeStatus?: UploadStatus[];
23
- excludeStatus?: UploadStatus[];
24
- }) => Array<{
25
- id: string;
26
- name: string;
27
- status: UploadStatus;
28
- error?: string;
29
- uploadApiRes: any;
30
- formData: Record<string, any>;
31
- file: File;
32
- size: number;
33
- type: string;
34
- }>;
35
- validateFormData: () => Promise<boolean>;
36
- clearUploadItems: () => void;
37
- setItemError: (itemId: string, error: string) => void;
38
- clearItemError: (itemId: string) => void;
39
- }
40
- export interface UploaderButton {
41
- label: string;
42
- mode?: 'primary' | 'default' | 'error' | 'text';
43
- icon?: React.ReactNode;
44
- disabled?: boolean;
45
- onClick: () => void;
46
- }
47
- export interface UploaderProps {
48
- multiple?: boolean;
49
- accept?: string;
50
- maxSize?: number;
51
- maxFiles?: number;
52
- autoUpload?: boolean;
53
- url?: string;
54
- headers?: Record<string, string>;
55
- queryParams?: Record<string, string>;
56
- itemForm?: any[];
57
- styles?: Styles;
58
- buttons?: UploaderButton[];
59
- placeholder?: React.ReactNode;
60
- listName?: string;
61
- errorMessages?: {
62
- noUrl?: string;
63
- uploadFailed?: string;
64
- fileTooLarge?: string;
65
- invalidFileType?: string;
66
- };
67
- eventsEmit?: (eventName: UploaderEventName, data: any, innerFn?: () => void) => void;
68
- onRef?: (methods: UploaderMethods) => void;
69
- icons?: {
70
- dragUpload?: React.ReactNode;
71
- itemStatus?: {
72
- pending?: React.ReactNode;
73
- uploading?: React.ReactNode;
74
- success?: React.ReactNode;
75
- error?: React.ReactNode;
76
- };
77
- fileType?: {
78
- default?: React.ReactNode;
79
- image?: React.ReactNode;
80
- document?: React.ReactNode;
81
- spreadsheet?: React.ReactNode;
82
- archive?: React.ReactNode;
83
- video?: React.ReactNode;
84
- audio?: React.ReactNode;
85
- };
86
- };
87
- }
@@ -1,31 +0,0 @@
1
- import { UploadItem } from './types';
2
- /**
3
- * 格式化文件大小显示
4
- * @param bytes - 文件字节数
5
- * @returns 格式化后的文件大小字符串
6
- */
7
- export declare const formatFileSize: (bytes: number) => string;
8
- /**
9
- * 生成唯一ID
10
- * @returns 唯一ID字符串
11
- */
12
- export declare const generateId: () => string;
13
- /**
14
- * 根据表单配置自动填充文件信息到表单数据中
15
- * @param item - 上传项
16
- * @param itemForm - 表单配置
17
- * @returns 填充后的表单数据
18
- */
19
- export declare const autoFillFormData: (item: UploadItem, itemForm: any[]) => Record<string, any>;
20
- /**
21
- * 标准文件上传函数
22
- * 使用 XMLHttpRequest 实现文件上传,支持进度回调和自定义请求头
23
- * 支持 FormData 和 JSON 两种格式
24
- * @param file - 要上传的文件
25
- * @param uploadUrl - 上传接口地址
26
- * @param headers - 自定义请求头
27
- * @param queryParams - 查询参数
28
- * @param onProgress - 上传进度回调函数
29
- * @returns Promise<string> - 返回上传成功后的文件URL或响应数据
30
- */
31
- export declare const uploadFile: (file: File, uploadUrl: string, headers?: Record<string, string>, queryParams?: Record<string, string>, onProgress?: (progress: number) => void) => Promise<string>;
@@ -1,2 +0,0 @@
1
- export { default } from './Uploader/index';
2
- export * from './Uploader/types';
@@ -1,3 +0,0 @@
1
- import { default as React } from 'react';
2
- declare const FullScreenContainerExample: React.FC;
3
- export default FullScreenContainerExample;
@@ -1,7 +0,0 @@
1
- import { default as React } from 'react';
2
- type IconProps = React.SVGProps<SVGSVGElement> & {
3
- type: string;
4
- size?: number | string;
5
- };
6
- declare const Icon: React.FC<IconProps>;
7
- export default Icon;
@@ -1,82 +0,0 @@
1
- import React from 'react';
2
- import Icons from './lazyIndex';
3
- // 提供不依赖 SVGR 的兜底:以 url 形式导入 svg 并用 <img /> 渲染
4
- // 注意:在构建环境下,Vite 会将以下 glob 展开为静态资源 url
5
- // 这样消费方无需配置 svgr 也能显示图标
6
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
7
- // @ts-ignore
8
- const svgUrlModules: Record<string, string> = import.meta.glob('./**/*.svg', { eager: true, query: '?url', import: 'default' });
9
-
10
- type NestedRecord<T> = { [key: string]: T | NestedRecord<T> };
11
-
12
- function setNested<T>(obj: NestedRecord<T>, pathParts: string[], value: T) {
13
- let current: NestedRecord<T> = obj;
14
- for (let i = 0; i < pathParts.length - 1; i += 1) {
15
- const part = pathParts[i];
16
- if (!current[part] || typeof current[part] !== 'object') {
17
- current[part] = {} as NestedRecord<T>;
18
- }
19
- current = current[part] as NestedRecord<T>;
20
- }
21
- current[pathParts[pathParts.length - 1]] = value;
22
- }
23
-
24
- function pathToKeys(filePath: string) {
25
- const noPrefix = filePath.replace(/^\.\//, '');
26
- const withoutQuery = noPrefix.split('?')[0];
27
- const noExt = withoutQuery.replace(/\.svg$/i, '');
28
- return noExt.split('/');
29
- }
30
-
31
- const IconUrlMap: NestedRecord<string> = {};
32
- Object.entries(svgUrlModules).forEach(([file, url]) => {
33
- const keys = pathToKeys(file);
34
- setNested(IconUrlMap, keys, url as unknown as string);
35
- });
36
-
37
- type IconProps = React.SVGProps<SVGSVGElement> & {
38
- type: string; // e.g., "rag/pdf"
39
- size?: number | string; // apply to width/height simultaneously
40
- };
41
-
42
- function resolveIcon(path: string): React.ComponentType<any> | undefined {
43
- const parts = path.split('/').filter(Boolean);
44
- let cur: any = Icons as any;
45
- for (const p of parts) {
46
- if (!cur) return undefined;
47
- cur = cur[p];
48
- }
49
- return typeof cur === 'function' ? cur : undefined;
50
- }
51
-
52
- function resolveIconUrl(path: string): string | undefined {
53
- const parts = path.split('/').filter(Boolean);
54
- let cur: any = IconUrlMap as any;
55
- for (const p of parts) {
56
- if (!cur) return undefined;
57
- cur = cur[p];
58
- }
59
- return typeof cur === 'string' ? cur : undefined;
60
- }
61
-
62
- const Icon: React.FC<IconProps> = ({ type, size, ...rest }) => {
63
- const Comp = resolveIcon(type);
64
- const wh = typeof size !== 'undefined' ? { width: size as any, height: size as any } : {};
65
-
66
- if (Comp) {
67
- return <Comp {...wh} {...rest} />;
68
- }
69
-
70
- const url = resolveIconUrl(type);
71
- if (url) {
72
- // 使用 <img /> 兜底渲染,确保消费侧不依赖 svgr
73
- // @ts-expect-error img props vs svg props 取交集
74
- return <img src={url} alt="" {...wh} {...rest} />;
75
- }
76
-
77
- return null;
78
- };
79
-
80
- export default Icon;
81
-
82
-
@@ -1,13 +0,0 @@
1
- import { default as React } from 'react';
2
- type IconComponent = React.MemoExoticComponent<React.ComponentType<React.SVGProps<SVGSVGElement>>> & {
3
- displayName?: string;
4
- };
5
- type ImageComponent = React.MemoExoticComponent<React.ComponentType<React.ImgHTMLAttributes<HTMLImageElement>>> & {
6
- displayName?: string;
7
- };
8
- type NestedRecord<T> = {
9
- [key: string]: T | NestedRecord<T>;
10
- };
11
- declare const Icons: NestedRecord<IconComponent | ImageComponent>;
12
- export { Icons };
13
- export default Icons;
@@ -1,92 +0,0 @@
1
- import React, { memo } from 'react';
2
-
3
- // 通过 Vite 的 import.meta.glob 动态导入 SVG 为 React 组件(依赖 vite-plugin-svgr)
4
- // 优先使用查询参数保证直接得到 React 组件
5
- const svgModulesReact = import.meta.glob('./**/*.svg?react', { eager: true });
6
- const svgModulesComponent = import.meta.glob('./**/*.svg?component', { eager: true });
7
- // 兜底:无查询时部分配置会返回 data URL,将在处理时被跳过
8
- const svgModulesRaw = import.meta.glob('./**/*.svg', { eager: true });
9
-
10
- // 可选:如果未来需要支持 png 等位图作为 <img /> 包装组件,可在此扩展
11
- // Vite 6 中 as 已弃用,使用 query: '?url' + import: 'default'
12
- const pngModules = import.meta.glob('./**/*.{png,PNG}', { eager: true, query: '?url', import: 'default' });
13
-
14
- type IconComponent = React.MemoExoticComponent<React.ComponentType<React.SVGProps<SVGSVGElement>>> & {
15
- displayName?: string;
16
- };
17
-
18
- type ImageComponent = React.MemoExoticComponent<React.ComponentType<React.ImgHTMLAttributes<HTMLImageElement>>> & {
19
- displayName?: string;
20
- };
21
-
22
- type NestedRecord<T> = {
23
- [key: string]: T | NestedRecord<T>;
24
- };
25
-
26
- function setNested<T>(obj: NestedRecord<T>, pathParts: string[], value: T) {
27
- let current: NestedRecord<T> = obj;
28
- for (let i = 0; i < pathParts.length - 1; i += 1) {
29
- const part = pathParts[i];
30
- if (!current[part] || typeof current[part] !== 'object') {
31
- current[part] = {} as NestedRecord<T>;
32
- }
33
- current = current[part] as NestedRecord<T>;
34
- }
35
- current[pathParts[pathParts.length - 1]] = value;
36
- }
37
-
38
- // 将文件路径转成对象路径,如 ./rag/csv.svg -> ["rag","csv"]
39
- function pathToKeys(filePath: string, ext: string) {
40
- const noPrefix = filePath.replace(/^\.\//, '');
41
- // 去掉查询参数(例如 ?react 或 ?component)
42
- const withoutQuery = noPrefix.split('?')[0];
43
- // 去掉扩展名 .svg 或 .png 等
44
- const noExt = withoutQuery.replace(new RegExp(`\\.${ext}$`, 'i'), '');
45
- return noExt.split('/');
46
- }
47
-
48
- const Icons: NestedRecord<IconComponent | ImageComponent> = {};
49
-
50
- // 处理 SVG -> React 组件
51
- function handleSvgModules(mods: Record<string, unknown>) {
52
- Object.entries(mods).forEach(([file, mod]) => {
53
- // 兼容两种导出:
54
- // 1) vite-plugin-svgr 的命名导出 ReactComponent
55
- // 2) 配置 exportAsDefault: true 时的默认导出为组件
56
- let Component: React.ComponentType<React.SVGProps<SVGSVGElement>> | undefined;
57
- const possible = mod as any;
58
- if (possible && typeof possible.ReactComponent === 'function') {
59
- Component = possible.ReactComponent as React.ComponentType<React.SVGProps<SVGSVGElement>>;
60
- } else if (possible && typeof possible.default === 'function') {
61
- Component = possible.default as React.ComponentType<React.SVGProps<SVGSVGElement>>;
62
- } else {
63
- // 默认导出为字符串(data url)时跳过,避免运行时错误
64
- return;
65
- }
66
-
67
- const Memo = memo(Component) as IconComponent;
68
- const keys = pathToKeys(file, 'svg');
69
- Memo.displayName = `Icon(${keys.join('/')})`;
70
- setNested(Icons, keys, Memo);
71
- });
72
- }
73
-
74
- handleSvgModules(svgModulesReact);
75
- handleSvgModules(svgModulesComponent);
76
- handleSvgModules(svgModulesRaw);
77
-
78
- // 处理 PNG -> 以 <img /> 封装的组件(仅为兼容,优先推荐 SVG)
79
- Object.entries(pngModules).forEach(([file, url]) => {
80
- const ImgComp: React.FC<React.ImgHTMLAttributes<HTMLImageElement>> = (props) => (
81
- <img src={url as unknown as string} alt="" {...props} />
82
- );
83
- const Memo = memo(ImgComp) as ImageComponent;
84
- const keys = pathToKeys(file, 'png');
85
- Memo.displayName = `IconImg(${keys.join('/')})`;
86
- setNested(Icons, keys, Memo);
87
- });
88
-
89
- export { Icons };
90
- export default Icons;
91
-
92
-
@@ -1,7 +0,0 @@
1
- import { default as React } from 'react';
2
- type NestedRecord<T> = {
3
- [key: string]: T | NestedRecord<T>;
4
- };
5
- declare const Icons: NestedRecord<React.MemoExoticComponent<React.ComponentType<any>>>;
6
- export { Icons };
7
- export default Icons;