@zjlab-fe/data-hub-ui 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types/components/FileUploader/FileUploadModal.d.ts +6 -13
- package/dist/types/components/FileUploader/FileUploader.d.ts +2 -9
- package/dist/types/components/FileUploader/FileUploaderImpl/FileUploader.d.ts +10 -0
- package/dist/types/components/FileUploader/FileUploaderImpl/FileUploaderContextProvider.d.ts +14 -0
- package/dist/types/components/FileUploader/FileUploaderImpl/FileUploaderFileReceiver.d.ts +11 -0
- package/dist/types/components/FileUploader/FileUploaderImpl/FileUploaderFileReceiverContainer.d.ts +7 -0
- package/dist/types/components/FileUploader/FileUploaderImpl/FileUploaderFileReceiverDesc.d.ts +4 -0
- package/dist/types/components/FileUploader/FileUploaderImpl/FileUploaderList.d.ts +1 -0
- package/dist/types/components/FileUploader/FileUploaderImpl/FileUploaderListItem.d.ts +26 -0
- package/dist/types/components/FileUploader/FileUploaderImpl/FileUploaderListItemFail.d.ts +5 -0
- package/dist/types/components/FileUploader/FileUploaderImpl/FileUploaderListItemPaused.d.ts +5 -0
- package/dist/types/components/FileUploader/FileUploaderImpl/FileUploaderListItemUploading.d.ts +2 -0
- package/dist/types/components/FileUploader/FileUploaderImpl/FileUploaderlListItemFinished.d.ts +5 -0
- package/dist/types/components/FileUploader/Locale/translations.d.ts +4 -0
- package/dist/types/components/FileUploader/Locale/useTranslate.d.ts +1 -0
- package/dist/types/components/FileUploader/UploadStoreProvider/UploadStoreProvider.d.ts +15 -0
- package/dist/types/components/FileUploader/UploadStoreProvider/uploadStoreReducer.d.ts +4 -0
- package/dist/types/components/FileUploader/UploadStoreProvider/useOnFileAllUploaded.d.ts +2 -0
- package/dist/types/components/FileUploader/UploadStoreProvider/useSaveUnfinishedUploads.d.ts +10 -0
- package/dist/types/components/FileUploader/UploadStoreProvider/useSetupMergingEvent.d.ts +2 -0
- package/dist/types/components/FileUploader/hooks/useCurrentFile.d.ts +2 -5
- package/dist/types/components/FileUploader/hooks/useCurrentFileOnUploading.d.ts +1 -1
- package/dist/types/components/FileUploader/hooks/useCurrentFileSetupAndBackUp.d.ts +1 -0
- package/dist/types/components/FileUploader/hooks/useFormatFiles.d.ts +4 -1
- package/dist/types/components/FileUploader/hooks/useFormatFilesFindDuplicates.d.ts +1 -0
- package/dist/types/components/FileUploader/hooks/useFormatFilesRemoveDuplicates.d.ts +1 -0
- package/dist/types/components/FileUploader/hooks/useHandleChunkCompletion.d.ts +2 -0
- package/dist/types/components/FileUploader/hooks/useHandleFileDrop.d.ts +1 -0
- package/dist/types/components/FileUploader/hooks/useOnMountedResumeUnfinished.d.ts +1 -0
- package/dist/types/components/FileUploader/hooks/useUploadChunk.d.ts +2 -0
- package/dist/types/components/FileUploader/index.d.ts +1 -1
- package/dist/types/components/FileUploader/types.d.ts +40 -7
- package/dist/types/components/bench-card/demo/index.d.ts +1 -0
- package/dist/types/components/bench-card/index.d.ts +9 -0
- package/dist/types/index.d.ts +1 -0
- package/es/index.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/tailwind.config.js +46 -45
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import './utils/modalConfig.css';
|
|
2
2
|
import { ModalProps } from 'antd';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export default function FileUploadModal({ config: { modal, dragArea }, ...props }: {
|
|
6
|
-
root?: string;
|
|
7
|
-
identifier: string;
|
|
8
|
-
showFinished?: boolean;
|
|
9
|
-
externalUploadContext?: FileInfo[];
|
|
10
|
-
onUploadSuccess?: (file: {
|
|
11
|
-
fileName: string;
|
|
12
|
-
}) => void;
|
|
13
|
-
extra?: React.ReactNode;
|
|
3
|
+
import { FileUploaderProps } from './FileUploaderImpl/FileUploader';
|
|
4
|
+
interface FileUploadModalProps extends Omit<FileUploaderProps, 'dragAreaConfig'> {
|
|
14
5
|
config: {
|
|
15
6
|
modal: ModalProps;
|
|
16
|
-
dragArea?:
|
|
7
|
+
dragArea?: FileUploaderProps['dragAreaConfig'];
|
|
17
8
|
};
|
|
18
|
-
}
|
|
9
|
+
}
|
|
10
|
+
export default function FileUploadModal({ config: { modal, dragArea }, ...props }: FileUploadModalProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export default function FileUploader(props: {
|
|
4
|
-
root?: string;
|
|
5
|
-
identifier: string;
|
|
6
|
-
showFinished?: boolean;
|
|
7
|
-
externalUploadContext?: FileInfo[];
|
|
8
|
-
onUploadSuccess?: (file: UploadableFile) => void;
|
|
9
|
-
} & UploadManager & FileUploaderProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { FileUploaderProps } from './FileUploaderImpl/FileUploader';
|
|
2
|
+
export default function FileUploader(props: FileUploaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FileReceiverProps } from './FileUploaderFileReceiver';
|
|
3
|
+
import { FileUploaderContextProviderProps } from './FileUploaderContextProvider';
|
|
4
|
+
interface FileUploaderImplProps {
|
|
5
|
+
extra?: React.ReactNode;
|
|
6
|
+
dragAreaConfig?: Omit<FileReceiverProps, 'onFileReceived'>;
|
|
7
|
+
}
|
|
8
|
+
export type FileUploaderProps = Omit<FileUploaderContextProviderProps, 'children'> & FileUploaderImplProps;
|
|
9
|
+
export default function FileUploader({ extra, dragAreaConfig, ...props }: FileUploaderProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FileInfo, UploadableFile, UploadManager } from '../types';
|
|
2
|
+
export declare const RootContext: import("react").Context<string | undefined>;
|
|
3
|
+
export declare const IdentifierContext: import("react").Context<string>;
|
|
4
|
+
export declare const ShowFinishedContext: import("react").Context<boolean | undefined>;
|
|
5
|
+
export declare const ExternalUploadContextContext: import("react").Context<FileInfo[] | undefined>;
|
|
6
|
+
export interface FileUploaderContextProviderProps extends UploadManager {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
root?: string;
|
|
9
|
+
identifier: string;
|
|
10
|
+
showFinished?: boolean;
|
|
11
|
+
externalUploadContext?: FileInfo[];
|
|
12
|
+
onUploadSuccess?: (file: UploadableFile) => void;
|
|
13
|
+
}
|
|
14
|
+
export default function FileUploaderContextProvider({ children, root, identifier, showFinished, externalUploadContext, onUploadSuccess, getUploadUrls, onCancelUpload, onOnePartDone, onAllPartDone, onDeleteFile, }: FileUploaderContextProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import './FileUploaderFileReceiver.css';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export interface FileReceiverProps {
|
|
4
|
+
accept?: string;
|
|
5
|
+
directory?: boolean;
|
|
6
|
+
dragAreaDescription?: ReactNode;
|
|
7
|
+
maxSizePerFile?: number;
|
|
8
|
+
className?: string;
|
|
9
|
+
onFileReceived: (_files: File[]) => void;
|
|
10
|
+
}
|
|
11
|
+
export default function FileUploaderFileReceiver({ accept, className, directory, dragAreaDescription, maxSizePerFile, onFileReceived, }: FileReceiverProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/types/components/FileUploader/FileUploaderImpl/FileUploaderFileReceiverContainer.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export default function FileUploaderFileReceiverContainer({ className, description, onClick, handleDrop, }: {
|
|
3
|
+
className?: string;
|
|
4
|
+
description: ReactNode;
|
|
5
|
+
onClick: () => void;
|
|
6
|
+
handleDrop: (e: React.DragEvent<HTMLDivElement>) => Promise<void>;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function FileUploadModalList(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ProgressProps } from 'antd';
|
|
2
|
+
import { UploadableFile } from '../types';
|
|
3
|
+
export declare const progressStyleProps: ProgressProps;
|
|
4
|
+
declare const _default: import("react").NamedExoticComponent<{
|
|
5
|
+
file: UploadableFile;
|
|
6
|
+
}>;
|
|
7
|
+
export default _default;
|
|
8
|
+
export declare function ListItemOutline({ children, className }: {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function ListItemName({ fileName, className }: {
|
|
13
|
+
fileName: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function ListItemStatus({ className, fileStatus, percentage, strokeColor, }: {
|
|
17
|
+
className?: string;
|
|
18
|
+
fileStatus: string;
|
|
19
|
+
percentage: number;
|
|
20
|
+
strokeColor?: string;
|
|
21
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare function ListItemActions({ onDelete, extraActions, className, }: {
|
|
23
|
+
onDelete: () => void;
|
|
24
|
+
extraActions?: React.ReactNode;
|
|
25
|
+
className?: string;
|
|
26
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useTranslate(): (key: string) => string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Dispath, OnUploadSuccesMap, UploadManagerMap, UploadStore, UploadStoreDispatch } from '../types';
|
|
3
|
+
import { Locale } from '../Locale/translations';
|
|
4
|
+
export declare const FileUploaderLocaleContext: React.Context<Locale>;
|
|
5
|
+
export declare const AllUploaderManagersContext: React.Context<UploadManagerMap>;
|
|
6
|
+
export declare const AllUploaderManagersDispatchContext: React.Context<Dispath<UploadManagerMap>>;
|
|
7
|
+
export declare const AllOnUploadSuccessesContext: React.Context<OnUploadSuccesMap>;
|
|
8
|
+
export declare const AllOnUploadSuccessesDispatchContext: React.Context<Dispath<OnUploadSuccesMap>>;
|
|
9
|
+
export declare const TEMP_STORE: {};
|
|
10
|
+
export declare const UploadStoreContext: React.Context<UploadStore>;
|
|
11
|
+
export declare const UploadStoreDispatchContext: React.Context<UploadStoreDispatch>;
|
|
12
|
+
export default function UploadStoreProvider({ locale, children, }: {
|
|
13
|
+
locale?: 'zh' | 'en';
|
|
14
|
+
children: React.ReactElement;
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UploadableFile, UploadStore } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* 未完成任务信息存储在localStorage而不是indexdb中,需要分别处理
|
|
4
|
+
* 因为之前的测试中发现,indexdb的存储方式在某些浏览器中会丢失数据
|
|
5
|
+
* 所以需要将未完成任务信息存储在localStorage中
|
|
6
|
+
*
|
|
7
|
+
* TODO: 将未完成任务信息存储在indexdb中
|
|
8
|
+
*/
|
|
9
|
+
export declare function useSaveUnfinishedUploads(uploadStore: UploadStore): void;
|
|
10
|
+
export declare function formatUnfinishedUploads(uploads: UploadableFile[]): string;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { UploadableFile, UploadManager, UploadStore, UploadStoreAction } from '../types';
|
|
2
|
+
export declare function useSetupMergingEvent(uploadStore: UploadStore, allUploaderManagers: Record<string, UploadManager>, allOnUploadSuccesses: Record<string, ((file: UploadableFile) => void) | undefined>, setUploadStore: React.Dispatch<UploadStoreAction>): void;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { UploadableFile
|
|
1
|
+
import { UploadableFile } from '../types';
|
|
2
2
|
export declare const currentFileAtom: import("jotai").PrimitiveAtom<UploadableFile | null> & {
|
|
3
3
|
init: UploadableFile | null;
|
|
4
4
|
};
|
|
5
5
|
export declare const currentFileNameAtom: import("jotai").Atom<string | undefined>;
|
|
6
|
-
export declare const currentFileStatusAtom: import("jotai").Atom<FILE_UPLOAD_STATUS | undefined>;
|
|
7
6
|
export declare const currentFileExpiryTimeAtom: import("jotai").Atom<string | undefined>;
|
|
8
7
|
export declare const currentFileUploadIdAtom: import("jotai").Atom<string | undefined>;
|
|
9
8
|
export declare const currentFileRawAtom: import("jotai").Atom<File | undefined>;
|
|
10
9
|
export declare const currentFilePercentageAtom: import("jotai").Atom<number | undefined>;
|
|
11
|
-
export declare const currentFileCancelControllersAtom: import("jotai").Atom<
|
|
12
|
-
[key: string]: AbortController;
|
|
13
|
-
} | undefined>;
|
|
10
|
+
export declare const currentFileCancelControllersAtom: import("jotai").Atom<AbortController[] | undefined>;
|
|
14
11
|
export declare function useCurrentFile(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useCurrentFileSetupAndBackUp(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useFindDuplicates(): (files: File[]) => Promise<[boolean, Set<string>]>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useRemoveDuplicates(): (duplicationOfName: Set<string>) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useHandleFileDrop(directory: boolean, acceptList: Set<string>, triggerOnFileReceived: (files: File[]) => void): (e: React.DragEvent<HTMLDivElement>) => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useOnMountedResumeUnfinished(identifier: string): () => Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './index.css';
|
|
2
|
-
import UploadStoreProvider from './UploadStoreProvider';
|
|
2
|
+
import UploadStoreProvider from './UploadStoreProvider/UploadStoreProvider';
|
|
3
3
|
import FileUploader from './FileUploader';
|
|
4
4
|
import FileUploadModal from './FileUploadModal';
|
|
5
5
|
export { UploadStoreProvider };
|
|
@@ -6,10 +6,11 @@ export declare const enum FILE_UPLOAD_STATUS {
|
|
|
6
6
|
INIT = 1,
|
|
7
7
|
UPLOADING = 2,
|
|
8
8
|
ALL_UPLOADED = 3,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
MERGING = 4,
|
|
10
|
+
FINISHED = 5,
|
|
11
|
+
FAILED = 6,
|
|
12
|
+
PAUSED = 7,
|
|
13
|
+
CANCELED = 8
|
|
13
14
|
}
|
|
14
15
|
export type UploadableFile = {
|
|
15
16
|
raw?: File;
|
|
@@ -24,9 +25,7 @@ export type UploadableFile = {
|
|
|
24
25
|
uploadUrls: UploadUrl[];
|
|
25
26
|
completeSeq: UploadUrl[];
|
|
26
27
|
fileStatus: FILE_UPLOAD_STATUS;
|
|
27
|
-
cancelControllers:
|
|
28
|
-
[key: string]: AbortController;
|
|
29
|
-
};
|
|
28
|
+
cancelControllers: AbortController[];
|
|
30
29
|
};
|
|
31
30
|
export type FileInfo = {
|
|
32
31
|
fileName: string;
|
|
@@ -57,4 +56,38 @@ export type UploadManager = {
|
|
|
57
56
|
}>;
|
|
58
57
|
onDeleteFile?: (filePath: string) => Promise<boolean>;
|
|
59
58
|
};
|
|
59
|
+
export type UploadManagerMap = Record<string, UploadManager>;
|
|
60
|
+
type OnUploadSucces = ((file: UploadableFile) => void) | undefined;
|
|
61
|
+
export type OnUploadSuccesMap = Record<string, OnUploadSucces>;
|
|
62
|
+
export type Dispath<T> = React.Dispatch<React.SetStateAction<T>>;
|
|
63
|
+
export type UploadStore = {
|
|
64
|
+
[key: string]: UploadableFile[];
|
|
65
|
+
};
|
|
66
|
+
export type UploadStoreAction = {
|
|
67
|
+
type: 'add';
|
|
68
|
+
identifier: string | number;
|
|
69
|
+
} | {
|
|
70
|
+
type: 'edit_file';
|
|
71
|
+
identifier: string | number;
|
|
72
|
+
file: UploadableFile;
|
|
73
|
+
} | {
|
|
74
|
+
type: 'edit_files';
|
|
75
|
+
files: Record<string, UploadableFile[]>;
|
|
76
|
+
} | {
|
|
77
|
+
type: 'remove_file';
|
|
78
|
+
identifier: string | number;
|
|
79
|
+
fileName: string;
|
|
80
|
+
} | {
|
|
81
|
+
type: 'add_file';
|
|
82
|
+
identifier: string | number;
|
|
83
|
+
file: UploadableFile;
|
|
84
|
+
} | {
|
|
85
|
+
type: 'clear_finished';
|
|
86
|
+
identifier: string | number;
|
|
87
|
+
} | {
|
|
88
|
+
type: 'add_files';
|
|
89
|
+
identifier: string | number;
|
|
90
|
+
files: UploadableFile[];
|
|
91
|
+
};
|
|
92
|
+
export type UploadStoreDispatch = React.Dispatch<UploadStoreAction>;
|
|
60
93
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function Demo(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface IProps {
|
|
2
|
+
type: 'workflow' | 'component';
|
|
3
|
+
size?: 'small' | 'middle';
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export declare function Tcard(props: IProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function Wcard(props: IProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default function BenchCard(props: IProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -11,4 +11,5 @@ export { default as Copy, copy } from './components/copy';
|
|
|
11
11
|
export type { ICopy } from './components/copy';
|
|
12
12
|
export { default as ConfirmAgain } from './components/confirm-again';
|
|
13
13
|
export { default as FloatingLayer } from './components/floating-layer';
|
|
14
|
+
export { default as BenchCard } from './components/bench-card';
|
|
14
15
|
export type { IFilePreviewProps } from './components/file-preview/interface';
|