@lite-code/aui-react 0.0.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 +76 -0
- package/dist/alert/index.d.ts +14 -0
- package/dist/avatar/index.d.ts +28 -0
- package/dist/badge/index.d.ts +18 -0
- package/dist/breadcrumb/index.d.ts +18 -0
- package/dist/button/index.d.ts +11 -0
- package/dist/card/index.d.ts +25 -0
- package/dist/carousel/index.d.ts +17 -0
- package/dist/cascader/index.d.ts +25 -0
- package/dist/checkbox/index.d.ts +33 -0
- package/dist/collapse/index.d.ts +19 -0
- package/dist/datepicker/index.d.ts +26 -0
- package/dist/descriptions/index.d.ts +25 -0
- package/dist/drawer/index.d.ts +16 -0
- package/dist/dropdown/index.d.ts +29 -0
- package/dist/empty/index.d.ts +11 -0
- package/dist/form/context.d.ts +3 -0
- package/dist/form/index.d.ts +39 -0
- package/dist/form/item.d.ts +87 -0
- package/dist/form/list.d.ts +8 -0
- package/dist/form/store.d.ts +49 -0
- package/dist/form/types.d.ts +47 -0
- package/dist/grid/index.d.ts +35 -0
- package/dist/icon/index.d.ts +9 -0
- package/dist/image-compressor/engine.d.ts +55 -0
- package/dist/image-compressor/index.d.ts +5 -0
- package/dist/image-compressor/types.d.ts +44 -0
- package/dist/image-compressor/use-image-compressor.d.ts +21 -0
- package/dist/index.cjs.js +2 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +93 -0
- package/dist/index.esm.js +2 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/input/index.d.ts +12 -0
- package/dist/input-number/index.d.ts +23 -0
- package/dist/layer/index.d.ts +18 -0
- package/dist/menu/index.d.ts +24 -0
- package/dist/message/index.d.ts +18 -0
- package/dist/modal/index.d.ts +42 -0
- package/dist/pagination/index.d.ts +19 -0
- package/dist/popover/index.d.ts +18 -0
- package/dist/popover/util.d.ts +28 -0
- package/dist/progress/index.d.ts +17 -0
- package/dist/radio/index.d.ts +32 -0
- package/dist/rate/index.d.ts +20 -0
- package/dist/select/index.d.ts +23 -0
- package/dist/slider/index.d.ts +19 -0
- package/dist/space/index.d.ts +11 -0
- package/dist/spin/index.d.ts +12 -0
- package/dist/steps/index.d.ts +25 -0
- package/dist/switch/index.d.ts +18 -0
- package/dist/table/checkbox.d.ts +14 -0
- package/dist/table/empty.d.ts +5 -0
- package/dist/table/index.d.ts +2 -0
- package/dist/table/row-operation-cell.d.ts +9 -0
- package/dist/table/table.d.ts +3 -0
- package/dist/table/toolbar.d.ts +12 -0
- package/dist/table/types.d.ts +84 -0
- package/dist/table/utils.d.ts +19 -0
- package/dist/tabs/index.d.ts +22 -0
- package/dist/textarea/index.d.ts +10 -0
- package/dist/theme/theme-provider.d.ts +21 -0
- package/dist/timepicker/index.d.ts +12 -0
- package/dist/timepicker/scroll-column.d.ts +13 -0
- package/dist/timepicker/types.d.ts +43 -0
- package/dist/timepicker/utils.d.ts +13 -0
- package/dist/tooltip/index.d.ts +19 -0
- package/dist/tree/index.d.ts +29 -0
- package/dist/tree-select/index.d.ts +21 -0
- package/dist/upload/file-item.d.ts +10 -0
- package/dist/upload/index.d.ts +12 -0
- package/dist/upload/types.d.ts +58 -0
- package/dist/upload/use-upload.d.ts +6 -0
- package/dist/upload/utils.d.ts +5 -0
- package/dist/upload-manager/index.d.ts +10 -0
- package/dist/upload-manager/manager-item.d.ts +10 -0
- package/dist/upload-manager/preview-modal.d.ts +10 -0
- package/dist/upload-manager/types.d.ts +80 -0
- package/dist/upload-manager/use-upload-manager.d.ts +19 -0
- package/env.d.ts +2 -0
- package/package.json +47 -0
- package/rollup.config.js +36 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
export type TimePickerSize = "sm" | "md" | "lg";
|
|
3
|
+
export interface TimePickerProps {
|
|
4
|
+
value?: Date | string | null;
|
|
5
|
+
defaultValue?: Date | string | null;
|
|
6
|
+
onChange?: (value: Date | null, timeString: string) => void;
|
|
7
|
+
format?: string;
|
|
8
|
+
use12Hours?: boolean;
|
|
9
|
+
hourStep?: number;
|
|
10
|
+
minuteStep?: number;
|
|
11
|
+
secondStep?: number;
|
|
12
|
+
disabledHours?: () => number[];
|
|
13
|
+
disabledMinutes?: (hour: number) => number[];
|
|
14
|
+
disabledSeconds?: (hour: number, minute: number) => number[];
|
|
15
|
+
clearable?: boolean;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
size?: TimePickerSize;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
style?: React.CSSProperties;
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface TimeRangePickerProps {
|
|
23
|
+
value?: [Date | string | null, Date | string | null];
|
|
24
|
+
defaultValue?: [Date | string | null, Date | string | null];
|
|
25
|
+
onChange?: (value: [Date | null, Date | null], timeStrings: [string, string]) => void;
|
|
26
|
+
format?: string;
|
|
27
|
+
use12Hours?: boolean;
|
|
28
|
+
hourStep?: number;
|
|
29
|
+
minuteStep?: number;
|
|
30
|
+
secondStep?: number;
|
|
31
|
+
clearable?: boolean;
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
size?: TimePickerSize;
|
|
34
|
+
placeholder?: [string, string];
|
|
35
|
+
style?: React.CSSProperties;
|
|
36
|
+
className?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface TimeValue {
|
|
39
|
+
hour: number;
|
|
40
|
+
minute: number;
|
|
41
|
+
second: number;
|
|
42
|
+
ampm?: "AM" | "PM";
|
|
43
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TimeValue } from "./types";
|
|
2
|
+
export declare function parseFormat(fmt: string): {
|
|
3
|
+
showHour: boolean;
|
|
4
|
+
showMinute: boolean;
|
|
5
|
+
showSecond: boolean;
|
|
6
|
+
use12: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function buildStepValues(total: number, step: number, start?: number): number[];
|
|
9
|
+
export declare function parseTimeInput(val: Date | string | null | undefined): TimeValue | null;
|
|
10
|
+
export declare function formatTimeValue(tv: TimeValue, fmt: string): string;
|
|
11
|
+
export declare function timeValueToDate(tv: TimeValue): Date;
|
|
12
|
+
export declare function resolveFormat(fmt: string | undefined, use12Hours: boolean): string;
|
|
13
|
+
export declare function defaultTimeValue(): TimeValue;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./tooltip.css";
|
|
3
|
+
export type TooltipPlacement = "top" | "topLeft" | "topRight" | "bottom" | "bottomLeft" | "bottomRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom";
|
|
4
|
+
export type TooltipTrigger = "hover" | "click" | "focus";
|
|
5
|
+
export interface TooltipProps {
|
|
6
|
+
children: React.ReactElement;
|
|
7
|
+
title?: React.ReactNode;
|
|
8
|
+
placement?: TooltipPlacement;
|
|
9
|
+
trigger?: TooltipTrigger;
|
|
10
|
+
open?: boolean;
|
|
11
|
+
defaultOpen?: boolean;
|
|
12
|
+
onOpenChange?: (open: boolean) => void;
|
|
13
|
+
mouseEnterDelay?: number;
|
|
14
|
+
mouseLeaveDelay?: number;
|
|
15
|
+
color?: string;
|
|
16
|
+
overlayStyle?: React.CSSProperties;
|
|
17
|
+
overlayClassName?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function Tooltip({ children, title, placement, trigger, open: openProp, defaultOpen, onOpenChange, mouseEnterDelay, mouseLeaveDelay, color, overlayStyle, overlayClassName, }: TooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./tree.css";
|
|
3
|
+
export interface TreeNodeData {
|
|
4
|
+
key: string | number;
|
|
5
|
+
label: React.ReactNode;
|
|
6
|
+
children?: TreeNodeData[];
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
disableCheckbox?: boolean;
|
|
9
|
+
icon?: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export interface TreeProps {
|
|
12
|
+
data: TreeNodeData[];
|
|
13
|
+
defaultExpandAll?: boolean;
|
|
14
|
+
expandedKeys?: (string | number)[];
|
|
15
|
+
defaultExpandedKeys?: (string | number)[];
|
|
16
|
+
onExpand?: (keys: (string | number)[]) => void;
|
|
17
|
+
selectable?: boolean;
|
|
18
|
+
selectedKeys?: (string | number)[];
|
|
19
|
+
defaultSelectedKeys?: (string | number)[];
|
|
20
|
+
onSelect?: (keys: (string | number)[]) => void;
|
|
21
|
+
checkable?: boolean;
|
|
22
|
+
checkedKeys?: (string | number)[];
|
|
23
|
+
defaultCheckedKeys?: (string | number)[];
|
|
24
|
+
onCheck?: (keys: (string | number)[]) => void;
|
|
25
|
+
line?: boolean;
|
|
26
|
+
style?: React.CSSProperties;
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare function Tree({ data, defaultExpandAll, expandedKeys, defaultExpandedKeys, onExpand, selectable, selectedKeys, defaultSelectedKeys, onSelect, checkable, checkedKeys, defaultCheckedKeys, onCheck, line, style, className, }: TreeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { TreeNodeData } from "../tree";
|
|
3
|
+
import "./tree-select.css";
|
|
4
|
+
export type TreeSelectValue = string | number | (string | number)[];
|
|
5
|
+
export interface TreeSelectProps {
|
|
6
|
+
data: TreeNodeData[];
|
|
7
|
+
value?: TreeSelectValue;
|
|
8
|
+
onChange?: (value: TreeSelectValue) => void;
|
|
9
|
+
multiple?: boolean;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
size?: "sm" | "md" | "lg";
|
|
13
|
+
clearable?: boolean;
|
|
14
|
+
searchable?: boolean;
|
|
15
|
+
defaultExpandAll?: boolean;
|
|
16
|
+
maxTagCount?: number;
|
|
17
|
+
line?: boolean;
|
|
18
|
+
style?: React.CSSProperties;
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function TreeSelect({ data, value, onChange, multiple, placeholder, disabled, size, clearable, searchable, defaultExpandAll, maxTagCount, line, style, className, }: TreeSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AnyUploadFile, UploadListType } from "./types";
|
|
2
|
+
export interface FileItemProps {
|
|
3
|
+
file: AnyUploadFile;
|
|
4
|
+
listType: UploadListType;
|
|
5
|
+
showPreviewIcon: boolean;
|
|
6
|
+
showRemoveIcon: boolean;
|
|
7
|
+
onRemove: (file: AnyUploadFile) => void;
|
|
8
|
+
onPreview?: (file: AnyUploadFile) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function FileItem(props: FileItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { UploadProps } from "./types";
|
|
2
|
+
import "./upload.css";
|
|
3
|
+
export type { UploadListType, UploadStatus, UploadFile, UploadChangeParam, UploadRequestOption, UploadProps, } from "./types";
|
|
4
|
+
declare function UploadBase<T = unknown>(props: UploadProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function Dragger<T = unknown>(props: Omit<UploadProps<T>, "drag">): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare namespace Dragger {
|
|
7
|
+
var displayName: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const Upload: typeof UploadBase & {
|
|
10
|
+
Dragger: typeof Dragger;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
export type UploadListType = "text" | "picture" | "picture-card";
|
|
3
|
+
export type UploadStatus = "uploading" | "done" | "error" | "removed";
|
|
4
|
+
export interface UploadFile<T = unknown> {
|
|
5
|
+
uid: string;
|
|
6
|
+
name: string;
|
|
7
|
+
size?: number;
|
|
8
|
+
type?: string;
|
|
9
|
+
status?: UploadStatus;
|
|
10
|
+
percent?: number;
|
|
11
|
+
url?: string;
|
|
12
|
+
thumbUrl?: string;
|
|
13
|
+
originFileObj?: File;
|
|
14
|
+
error?: unknown;
|
|
15
|
+
response?: T;
|
|
16
|
+
}
|
|
17
|
+
export interface UploadChangeParam<T = unknown> {
|
|
18
|
+
file: UploadFile<T>;
|
|
19
|
+
fileList: UploadFile<T>[];
|
|
20
|
+
}
|
|
21
|
+
export interface UploadRequestOption<T = unknown> {
|
|
22
|
+
action: string;
|
|
23
|
+
file: File;
|
|
24
|
+
filename?: string;
|
|
25
|
+
headers?: Record<string, string>;
|
|
26
|
+
data?: Record<string, string | Blob>;
|
|
27
|
+
method?: string;
|
|
28
|
+
onProgress?: (event: {
|
|
29
|
+
percent: number;
|
|
30
|
+
}) => void;
|
|
31
|
+
onSuccess?: (body: T, xhr?: XMLHttpRequest) => void;
|
|
32
|
+
onError?: (err: Error, body?: T) => void;
|
|
33
|
+
}
|
|
34
|
+
export interface UploadProps<T = unknown> {
|
|
35
|
+
accept?: string;
|
|
36
|
+
action?: string | ((file: File) => string | Promise<string>);
|
|
37
|
+
beforeUpload?: (file: File, fileList: File[]) => boolean | File | Promise<boolean | File>;
|
|
38
|
+
customRequest?: (options: UploadRequestOption<T>) => void;
|
|
39
|
+
defaultFileList?: UploadFile<T>[];
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
fileList?: UploadFile<T>[];
|
|
42
|
+
listType?: UploadListType;
|
|
43
|
+
maxCount?: number;
|
|
44
|
+
multiple?: boolean;
|
|
45
|
+
name?: string;
|
|
46
|
+
onChange?: (info: UploadChangeParam<T>) => void;
|
|
47
|
+
onRemove?: (file: UploadFile<T>) => boolean | void | Promise<boolean | void>;
|
|
48
|
+
onPreview?: (file: UploadFile<T>) => void;
|
|
49
|
+
showUploadList?: boolean | {
|
|
50
|
+
showPreviewIcon?: boolean;
|
|
51
|
+
showRemoveIcon?: boolean;
|
|
52
|
+
};
|
|
53
|
+
children?: React.ReactNode;
|
|
54
|
+
className?: string;
|
|
55
|
+
style?: React.CSSProperties;
|
|
56
|
+
drag?: boolean;
|
|
57
|
+
}
|
|
58
|
+
export type AnyUploadFile = UploadFile<any>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AnyUploadFile, UploadRequestOption } from "./types";
|
|
2
|
+
export declare function genUid(): string;
|
|
3
|
+
export declare function formatFileSize(size: number): string;
|
|
4
|
+
export declare function isImageType(file: AnyUploadFile): boolean;
|
|
5
|
+
export declare function defaultRequest<T>(options: UploadRequestOption<T>): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { UploadManagerProps } from "./types";
|
|
2
|
+
import "./upload-manager.css";
|
|
3
|
+
export type { UploadManagerFile, UploadManagerProps } from "./types";
|
|
4
|
+
export type { UploadManagerStatus, UploadManagerRequestOption, UploadManagerChangeParam, } from "./types";
|
|
5
|
+
export { useUploadManager } from "./use-upload-manager";
|
|
6
|
+
declare function UploadManagerBase<T = unknown>(props: UploadManagerProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare namespace UploadManagerBase {
|
|
8
|
+
var displayName: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const UploadManager: typeof UploadManagerBase;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { UploadManagerFile } from "./types";
|
|
2
|
+
export interface ManagerItemProps {
|
|
3
|
+
file: UploadManagerFile;
|
|
4
|
+
onRemove: (file: UploadManagerFile) => void;
|
|
5
|
+
onRetry: (uid: string) => void;
|
|
6
|
+
onPreview: (file: UploadManagerFile) => void;
|
|
7
|
+
/** 树形视图中已由目录行展示层级,不再在条目内重复显示相对路径 */
|
|
8
|
+
hideRelativePath?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function ManagerItem({ file, onRemove, onRetry, onPreview, hideRelativePath, }: ManagerItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { UploadManagerFile } from "./types";
|
|
3
|
+
interface PreviewModalProps {
|
|
4
|
+
file: UploadManagerFile | null;
|
|
5
|
+
fileList: UploadManagerFile[];
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
onNavigate: (file: UploadManagerFile) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function PreviewModal({ file, fileList, onClose, onNavigate, }: PreviewModalProps): React.ReactPortal | null;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
export type UploadManagerStatus = "pending" | "uploading" | "done" | "error" | "paused";
|
|
3
|
+
export interface UploadManagerFile<T = unknown> {
|
|
4
|
+
uid: string;
|
|
5
|
+
name: string;
|
|
6
|
+
size: number;
|
|
7
|
+
type: string;
|
|
8
|
+
status: UploadManagerStatus;
|
|
9
|
+
percent: number;
|
|
10
|
+
originFileObj: File;
|
|
11
|
+
/** 图片/视频预览用 ObjectURL */
|
|
12
|
+
thumbUrl?: string;
|
|
13
|
+
/** 上传成功后服务端返回的响应 */
|
|
14
|
+
response?: T;
|
|
15
|
+
/** 上传失败时的错误信息 */
|
|
16
|
+
errorMessage?: string;
|
|
17
|
+
/** 文件添加时间 */
|
|
18
|
+
addedAt: number;
|
|
19
|
+
/** 相对路径(文件夹上传时携带层级,如 folderA/sub/file.txt) */
|
|
20
|
+
relativePath?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface UploadManagerRequestOption<T = unknown> {
|
|
23
|
+
action: string;
|
|
24
|
+
file: File;
|
|
25
|
+
filename?: string;
|
|
26
|
+
headers?: Record<string, string>;
|
|
27
|
+
data?: Record<string, string | Blob>;
|
|
28
|
+
method?: string;
|
|
29
|
+
onProgress?: (event: {
|
|
30
|
+
percent: number;
|
|
31
|
+
}) => void;
|
|
32
|
+
onSuccess?: (body: T, xhr?: XMLHttpRequest) => void;
|
|
33
|
+
onError?: (err: Error, body?: T) => void;
|
|
34
|
+
}
|
|
35
|
+
export interface UploadManagerChangeParam<T = unknown> {
|
|
36
|
+
file: UploadManagerFile<T>;
|
|
37
|
+
fileList: UploadManagerFile<T>[];
|
|
38
|
+
}
|
|
39
|
+
export interface UploadManagerProps<T = unknown> {
|
|
40
|
+
/** 上传目标地址 */
|
|
41
|
+
action?: string | ((file: File) => string | Promise<string>);
|
|
42
|
+
/** 接受的文件类型 */
|
|
43
|
+
accept?: string;
|
|
44
|
+
/** 最大文件数量 */
|
|
45
|
+
maxCount?: number;
|
|
46
|
+
/** 单文件最大尺寸(字节),超过时在客户端拒绝 */
|
|
47
|
+
maxSize?: number;
|
|
48
|
+
/** 允许同时选择多个文件 */
|
|
49
|
+
multiple?: boolean;
|
|
50
|
+
/** 是否自动在选择后立即上传,默认 true */
|
|
51
|
+
autoUpload?: boolean;
|
|
52
|
+
/** 自定义上传请求 */
|
|
53
|
+
customRequest?: (options: UploadManagerRequestOption<T>) => void;
|
|
54
|
+
/** 上传前校验,返回 false 则跳过该文件 */
|
|
55
|
+
beforeUpload?: (file: File, fileList: File[]) => boolean | File | Promise<boolean | File>;
|
|
56
|
+
/** 受控文件列表 */
|
|
57
|
+
fileList?: UploadManagerFile<T>[];
|
|
58
|
+
/** 文件默认列表(非受控) */
|
|
59
|
+
defaultFileList?: UploadManagerFile<T>[];
|
|
60
|
+
/** 文件列表变化回调 */
|
|
61
|
+
onChange?: (info: UploadManagerChangeParam<T>) => void;
|
|
62
|
+
/** 文件移除回调,返回 false 阻止移除 */
|
|
63
|
+
onRemove?: (file: UploadManagerFile<T>) => boolean | void | Promise<boolean | void>;
|
|
64
|
+
/** 自定义预览行为;不传则使用内置预览弹窗 */
|
|
65
|
+
onPreview?: (file: UploadManagerFile<T>) => void;
|
|
66
|
+
/** 上传请求的 FormData 字段名,默认 "file" */
|
|
67
|
+
name?: string;
|
|
68
|
+
/** 额外的请求头 */
|
|
69
|
+
headers?: Record<string, string>;
|
|
70
|
+
/** 额外的 FormData 字段 */
|
|
71
|
+
data?: Record<string, string | Blob>;
|
|
72
|
+
/** 是否禁用 */
|
|
73
|
+
disabled?: boolean;
|
|
74
|
+
/** 自定义类名 */
|
|
75
|
+
className?: string;
|
|
76
|
+
/** 自定义内联样式 */
|
|
77
|
+
style?: React.CSSProperties;
|
|
78
|
+
/** 拖拽上传区域的自定义文案 */
|
|
79
|
+
hint?: React.ReactNode;
|
|
80
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { UploadManagerFile, UploadManagerProps } from "./types";
|
|
2
|
+
export declare function formatFileSize(size: number): string;
|
|
3
|
+
export declare function isImageFile(file: UploadManagerFile): boolean;
|
|
4
|
+
export declare function isVideoFile(file: UploadManagerFile): boolean;
|
|
5
|
+
export declare function useUploadManager<T>(props: UploadManagerProps<T>): {
|
|
6
|
+
fileList: UploadManagerFile<T>[];
|
|
7
|
+
stats: {
|
|
8
|
+
total: number;
|
|
9
|
+
pending: number;
|
|
10
|
+
uploading: number;
|
|
11
|
+
done: number;
|
|
12
|
+
error: number;
|
|
13
|
+
};
|
|
14
|
+
addFiles: (rawFiles: File[]) => Promise<void>;
|
|
15
|
+
startUpload: (uid?: string) => void;
|
|
16
|
+
retryFile: (uid: string) => void;
|
|
17
|
+
removeFile: (file: UploadManagerFile<T>) => Promise<void>;
|
|
18
|
+
clearAll: () => void;
|
|
19
|
+
};
|
package/env.d.ts
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lite-code/aui-react",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "React 基础组件库及文档站点",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.cjs.js",
|
|
7
|
+
"module": "dist/index.esm.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.esm.js",
|
|
12
|
+
"require": "./dist/index.cjs.js"
|
|
13
|
+
},
|
|
14
|
+
"./styles": "./dist/styles.css"
|
|
15
|
+
},
|
|
16
|
+
"author": "yunliang-ding",
|
|
17
|
+
"homepage": "http://111.229.112.107:3002/__/aui-react",
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"react": "^18.3.0",
|
|
20
|
+
"react-dom": "^18.3.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"sucrase": "^3.35.1",
|
|
24
|
+
"@lite-code/vitepress-theme": "0.0.6",
|
|
25
|
+
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
26
|
+
"@rollup/plugin-typescript": "^12.0.0",
|
|
27
|
+
"@types/react": "^18.3.0",
|
|
28
|
+
"@types/react-dom": "^18.3.0",
|
|
29
|
+
"@vitejs/plugin-react": "^4.3.0",
|
|
30
|
+
"rollup": "^4.0.0",
|
|
31
|
+
"rollup-plugin-postcss": "4.0.2",
|
|
32
|
+
"typescript": "^5.5.0",
|
|
33
|
+
"vitepress": "2.0.0-alpha.17",
|
|
34
|
+
"vue": "^3.4.0",
|
|
35
|
+
"vue-tsc": "^3.2.7"
|
|
36
|
+
},
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"registry": "https://registry.npmjs.org/",
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"start": "vitepress dev .",
|
|
44
|
+
"docs:build": "vitepress build .",
|
|
45
|
+
"build": "rollup -c"
|
|
46
|
+
}
|
|
47
|
+
}
|
package/rollup.config.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import resolve from "@rollup/plugin-node-resolve";
|
|
2
|
+
import typescript from "@rollup/plugin-typescript";
|
|
3
|
+
import postcss from 'rollup-plugin-postcss';
|
|
4
|
+
import terser from "@rollup/plugin-terser";
|
|
5
|
+
import { defineConfig } from "rollup";
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
input: "src/index.ts",
|
|
9
|
+
external: ["react", "react-dom", "react-dom/client", "react/jsx-runtime"],
|
|
10
|
+
plugins: [
|
|
11
|
+
terser(),
|
|
12
|
+
resolve(),
|
|
13
|
+
postcss({
|
|
14
|
+
inject: true,
|
|
15
|
+
minimize: true,
|
|
16
|
+
}),
|
|
17
|
+
typescript({
|
|
18
|
+
tsconfig: "./tsconfig.lib.json",
|
|
19
|
+
declaration: true,
|
|
20
|
+
declarationDir: "dist",
|
|
21
|
+
}),
|
|
22
|
+
],
|
|
23
|
+
output: [
|
|
24
|
+
{
|
|
25
|
+
file: "dist/index.esm.js",
|
|
26
|
+
format: "esm",
|
|
27
|
+
sourcemap: true,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
file: "dist/index.cjs.js",
|
|
31
|
+
format: "cjs",
|
|
32
|
+
sourcemap: true,
|
|
33
|
+
exports: "named",
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
});
|